mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-08 20:10:00 +00:00
InternalEngineTests: fix a potential NPE in assertOpsOnPrimary
assertOpsOnPrimary may inherit a situation where the document exist but it doesn't the last indexed value. This cloud cause an NPE.
This commit is contained in:
parent
61c5976aee
commit
f0df5e64d8
@ -1560,7 +1560,9 @@ public class InternalEngineTests extends ESTestCase {
|
||||
if (randomBoolean()) {
|
||||
// refresh and take the chance to check everything is ok so far
|
||||
assertVisibleCount(engine, docDeleted ? 0 : 1);
|
||||
if (docDeleted == false) {
|
||||
// even if doc is not not deleted, lastFieldValue can still be null if this is the
|
||||
// first op and it failed.
|
||||
if (docDeleted == false && lastFieldValue != null) {
|
||||
try (Searcher searcher = engine.acquireSearcher("test")) {
|
||||
final TotalHitCountCollector collector = new TotalHitCountCollector();
|
||||
searcher.searcher().search(new TermQuery(new Term("value", lastFieldValue)), collector);
|
||||
|
Loading…
x
Reference in New Issue
Block a user