diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-10 21:02:32 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-10 21:04:11 +0000 |
commit | bea697aba57fb3eae4760cc4c28f0cea18c3775a (patch) | |
tree | 00d3ba9972a6193fbb59088d4c8f49873e7ed53d /searchcore | |
parent | dd47119e09309865889c0de7bc0f4374ed86939c (diff) |
Before deciding if it is necessary to restart the scan we must wait until all pending operations are completed.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp index 58019d9a73a..dcc19501dd1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp @@ -17,7 +17,6 @@ #include <vespa/vespalib/util/lambdatask.h> #include <vespa/vespalib/util/gate.h> #include <cassert> -#include <thread> #include <vespa/log/log.h> LOG_SETUP(".proton.server.lidspace.compactionjob"); @@ -221,8 +220,13 @@ CompactionJob::run() _is_disabled = false; } - LidUsageStats stats = _handler->getLidStatus(); if (_scanItr && !_scanItr->valid()) { + bool numPending = getLimiter().numPending(); + if (numPending > 0) { + // We must wait to decide if a rescan is necessary until all operations are completed + return false; + } + LidUsageStats stats = _handler->getLidStatus(); if (shouldRestartScanDocuments(stats)) { _scanItr = _handler->getIterator(); } else { @@ -232,6 +236,7 @@ CompactionJob::run() } } + LidUsageStats stats = _handler->getLidStatus(); if (_scanItr) { return scanDocuments(stats); } else if (_shouldCompactLidSpace) { |