@@ -405,7 +405,7 @@ public void updateShardState(final ShardRouting newRouting,
405405 assert currentRouting .active () == false : "we are in POST_RECOVERY, but our shard routing is active " + currentRouting ;
406406
407407 if (newRouting .primary () && currentRouting .isRelocationTarget () == false ) {
408- replicationTracker .activatePrimaryMode (getEngine (). getLocalCheckpointTracker (). getCheckpoint ());
408+ replicationTracker .activatePrimaryMode (getLocalCheckpoint ());
409409 }
410410
411411 changeState (IndexShardState .STARTED , "global state is [" + newRouting .state () + "]" );
@@ -479,8 +479,7 @@ public void updateShardState(final ShardRouting newRouting,
479479 */
480480 engine .rollTranslogGeneration ();
481481 engine .fillSeqNoGaps (newPrimaryTerm );
482- replicationTracker .updateLocalCheckpoint (currentRouting .allocationId ().getId (),
483- getEngine ().getLocalCheckpointTracker ().getCheckpoint ());
482+ replicationTracker .updateLocalCheckpoint (currentRouting .allocationId ().getId (), getLocalCheckpoint ());
484483 primaryReplicaSyncer .accept (this , new ActionListener <ResyncTask >() {
485484 @ Override
486485 public void onResponse (ResyncTask resyncTask ) {
@@ -506,7 +505,7 @@ public void onFailure(Exception e) {
506505 }
507506 },
508507 e -> failShard ("exception during primary term transition" , e ));
509- replicationTracker .activatePrimaryMode (getEngine (). getLocalCheckpointTracker (). getCheckpoint ());
508+ replicationTracker .activatePrimaryMode (getLocalCheckpoint ());
510509 primaryTerm = newPrimaryTerm ;
511510 }
512511 }
@@ -873,7 +872,7 @@ public CommitStats commitStats() {
873872 @ Nullable
874873 public SeqNoStats seqNoStats () {
875874 Engine engine = getEngineOrNull ();
876- return engine == null ? null : engine .getLocalCheckpointTracker (). getStats (replicationTracker .getGlobalCheckpoint ());
875+ return engine == null ? null : engine .getSeqNoStats (replicationTracker .getGlobalCheckpoint ());
877876 }
878877
879878 public IndexingStats indexingStats (String ... types ) {
@@ -1707,7 +1706,7 @@ public void updateGlobalCheckpointForShard(final String allocationId, final long
17071706 * @throws InterruptedException if the thread was interrupted while blocking on the condition
17081707 */
17091708 public void waitForOpsToComplete (final long seqNo ) throws InterruptedException {
1710- getEngine ().getLocalCheckpointTracker (). waitForOpsToComplete (seqNo );
1709+ getEngine ().waitForOpsToComplete (seqNo );
17111710 }
17121711
17131712 /**
@@ -1740,7 +1739,7 @@ public void markAllocationIdAsInSync(final String allocationId, final long local
17401739 * @return the local checkpoint
17411740 */
17421741 public long getLocalCheckpoint () {
1743- return getEngine ().getLocalCheckpointTracker (). getCheckpoint ();
1742+ return getEngine ().getLocalCheckpoint ();
17441743 }
17451744
17461745 /**
@@ -1781,7 +1780,7 @@ public void maybeSyncGlobalCheckpoint(final String reason) {
17811780 return ;
17821781 }
17831782 // only sync if there are not operations in flight
1784- final SeqNoStats stats = getEngine ().getLocalCheckpointTracker (). getStats (replicationTracker .getGlobalCheckpoint ());
1783+ final SeqNoStats stats = getEngine ().getSeqNoStats (replicationTracker .getGlobalCheckpoint ());
17851784 if (stats .getMaxSeqNo () == stats .getGlobalCheckpoint ()) {
17861785 final ObjectLongMap <String > globalCheckpoints = getInSyncGlobalCheckpoints ();
17871786 final String allocationId = routingEntry ().allocationId ().getId ();
@@ -1818,7 +1817,7 @@ public ReplicationGroup getReplicationGroup() {
18181817 */
18191818 public void updateGlobalCheckpointOnReplica (final long globalCheckpoint , final String reason ) {
18201819 verifyReplicationTarget ();
1821- final long localCheckpoint = getEngine (). getLocalCheckpointTracker (). getCheckpoint ();
1820+ final long localCheckpoint = getLocalCheckpoint ();
18221821 if (globalCheckpoint > localCheckpoint ) {
18231822 /*
18241823 * This can happen during recovery when the shard has started its engine but recovery is not finalized and is receiving global
@@ -1847,8 +1846,7 @@ public void activateWithPrimaryContext(final ReplicationTracker.PrimaryContext p
18471846 verifyPrimary ();
18481847 assert shardRouting .isRelocationTarget () : "only relocation target can update allocation IDs from primary context: " + shardRouting ;
18491848 assert primaryContext .getCheckpointStates ().containsKey (routingEntry ().allocationId ().getId ()) &&
1850- getEngine ().getLocalCheckpointTracker ().getCheckpoint () ==
1851- primaryContext .getCheckpointStates ().get (routingEntry ().allocationId ().getId ()).getLocalCheckpoint ();
1849+ getLocalCheckpoint () == primaryContext .getCheckpointStates ().get (routingEntry ().allocationId ().getId ()).getLocalCheckpoint ();
18521850 synchronized (mutex ) {
18531851 replicationTracker .activateWithPrimaryContext (primaryContext ); // make changes to primaryMode flag only under mutex
18541852 }
@@ -2234,7 +2232,7 @@ public void acquireReplicaOperationPermit(final long operationPrimaryTerm, final
22342232 operationPrimaryTerm ,
22352233 getLocalCheckpoint (),
22362234 localCheckpoint );
2237- getEngine ().getLocalCheckpointTracker (). resetCheckpoint (localCheckpoint );
2235+ getEngine ().resetLocalCheckpoint (localCheckpoint );
22382236 getEngine ().rollTranslogGeneration ();
22392237 });
22402238 globalCheckpointUpdated = true ;
0 commit comments