Skip to content

Commit

Permalink
Update ReadOnlyEngine inside of resetEngineToGlobalCheckpoint to impl…
Browse files Browse the repository at this point in the history
…ement getSegmentInfosSnapshot.

This ensures access to this function is not permitted on the ReadOnlyEngine and is delegated to the new IE once opened.

Signed-off-by: Marc Handalian <handalm@amazon.com>
  • Loading branch information
mch2 committed Aug 29, 2023
1 parent 553118e commit 9cd58d3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/src/main/java/org/opensearch/index/shard/IndexShard.java
Original file line number Diff line number Diff line change
Expand Up @@ -4582,6 +4582,16 @@ public GatedCloseable<IndexCommit> acquireSafeIndexCommit() {
}
}

@Override
public GatedCloseable<SegmentInfos> getSegmentInfosSnapshot() {
synchronized (engineMutex) {
if (newEngineReference.get() == null) {
throw new AlreadyClosedException("engine was closed");
}
return newEngineReference.get().getSegmentInfosSnapshot();
}
}

@Override
public void close() throws IOException {
assert Thread.holdsLock(engineMutex);
Expand Down

0 comments on commit 9cd58d3

Please sign in to comment.