Skip to content

Commit 132752f

Browse files
committed
Use withEngine in IndexShard#seqNoStats
1 parent 9e19b85 commit 132752f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
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(getLastKnownGlobalCheckpoint()));
13901390
}
13911391

13921392
public IndexingStats indexingStats() {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,13 @@ protected void asyncShardOperation(final Request request, final ShardId shardId,
403403
throws IOException {
404404
final IndexService indexService = indicesService.indexServiceSafe(request.getShard().getIndex());
405405
final IndexShard indexShard = indexService.getShard(request.getShard().id());
406-
final SeqNoStats seqNoStats = indexShard.seqNoStats();
406+
final long lastKnownGlobalCheckpoint = indexShard.getLastKnownGlobalCheckpoint();
407407

408-
if (request.getFromSeqNo() > seqNoStats.getGlobalCheckpoint()) {
408+
if (request.getFromSeqNo() > lastKnownGlobalCheckpoint) {
409409
logger.trace(
410410
"{} waiting for global checkpoint advancement from [{}] to [{}]",
411411
shardId,
412-
seqNoStats.getGlobalCheckpoint(),
412+
lastKnownGlobalCheckpoint,
413413
request.getFromSeqNo()
414414
);
415415
indexShard.addGlobalCheckpointListener(request.getFromSeqNo(), new GlobalCheckpointListeners.GlobalCheckpointListener() {

0 commit comments

Comments
 (0)