File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
server/src/main/java/org/opensearch/index/engine Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 4040import org .apache .lucene .store .Directory ;
4141import org .apache .lucene .store .Lock ;
4242import org .opensearch .Version ;
43+ import org .opensearch .cluster .metadata .IndexMetadata ;
4344import org .opensearch .common .concurrent .GatedCloseable ;
4445import org .opensearch .common .lucene .Lucene ;
4546import org .opensearch .common .lucene .index .OpenSearchDirectoryReader ;
@@ -166,7 +167,7 @@ public ReadOnlyEngine(
166167 }
167168
168169 protected void ensureMaxSeqNoEqualsToGlobalCheckpoint (final SeqNoStats seqNoStats ) {
169- if (requireCompleteHistory == false ) {
170+ if (requireCompleteHistory == false || isClosedRemoteIndex () ) {
170171 return ;
171172 }
172173 // Before 3.0 the global checkpoint is not known and up to date when the engine is created after
@@ -187,6 +188,14 @@ protected void ensureMaxSeqNoEqualsToGlobalCheckpoint(final SeqNoStats seqNoStat
187188 }
188189 }
189190
191+ /**
192+ * Returns true if this is a remote store index (included if migrating as well) which is closed.
193+ */
194+ private boolean isClosedRemoteIndex () {
195+ return this .engineConfig .getIndexSettings ().isAssignedOnRemoteNode ()
196+ && this .engineConfig .getIndexSettings ().getIndexMetadata ().getState () == IndexMetadata .State .CLOSE ;
197+ }
198+
190199 protected boolean assertMaxSeqNoEqualsToGlobalCheckpoint (final long maxSeqNo , final long globalCheckpoint ) {
191200 assert maxSeqNo == globalCheckpoint : "max seq. no. [" + maxSeqNo + "] does not match [" + globalCheckpoint + "]" ;
192201 return true ;
You can’t perform that action at this time.
0 commit comments