mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-18 19:05:06 +00:00
Always return false from refreshNeeded
on ReadOnlyEngine (#35837)
Acquiring a searcher is unnecessary to determine if a refresh is necessary since read-only engines never refresh. Closes #35785
This commit is contained in:
parent
e46e44ce38
commit
4711c5cdf3
@ -1000,7 +1000,7 @@ public abstract class Engine implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public abstract List<Segment> segments(boolean verbose);
|
public abstract List<Segment> segments(boolean verbose);
|
||||||
|
|
||||||
public final boolean refreshNeeded() {
|
public boolean refreshNeeded() {
|
||||||
if (store.tryIncRef()) {
|
if (store.tryIncRef()) {
|
||||||
/*
|
/*
|
||||||
we need to inc the store here since we acquire a searcher and that might keep a file open on the
|
we need to inc the store here since we acquire a searcher and that might keep a file open on the
|
||||||
|
@ -419,4 +419,9 @@ public class ReadOnlyEngine extends Engine {
|
|||||||
protected void processReaders(IndexReader reader, IndexReader previousReader) {
|
protected void processReaders(IndexReader reader, IndexReader previousReader) {
|
||||||
searcherFactory.processReaders(reader, previousReader);
|
searcherFactory.processReaders(reader, previousReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean refreshNeeded() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,8 +531,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv
|
|||||||
long afterQueryTime = System.nanoTime();
|
long afterQueryTime = System.nanoTime();
|
||||||
operationListener.onQueryPhase(context, afterQueryTime - time);
|
operationListener.onQueryPhase(context, afterQueryTime - time);
|
||||||
QueryFetchSearchResult fetchSearchResult = executeFetchPhase(context, operationListener, afterQueryTime);
|
QueryFetchSearchResult fetchSearchResult = executeFetchPhase(context, operationListener, afterQueryTime);
|
||||||
return new ScrollQueryFetchSearchResult(fetchSearchResult,
|
return new ScrollQueryFetchSearchResult(fetchSearchResult, context.shardTarget());
|
||||||
context.shardTarget());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.trace("Fetch phase failed", e);
|
logger.trace("Fetch phase failed", e);
|
||||||
processFailure(context, e);
|
processFailure(context, e);
|
||||||
|
@ -207,10 +207,11 @@ public final class FrozenEngine extends ReadOnlyEngine {
|
|||||||
assert false : "this is a read-only engine";
|
assert false : "this is a read-only engine";
|
||||||
case "doc_stats":
|
case "doc_stats":
|
||||||
assert false : "doc_stats are overwritten";
|
assert false : "doc_stats are overwritten";
|
||||||
|
case "refresh_needed":
|
||||||
|
assert false : "refresh_needed is always false";
|
||||||
case "segments":
|
case "segments":
|
||||||
case "segments_stats":
|
case "segments_stats":
|
||||||
case "completion_stats":
|
case "completion_stats":
|
||||||
case "refresh_needed":
|
|
||||||
case "can_match": // special case for can_match phase - we use the cached point values reader
|
case "can_match": // special case for can_match phase - we use the cached point values reader
|
||||||
maybeOpenReader = false;
|
maybeOpenReader = false;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user