aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2022-03-08 12:26:17 +0000
committerTor Brede Vekterli <vekterli@yahooinc.com>2022-03-08 12:26:17 +0000
commitfef434a6cdd346c5b95fbae5f2ea6103093a1a10 (patch)
tree51fe42e939bb251193a29b3462ac0c321de7c0de /searchcore/src
parentb1015bd850fb94157d8c21077578e45628384e02 (diff)
Make MatchEngine node state polling atomic
State is polled across threads, so access must be well-defined.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
index 8489a68af15..0ec27ac419f 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
@@ -177,14 +177,14 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req)
}
bool MatchEngine::isOnline() const {
- return _nodeUp;
+ return _nodeUp.load(std::memory_order_relaxed);
}
void
MatchEngine::setNodeUp(bool nodeUp)
{
- _nodeUp = nodeUp;
+ _nodeUp.store(nodeUp, std::memory_order_relaxed);
}
void
@@ -192,7 +192,7 @@ MatchEngine::setNodeMaintenance(bool nodeMaintenance)
{
_nodeMaintenance = nodeMaintenance;
if (nodeMaintenance) {
- _nodeUp = false;
+ _nodeUp.store(false, std::memory_order_relaxed);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
index 3d3be775a4a..fcafdc5a5f8 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
@@ -25,7 +25,7 @@ private:
HandlerMap<ISearchHandler> _handlers;
vespalib::ThreadStackExecutor _executor;
vespalib::SimpleThreadBundle::Pool _threadBundlePool;
- bool _nodeUp;
+ std::atomic<bool> _nodeUp;
bool _nodeMaintenance;
public: