@@ -538,7 +538,7 @@ private OpVsLuceneDocStatus compareOpToLuceneDocBasedOnSeqNo(final Operation op)
538
538
} else {
539
539
// load from index
540
540
assert incrementIndexVersionLookup ();
541
- try (Searcher searcher = acquireSearcher ("load_seq_no" )) {
541
+ try (Searcher searcher = acquireSearcher ("load_seq_no" , SearcherScope . INTERNAL )) {
542
542
DocIdAndSeqNo docAndSeqNo = VersionsAndSeqNoResolver .loadDocIdAndSeqNo (searcher .reader (), op .uid ());
543
543
if (docAndSeqNo == null ) {
544
544
status = OpVsLuceneDocStatus .LUCENE_DOC_NOT_FOUND ;
@@ -965,7 +965,7 @@ private boolean assertDocDoesNotExist(final Index index, final boolean allowDele
965
965
throw new AssertionError ("doc [" + index .type () + "][" + index .id () + "] exists in version map (version " + versionValue + ")" );
966
966
}
967
967
} else {
968
- try (Searcher searcher = acquireSearcher ("assert doc doesn't exist" )) {
968
+ try (Searcher searcher = acquireSearcher ("assert doc doesn't exist" , SearcherScope . INTERNAL )) {
969
969
final long docsWithId = searcher .searcher ().count (new TermQuery (index .uid ()));
970
970
if (docsWithId > 0 ) {
971
971
throw new AssertionError ("doc [" + index .type () + "][" + index .id () + "] exists [" + docsWithId + "] times in index" );
@@ -1672,7 +1672,9 @@ protected final void closeNoLock(String reason, CountDownLatch closedLatch) {
1672
1672
assert rwl .isWriteLockedByCurrentThread () || failEngineLock .isHeldByCurrentThread () : "Either the write lock must be held or the engine must be currently be failing itself" ;
1673
1673
try {
1674
1674
this .versionMap .clear ();
1675
- internalSearcherManager .removeListener (versionMap );
1675
+ if (internalSearcherManager != null ) {
1676
+ internalSearcherManager .removeListener (versionMap );
1677
+ }
1676
1678
try {
1677
1679
IOUtils .close (externalSearcherManager , internalSearcherManager );
1678
1680
} catch (Exception e ) {
0 commit comments