mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Throw an ISE rather than an hard assertion in SearchPhaseController#getTotalHits
This change turns an assertion into an IllegalStateException in SearchPhaseController#getTotalHits. The goal is to help identify the cause of the failures in https://github.com/elastic/elasticsearch/issues/37179 which seems to fail only in CI. The assertion will be restored when the issue is solved (NORELEASE).
This commit is contained in:
parent
dc371ef593
commit
84d520b0e5
@ -760,7 +760,13 @@ public final class SearchPhaseController {
|
|||||||
if (trackTotalHitsUpTo == SearchContext.TRACK_TOTAL_HITS_DISABLED) {
|
if (trackTotalHitsUpTo == SearchContext.TRACK_TOTAL_HITS_DISABLED) {
|
||||||
return null;
|
return null;
|
||||||
} else if (trackTotalHitsUpTo == SearchContext.TRACK_TOTAL_HITS_ACCURATE) {
|
} else if (trackTotalHitsUpTo == SearchContext.TRACK_TOTAL_HITS_ACCURATE) {
|
||||||
assert totalHitsRelation == Relation.EQUAL_TO;
|
// NORELEASE The assertion below has been replaced by a runtime exception in order to debug
|
||||||
|
// https://github.com/elastic/elasticsearch/issues/37179.
|
||||||
|
// The assertion should be restored and the exception removed when this issue is solved.
|
||||||
|
// assert totalHitsRelation == Relation.EQUAL_TO;
|
||||||
|
if (totalHitsRelation != Relation.EQUAL_TO) {
|
||||||
|
throw new IllegalStateException("Expected accurate total hits but got " + new TotalHits(totalHits, totalHitsRelation));
|
||||||
|
}
|
||||||
return new TotalHits(totalHits, totalHitsRelation);
|
return new TotalHits(totalHits, totalHitsRelation);
|
||||||
} else {
|
} else {
|
||||||
if (totalHits < trackTotalHitsUpTo) {
|
if (totalHits < trackTotalHitsUpTo) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user