Skip to content

Commit 0b38499

Browse files
committed
Update global checkpoint with permit after recovery
After recovery completes from a primary, we now update the local knowledge on the primary of the global checkpoint on the recovery target. However if this occurs concurrently with a relocation, an assertion could trip that we are no longer in primary mode. As this local knowledge should only be tracked when we are in primary mode, updating this local knowledge should be done under a permit. This commit causes that to be the case. Relates #26666
1 parent ff5470d commit 0b38499

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/elasticsearch/indices/recovery/RecoverySourceHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ public void finalizeRecovery(final long targetLocalCheckpoint) {
477477
runUnderPrimaryPermit(() -> shard.markAllocationIdAsInSync(request.targetAllocationId(), targetLocalCheckpoint));
478478
final long globalCheckpoint = shard.getGlobalCheckpoint();
479479
cancellableThreads.execute(() -> recoveryTarget.finalizeRecovery(globalCheckpoint));
480-
shard.updateGlobalCheckpointForShard(request.targetAllocationId(), globalCheckpoint);
480+
runUnderPrimaryPermit(() -> shard.updateGlobalCheckpointForShard(request.targetAllocationId(), globalCheckpoint));
481481

482482
if (request.isPrimaryRelocation()) {
483483
logger.trace("performing relocation hand-off");

0 commit comments

Comments
 (0)