Skip to content

Commit

Permalink
Fix SearchWithRandomIOExceptionsIT tripping assertion in RefreshField…
Browse files Browse the repository at this point in the history
…HasValueListener

We're in some cases tripping an assertion (`assertSearcherIsWarmedUp`) when we run the logic and no refresh actually happened
because of induced exceptions.
This really should only run if the refresh actually went through in any case.

fixes elastic#106752
  • Loading branch information
original-brownbear committed Apr 4, 2024
1 parent b3b4214 commit 2ff1516
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4003,7 +4003,7 @@ public void beforeRefresh() {}

@Override
public void afterRefresh(boolean didRefresh) {
if (enableFieldHasValue) {
if (enableFieldHasValue && didRefresh) {
try (Engine.Searcher hasValueSearcher = getEngine().acquireSearcher("field_has_value")) {
setFieldInfos(FieldInfos.getMergedFieldInfos(hasValueSearcher.getIndexReader()));
} catch (AlreadyClosedException ignore) {
Expand Down

0 comments on commit 2ff1516

Please sign in to comment.