Skip to content

Commit 20d5dfc

Browse files
committed
also replica
1 parent af744e9 commit 20d5dfc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ private final class AsyncReplicaAction extends AbstractRunnable implements Actio
663663
// something we want to avoid at all costs
664664
private final ClusterStateObserver observer = new ClusterStateObserver(clusterService, null, logger, threadPool.getThreadContext());
665665
private final ConcreteReplicaRequest<ReplicaRequest> replicaRequest;
666+
private final Supplier<Long> localCheckpointSupplier;
667+
private final Supplier<Long> globalCheckpointSupplier;
666668

667669
AsyncReplicaAction(
668670
ConcreteReplicaRequest<ReplicaRequest> replicaRequest,
@@ -675,6 +677,9 @@ private final class AsyncReplicaAction extends AbstractRunnable implements Actio
675677
final ShardId shardId = replicaRequest.getRequest().shardId();
676678
assert shardId != null : "request shardId must be set";
677679
this.replica = getIndexShard(shardId);
680+
this.localCheckpointSupplier = replica.getLocalCheckpointSupplier();
681+
this.globalCheckpointSupplier = replica.getLastSyncedGlobalCheckpointSupplier();
682+
678683
}
679684

680685
@Override
@@ -685,10 +690,7 @@ public void onResponse(Releasable releasable) {
685690
replicaRequest.getRequest(),
686691
replica,
687692
ActionListener.wrap((replicaResult) -> replicaResult.runPostReplicaActions(ActionListener.wrap(r -> {
688-
final ReplicaResponse response = new ReplicaResponse(
689-
replica.getLocalCheckpoint(),
690-
replica.getLastSyncedGlobalCheckpoint()
691-
);
693+
final ReplicaResponse response = new ReplicaResponse(localCheckpointSupplier.get(), globalCheckpointSupplier.get());
692694
releasable.close(); // release shard operation lock before responding to caller
693695
if (logger.isTraceEnabled()) {
694696
logger.trace(

0 commit comments

Comments
 (0)