From 9d1ef6243185984705f570955b3eb3aaf69ab4f5 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 21 Jun 2016 15:43:10 -0400 Subject: [PATCH] Inline ReplicationOperation#execute --- .../support/replication/ReplicationOperation.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java b/core/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java index 0d99c4bfcdf..830f092178f 100644 --- a/core/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java +++ b/core/src/main/java/org/elasticsearch/action/support/replication/ReplicationOperation.java @@ -112,6 +112,14 @@ public class ReplicationOperation< if (logger.isTraceEnabled()) { logger.trace("[{}] op [{}] completed on primary for request [{}]", primaryId, opType, request); } + + performOnReplicas(primaryId, replicaRequest); + + successfulShards.incrementAndGet(); + decPendingAndFinishIfNeeded(); + } + + private void performOnReplicas(ShardId primaryId, ReplicaRequest replicaRequest) { // we have to get a new state after successfully indexing into the primary in order to honour recovery semantics. // we have to make sure that every operation indexed into the primary after recovery start will also be replicated // to the recovery target. If we use an old cluster state, we may miss a relocation that has started since then. @@ -134,9 +142,6 @@ public class ReplicationOperation< performOnReplica(shard.buildTargetRelocatingShard(), replicaRequest); } } - - successfulShards.incrementAndGet(); - decPendingAndFinishIfNeeded(); } private void performOnReplica(final ShardRouting shard, final ReplicaRequest replicaRequest) {