summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-09-04 20:47:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-09-04 20:47:08 +0000
commit0f336eff19a696488acf8009525a4968d9c95fe6 (patch)
tree318eb605ed1d05432a59a022aaba6a9db16c606e /storage
parent87253fbc538f8935d9483e0a5b8aac4201cecd7a (diff)
Use the stored index into the BucketInfoList for direct lookup.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketinfo.hpp2
-rw-r--r--storage/src/vespa/storage/distributor/activecopy.cpp5
-rw-r--r--storage/src/vespa/storage/distributor/activecopy.h4
-rw-r--r--storage/src/vespa/storage/distributor/statecheckers.cpp13
4 files changed, 12 insertions, 12 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
index d6e99bd3934..a390a747d67 100644
--- a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
+++ b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
@@ -155,7 +155,7 @@ BucketInfoBase<NodeSeq>::getRef(uint16_t node) const noexcept {
return &n - &_nodes[0];
}
}
- return 0;
+ return 0xffff; // Not found signal
}
template <typename NodeSeq>
diff --git a/storage/src/vespa/storage/distributor/activecopy.cpp b/storage/src/vespa/storage/distributor/activecopy.cpp
index 187c3a138ed..05a6ca59612 100644
--- a/storage/src/vespa/storage/distributor/activecopy.cpp
+++ b/storage/src/vespa/storage/distributor/activecopy.cpp
@@ -4,7 +4,6 @@
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <algorithm>
-#include <cassert>
#include <ostream>
namespace std {
@@ -153,8 +152,8 @@ ActiveCopy::calculate(const Node2Index & idealState, const lib::Distribution& di
(inhibited_groups < max_activation_inhibited_out_of_sync_groups) &&
maybe_majority_info.valid())
{
- const auto* candidate = e->getNode(best->_nodeIndex);
- if (!candidate->getBucketInfo().equalDocumentInfo(maybe_majority_info) && !candidate->active()) {
+ const auto & candidate = e->getNodeRef(best->entryIndex());
+ if (!candidate.getBucketInfo().equalDocumentInfo(maybe_majority_info) && !candidate.active()) {
++inhibited_groups;
continue; // Do _not_ add candidate as activation target since it's out of sync with the majority
}
diff --git a/storage/src/vespa/storage/distributor/activecopy.h b/storage/src/vespa/storage/distributor/activecopy.h
index e54f4f27ca4..0322309ae8d 100644
--- a/storage/src/vespa/storage/distributor/activecopy.h
+++ b/storage/src/vespa/storage/distributor/activecopy.h
@@ -19,7 +19,7 @@ public:
: _nodeIndex(Index::invalid()),
_ideal(Index::invalid()),
_doc_count(0),
- _entryIndex(0),
+ _entryIndex(Index::invalid()),
_ready(false),
_active(false)
{ }
@@ -38,7 +38,7 @@ public:
static ActiveList calculate(const Node2Index & idealState, const lib::Distribution&,
const BucketDatabase::Entry&, uint32_t max_activation_inhibited_out_of_sync_groups);
uint16_t nodeIndex() const noexcept { return _nodeIndex; }
- uint16_t entryIndex() const noexcept { return _entryIndex; }
+ Index entryIndex() const noexcept { return Index(_entryIndex); }
private:
friend ActiveStateOrder;
bool valid_ideal() const noexcept { return _ideal < Index::invalid(); }
diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp
index 3b9594cf22f..17b1549ccc0 100644
--- a/storage/src/vespa/storage/distributor/statecheckers.cpp
+++ b/storage/src/vespa/storage/distributor/statecheckers.cpp
@@ -945,12 +945,13 @@ shouldSkipActivationDueToMaintenanceOrGatherOperationNodes(const ActiveList &act
const StateChecker::Context &c,
std::vector<uint16_t> & operationNodes) {
for (uint32_t i = 0; i < activeNodes.size(); ++i) {
- const auto node_index = activeNodes[i].nodeIndex();
- const BucketCopy *cp(c.entry->getNode(node_index));
- if (!cp || cp->active()) {
- continue;
- }
- if (!cp->ready()) {
+ const ActiveCopy & active = activeNodes[i];
+ if ( ! active.entryIndex().valid()) continue;
+ const BucketCopy & cp(c.entry->getNodeRef(active.entryIndex()));
+ if (cp.active()) continue;
+
+ const auto node_index = active.nodeIndex();
+ if (!cp.ready()) {
if (!c.op_ctx.node_supported_features_repo().node_supported_features(node_index).no_implicit_indexing_of_active_buckets) {
// If copy is not ready, we don't want to activate it if a node
// is set in maintenance. Doing so would imply that we want proton