Skip to content

Commit 517cfc3

Browse files
authored
Add read-only Engine (#33563)
This change adds an engine implementation that opens a reader on an existing index but doesn't permit any refreshes or modifications to the index. Relates to #32867 Relates to #32844
1 parent 2f3b542 commit 517cfc3

File tree

5 files changed

+533
-8
lines changed

5 files changed

+533
-8
lines changed

server/src/main/java/org/elasticsearch/index/engine/Engine.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ protected final void ensureOpen() {
661661
}
662662

663663
/** get commits stats for the last commit */
664-
public CommitStats commitStats() {
664+
public final CommitStats commitStats() {
665665
return new CommitStats(getLastCommittedSegmentInfos());
666666
}
667667

@@ -951,7 +951,9 @@ public final boolean refreshNeeded() {
951951
*
952952
* @return the commit Id for the resulting commit
953953
*/
954-
public abstract CommitId flush() throws EngineException;
954+
public final CommitId flush() throws EngineException {
955+
return flush(false, false);
956+
}
955957

956958

957959
/**

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,11 +1576,6 @@ public boolean shouldPeriodicallyFlush() {
15761576
|| localCheckpointTracker.getCheckpoint() == localCheckpointTracker.getMaxSeqNo();
15771577
}
15781578

1579-
@Override
1580-
public CommitId flush() throws EngineException {
1581-
return flush(false, false);
1582-
}
1583-
15841579
@Override
15851580
public CommitId flush(boolean force, boolean waitIfOngoing) throws EngineException {
15861581
ensureOpen();

0 commit comments

Comments
 (0)