@@ -728,7 +728,7 @@ protected PrimaryResult performOnPrimary(IndexShard primary, ResyncReplicationRe
728728
729729 @ Override
730730 protected void performOnReplica (ResyncReplicationRequest request , IndexShard replica ) throws Exception {
731- executeResyncOnReplica (replica , request );
731+ executeResyncOnReplica (replica , request , getPrimaryShard (). getPendingPrimaryTerm (), getPrimaryShard (). getGlobalCheckpoint () );
732732 }
733733 }
734734
@@ -741,8 +741,15 @@ private TransportWriteAction.WritePrimaryResult<ResyncReplicationRequest, Resync
741741 return result ;
742742 }
743743
744- private void executeResyncOnReplica (IndexShard replica , ResyncReplicationRequest request ) throws Exception {
745- final Translog .Location location = TransportResyncReplicationAction .performOnReplica (request , replica );
744+ private void executeResyncOnReplica (IndexShard replica , ResyncReplicationRequest request ,
745+ long operationPrimaryTerm , long globalCheckpointOnPrimary ) throws Exception {
746+ final Translog .Location location ;
747+ final PlainActionFuture <Releasable > acquirePermitFuture = new PlainActionFuture <>();
748+ replica .acquireReplicaOperationPermit (
749+ operationPrimaryTerm , globalCheckpointOnPrimary , acquirePermitFuture , ThreadPool .Names .SAME , request );
750+ try (Releasable ignored = acquirePermitFuture .actionGet ()) {
751+ location = TransportResyncReplicationAction .performOnReplica (request , replica );
752+ }
746753 TransportWriteActionTestHelper .performPostWriteActions (replica , request , location , logger );
747754 }
748755}
0 commit comments