summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <3535158+havardpe@users.noreply.github.com>2022-04-27 16:04:38 +0200
committerGitHub <noreply@github.com>2022-04-27 16:04:38 +0200
commit6af60e5fbd2ef841359f62f676aab94c19206fa3 (patch)
tree7b18c8837f623599ab9fe5e92486a79d3e8b9368
parent08479187853177039fc629ad5690daad6312e6d3 (diff)
parente1f8d2842614f7b7f8be52c0c2fe951b0f48ebe4 (diff)
Merge pull request #22313 from vespa-engine/toregge/use-atomic-compact-lid-space-generation-in-attribute-vector
Use atomic _compactLidSpaceGeneration in search::AttributeVector.
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 1edd5d9fe76..73ff91f135c 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -528,7 +528,7 @@ AttributeVector::compactLidSpace(uint32_t wantedLidLimit) {
}
commit();
_committedDocIdLimit.store(wantedLidLimit, std::memory_order_release);
- _compactLidSpaceGeneration = _genHandler.getCurrentGeneration();
+ _compactLidSpaceGeneration.store(_genHandler.getCurrentGeneration(), std::memory_order_relaxed);
incGeneration();
}
@@ -536,7 +536,7 @@ AttributeVector::compactLidSpace(uint32_t wantedLidLimit) {
bool
AttributeVector::canShrinkLidSpace() const {
return wantShrinkLidSpace() &&
- _compactLidSpaceGeneration < getFirstUsedGeneration();
+ _compactLidSpaceGeneration.load(std::memory_order_relaxed) < getFirstUsedGeneration();
}
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 5f336ab921f..b40f36ad6bd 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -501,7 +501,7 @@ private:
std::atomic<uint32_t> _committedDocIdLimit; // docid limit for search
uint32_t _uncommittedDocIdLimit; // based on queued changes
uint64_t _createSerialNum;
- uint64_t _compactLidSpaceGeneration;
+ std::atomic<uint64_t> _compactLidSpaceGeneration;
bool _hasEnum;
bool _loaded;
bool _isUpdateableInMemoryOnly;