소스 검색

Make sure shard is not closed when updating local checkpoint

If a primary shard is relocated, and then subsequently closed, there is a short window where ReplicationOperation could access the
closed shard (engine is not shut down yet) and, because it does not know that the shard was relocated, try to update the local
checkpoint, tripping an assertion in GlobalCheckPointTracker that a local checkpoint cannot be updated if it's not in primary mode.
Yannick Welsch 8 년 전
부모
커밋
d6a8984be6
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      core/src/main/java/org/elasticsearch/index/shard/IndexShard.java

+ 2 - 1
core/src/main/java/org/elasticsearch/index/shard/IndexShard.java

@@ -477,7 +477,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
                                  */
                                 getEngine().restoreLocalCheckpointFromTranslog();
                                 getEngine().fillSeqNoGaps(newPrimaryTerm);
-                                updateLocalCheckpointForShard(currentRouting.allocationId().getId(),
+                                getEngine().seqNoService().updateLocalCheckpointForShard(currentRouting.allocationId().getId(),
                                     getEngine().seqNoService().getLocalCheckpoint());
                                 primaryReplicaSyncer.accept(this, new ActionListener<ResyncTask>() {
                                     @Override
@@ -1661,6 +1661,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
      */
     public void updateLocalCheckpointForShard(final String allocationId, final long checkpoint) {
         verifyPrimary();
+        verifyNotClosed();
         getEngine().seqNoService().updateLocalCheckpointForShard(allocationId, checkpoint);
     }