Ensure ReplicationOperation notify listener once (#68256)

ReplicationOperation can notify the listener twice if the primary shard
is demoted after it has completed the primary operation.

Closes #68049

Signed-off-by: Peter Nied <petern@amazon.com>
This commit is contained in:
Nhat Nguyen 2021-01-31 09:24:30 -05:00 committed by Peter Nied
parent da51d8c61f
commit a37fc3be68
1 changed files with 1 additions and 1 deletions

View File

@ -119,7 +119,7 @@ public class ReplicationOperation<
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) {