File tree 1 file changed +10
-1
lines changed
server/src/main/java/org/opensearch/index/engine
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 41
41
import org .apache .lucene .store .Lock ;
42
42
import org .opensearch .LegacyESVersion ;
43
43
import org .opensearch .Version ;
44
+ import org .opensearch .cluster .metadata .IndexMetadata ;
44
45
import org .opensearch .common .concurrent .GatedCloseable ;
45
46
import org .opensearch .common .lucene .Lucene ;
46
47
import org .opensearch .common .lucene .index .OpenSearchDirectoryReader ;
@@ -180,7 +181,7 @@ public Translog.Operation next() {
180
181
}
181
182
182
183
protected void ensureMaxSeqNoEqualsToGlobalCheckpoint (final SeqNoStats seqNoStats ) {
183
- if (requireCompleteHistory == false ) {
184
+ if (requireCompleteHistory == false || isClosedRemoteIndex () ) {
184
185
return ;
185
186
}
186
187
// Before 8.0 the global checkpoint is not known and up to date when the engine is created after
@@ -205,6 +206,14 @@ protected void ensureMaxSeqNoEqualsToGlobalCheckpoint(final SeqNoStats seqNoStat
205
206
}
206
207
}
207
208
209
+ /**
210
+ * Returns true if this is a remote store index (included if migrating as well) which is closed.
211
+ */
212
+ private boolean isClosedRemoteIndex () {
213
+ return this .engineConfig .getIndexSettings ().isAssignedOnRemoteNode ()
214
+ && this .engineConfig .getIndexSettings ().getIndexMetadata ().getState () == IndexMetadata .State .CLOSE ;
215
+ }
216
+
208
217
protected boolean assertMaxSeqNoEqualsToGlobalCheckpoint (final long maxSeqNo , final long globalCheckpoint ) {
209
218
assert maxSeqNo == globalCheckpoint : "max seq. no. [" + maxSeqNo + "] does not match [" + globalCheckpoint + "]" ;
210
219
return true ;
You can’t perform that action at this time.
0 commit comments