summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-05-03 15:56:58 +0200
committerTor Egge <Tor.Egge@online.no>2022-05-03 15:56:58 +0200
commit24648497bf5c2e8e91ee899c8e5da71ea885b32d (patch)
tree0406b0353c0cc0c3f7847a7ff0b7599082cb4b40 /searchlib
parentad865814d2603978ad33ba4ce32e32509a4d889e (diff)
make search::AttributeVector::_highestValueCount atomic.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 73ff91f135c..d7c9bb8d224 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -169,7 +169,7 @@ AttributeVector::updateStat(bool force) {
}
bool AttributeVector::hasEnum() const { return _hasEnum; }
-uint32_t AttributeVector::getMaxValueCount() const { return _highestValueCount; }
+uint32_t AttributeVector::getMaxValueCount() const { return _highestValueCount.load(std::memory_order_relaxed); }
bool
AttributeVector::isEnumerated(const vespalib::GenericHeader &header)
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index b40f36ad6bd..57c73067671 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -170,7 +170,9 @@ protected:
AttributeVector(vespalib::stringref baseFileName, const Config & c);
void checkSetMaxValueCount(int index) {
- _highestValueCount = std::max(index, _highestValueCount);
+ if (index > _highestValueCount.load(std::memory_order_relaxed)) {
+ _highestValueCount.store(index, std::memory_order_relaxed);
+ }
}
void setEnumMax(uint32_t e) { _enumMax = e; setEnum(); }
@@ -496,7 +498,7 @@ private:
GenerationHandler _genHandler;
GenerationHolder _genHolder;
Status _status;
- int _highestValueCount;
+ std::atomic<int> _highestValueCount;
uint32_t _enumMax;
std::atomic<uint32_t> _committedDocIdLimit; // docid limit for search
uint32_t _uncommittedDocIdLimit; // based on queued changes