Skip to content

Commit

Permalink
[Pick 2.0](index writer) fix docWriter is null, when reenter close (#217
Browse files Browse the repository at this point in the history
)

* [Fix](index writer) fix core if docWriter nullptr when IndexWriter doFlush (#213)

* [Fix](index writer) fix docWriter is null, when reenter close (#214)
  • Loading branch information
airborne12 committed May 22, 2024
1 parent f40d429 commit 692fdf7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/CLucene/index/IndexWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ void IndexWriter::closeInternal(bool waitForMerges) {
try {
if (infoStream != NULL)
message(string("now flush at close"));

// if docWriter is nullptr, maybe it's been flushed already
if (docWriter == nullptr) {
return;
}
docWriter->close();

// Only allow a _CLNEW merge to be triggered if we are
Expand Down Expand Up @@ -2048,6 +2051,11 @@ void IndexWriter::flush(bool triggerMerge, bool _flushDocStores) {
bool IndexWriter::doFlush(bool _flushDocStores) {
SCOPED_LOCK_MUTEX(THIS_LOCK)

// if docWriter is nullptr, maybe it's been flushed already
if (docWriter == nullptr) {
return false;
}

// Make sure no threads are actively adding a document

// Returns true if docWriter is currently aborting, in
Expand Down

0 comments on commit 692fdf7

Please sign in to comment.