Index: the fs indexer would return early on interrupt, without flushing the queues, causing the Xapian db close to be possibly called with the db update thread still active

This commit is contained in:
Jean-Francois Dockes 2021-11-24 16:00:37 +01:00
parent 756a944ef3
commit 5f2716e628

View File

@ -195,6 +195,7 @@ bool FsIndexer::index(int flags)
m_walker.setMaxDepth(2);
}
bool walkok(true);
for (const auto& topdir : m_tdl) {
LOGDEB("FsIndexer::index: Indexing " << topdir << " into " <<
getDbDir() << "\n");
@ -229,7 +230,9 @@ bool FsIndexer::index(int flags)
if (m_walker.walk(topdir, *this) != FsTreeWalker::FtwOk) {
LOGERR("FsIndexer::index: error while indexing " << topdir <<
": " << m_walker.getReason() << "\n");
return false;
// DO NOT return: we need to flush the queues before the Db can be closed !
walkok = false;
break;
}
}
@ -250,8 +253,8 @@ bool FsIndexer::index(int flags)
}
m_config->storeMissingHelperDesc(missing);
}
LOGINFO("fsindexer index time: " << chron.millis() << " mS\n");
return true;
LOGINFO("fsindexer: status: " << walkok << " index time: " << chron.millis() << " mS\n");
return walkok;
}
static bool matchesSkipped(