Skip to content

Commit a8960ea

Browse files
committed
getMaxSeqNo withEngine
1 parent dfe18d7 commit a8960ea

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ public CommitStats commitStats() {
13861386
* @throws AlreadyClosedException if shard is closed
13871387
*/
13881388
public SeqNoStats seqNoStats() {
1389-
return getEngine().getSeqNoStats(replicationTracker.getGlobalCheckpoint());
1389+
return withEngine(engine -> engine.getSeqNoStats(replicationTracker.getGlobalCheckpoint()));
13901390
}
13911391

13921392
public IndexingStats indexingStats() {
@@ -3061,7 +3061,7 @@ public void maybeSyncGlobalCheckpoint(final String reason) {
30613061
}
30623062
assert assertPrimaryMode();
30633063
// only sync if there are no operations in flight, or when using async durability
3064-
final SeqNoStats stats = getEngine().getSeqNoStats(replicationTracker.getGlobalCheckpoint());
3064+
final SeqNoStats stats = withEngine(engine -> engine.getSeqNoStats(replicationTracker.getGlobalCheckpoint()));
30653065
final boolean asyncDurability = indexSettings().getTranslogDurability() == Translog.Durability.ASYNC;
30663066
if (stats.getMaxSeqNo() == stats.getGlobalCheckpoint() || asyncDurability) {
30673067
final var trackedGlobalCheckpointsNeedSync = replicationTracker.trackedGlobalCheckpointsNeedSync();

server/src/main/java/org/elasticsearch/index/shard/LocalShardSnapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Index getIndex() {
4040
}
4141

4242
long maxSeqNo() {
43-
return shard.getEngine().getSeqNoStats(-1).getMaxSeqNo();
43+
return shard.withEngine(engine -> engine.getSeqNoStats(-1)).getMaxSeqNo();
4444
}
4545

4646
long maxUnsafeAutoIdTimestamp() {

0 commit comments

Comments
 (0)