Skip to content

Commit

Permalink
Ensure ReplicationOperation notify listener once (#68256)
Browse files Browse the repository at this point in the history
ReplicationOperation can notify the listener twice if the primary shard 
is demoted after it has completed the primary operation.

Closes #68049
  • Loading branch information
dnhatn committed Feb 2, 2021
1 parent 3a1695f commit 20d2313
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void execute() throws Exception {

totalShards.incrementAndGet();
pendingActions.incrementAndGet(); // increase by 1 until we finish all primary coordination
primary.perform(request, ActionListener.wrap(this::handlePrimaryResult, resultListener::onFailure));
primary.perform(request, ActionListener.wrap(this::handlePrimaryResult, this::finishAsFailed));
}

private void handlePrimaryResult(final PrimaryResultT primaryResult) {
Expand Down

0 comments on commit 20d2313

Please sign in to comment.