Do not try to optimize when there are too few files, it seems to bring more drawbacks than benefits
This commit is contained in:
@@ -166,6 +166,20 @@ namespace lms::scanner
|
||||
LMS_LOG(DBUPDATER, INFO, "Using " << _jobScheduler->getThreadCount() << " thread(s) for jobs");
|
||||
_jobScheduler->setShouldAbortCallback([this]() { return _abortScan; });
|
||||
|
||||
std::size_t totalFilesCount{};
|
||||
{
|
||||
auto& session{ _db.getTLSSession() };
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
totalFilesCount = session.getTotalFilesCount();
|
||||
}
|
||||
|
||||
// Force optimize in case scanner aborted during a large import, but do this only if there are enough elements in the database
|
||||
// Otherwise, indexes may be not used and queries may be slower and slower while adding more and more elements in the db
|
||||
LMS_LOG(DBUPDATER, INFO, "Scanned file count = " << totalFilesCount);
|
||||
if (totalFilesCount >= 1'000)
|
||||
_db.getTLSSession().fullAnalyze();
|
||||
|
||||
refreshTracingLoggerStats();
|
||||
refreshScanSettings();
|
||||
|
||||
start();
|
||||
@@ -371,7 +385,8 @@ namespace lms::scanner
|
||||
_currentScanStepStats.reset(); // must be sync with _curState
|
||||
}
|
||||
|
||||
LMS_LOG(DBUPDATER, INFO, "Scan " << (_abortScan ? "aborted" : "complete") << ". Changes = " << stats.nbChanges() << " (added = " << stats.additions << ", removed = " << stats.deletions << ", updated = " << stats.updates << ", failures = " << stats.failures << "), Not changed = " << stats.skips << ", Scanned = " << stats.scans << " (errors = " << stats.errorsCount << "), features fetched = " << stats.featuresFetched << ", duplicates = " << stats.duplicates.size());
|
||||
refreshTracingLoggerStats();
|
||||
LMS_LOG(DBUPDATER, INFO, "Scan " << (_abortScan ? "aborted" : "complete") << ". Changes = " << stats.getChangesCount() << " (added = " << stats.additions << ", removed = " << stats.deletions << ", updated = " << stats.updates << ", failures = " << stats.failures << "), Not changed = " << stats.skips << ", Scanned = " << stats.scans << " (errors = " << stats.errorsCount << "), features fetched = " << stats.featuresFetched << ", duplicates = " << stats.duplicates.size());
|
||||
|
||||
if (!_abortScan)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user