aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-12-02 12:40:44 +0100
committerTor Egge <Tor.Egge@broadpark.no>2020-12-02 13:08:04 +0100
commit1dd6bcf0478568cb01ce6192caafde7fcd8d1faf (patch)
tree936637a552189e7a3186826ceac6520680449c16 /storage
parentab89448992a6aae83c8daaffac9486ed48e88e65 (diff)
Remove DistributorComponent trampoline member function.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/distributor/distributortest.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space.h10
-rw-r--r--storage/src/vespa/storage/distributor/distributor_operation_context.h3
-rw-r--r--storage/src/vespa/storage/distributor/distributorcomponent.cpp8
-rw-r--r--storage/src/vespa/storage/distributor/distributorcomponent.h13
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp5
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp4
7 files changed, 18 insertions, 29 deletions
diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp
index 3c80bfd3881..93f503c27e4 100644
--- a/storage/src/tests/distributor/distributortest.cpp
+++ b/storage/src/tests/distributor/distributortest.cpp
@@ -558,9 +558,7 @@ TEST_F(DistributorTest, no_db_resurrection_for_bucket_not_owned_in_pending_state
document::BucketId nonOwnedBucket(16, 3);
EXPECT_FALSE(getDistributorBucketSpace().check_ownership_in_pending_state(nonOwnedBucket).isOwned());
- EXPECT_FALSE(getBucketDBUpdater().getDistributorComponent()
- .checkOwnershipInPendingAndCurrentState(makeDocumentBucket(nonOwnedBucket))
- .isOwned());
+ EXPECT_FALSE(getDistributorBucketSpace().check_ownership_in_pending_and_current_state(nonOwnedBucket).isOwned());
std::vector<BucketCopy> copies;
copies.emplace_back(1234, 0, api::BucketInfo(0x567, 1, 2));
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.h b/storage/src/vespa/storage/distributor/distributor_bucket_space.h
index 4044f7c5119..bd28c2bbce6 100644
--- a/storage/src/vespa/storage/distributor/distributor_bucket_space.h
+++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.h
@@ -99,12 +99,22 @@ public:
* Otherwise always returns "is owned", i.e. it must also be checked in the current state.
*/
BucketOwnership check_ownership_in_pending_state(document::BucketId bucket) const;
+ /**
+ * Returns the ownership status of a bucket as decided with the given
+ * distribution and cluster state -and- that of the pending cluster
+ * state and distribution (if any pending exists).
+ */
BucketOwnership check_ownership_in_pending_and_given_state(const lib::Distribution& distribution,
const lib::ClusterState& clusterState,
document::BucketId bucket) const;
BucketOwnership check_ownership_in_pending_and_current_state_fallback(document::BucketId bucket) const;
const std::vector<bool>& get_available_nodes() const { return _available_nodes; }
std::vector<uint16_t> get_ideal_nodes(document::BucketId bucket);
+ /**
+ * Returns the ownership status of a bucket as decided with the current
+ * distribution and cluster state -and- that of the pending cluster
+ * state and distribution (if any pending exists).
+ */
BucketOwnership check_ownership_in_pending_and_current_state(document::BucketId bucket);
};
diff --git a/storage/src/vespa/storage/distributor/distributor_operation_context.h b/storage/src/vespa/storage/distributor/distributor_operation_context.h
index e4832a7db12..c439c89bc4d 100644
--- a/storage/src/vespa/storage/distributor/distributor_operation_context.h
+++ b/storage/src/vespa/storage/distributor/distributor_operation_context.h
@@ -23,7 +23,6 @@ class DistributorOperationContext {
public:
virtual ~DistributorOperationContext() {}
virtual api::Timestamp generate_unique_timestamp() = 0;
- virtual BucketOwnership check_ownership_in_pending_and_current_state(const document::Bucket &bucket) const = 0;
virtual void update_bucket_database(const document::Bucket& bucket,
const BucketCopy& changed_node,
uint32_t update_flags = 0) = 0;
@@ -31,7 +30,7 @@ public:
const std::vector<BucketCopy>& changed_nodes,
uint32_t update_flags = 0) = 0;
virtual void remove_node_from_bucket_database(const document::Bucket& bucket, uint16_t node_index) = 0;
- virtual const DistributorBucketSpaceRepo& bucket_space_repo() const = 0;
+ virtual DistributorBucketSpaceRepo& bucket_space_repo() = 0;
virtual void send_inline_split_if_bucket_too_large(document::BucketSpace bucket_space,
const BucketDatabase::Entry& entry,
diff --git a/storage/src/vespa/storage/distributor/distributorcomponent.cpp b/storage/src/vespa/storage/distributor/distributorcomponent.cpp
index aa0ae42bf9d..bdbfb61f996 100644
--- a/storage/src/vespa/storage/distributor/distributorcomponent.cpp
+++ b/storage/src/vespa/storage/distributor/distributorcomponent.cpp
@@ -55,14 +55,6 @@ DistributorComponent::getIdealNodes(const document::Bucket &bucket) const
return bucket_space.get_ideal_nodes(bucket.getBucketId());
}
-BucketOwnership
-DistributorComponent::checkOwnershipInPendingAndCurrentState(
- const document::Bucket &bucket) const
-{
- auto &bucket_space(_bucketSpaceRepo.get(bucket.getBucketSpace()));
- return bucket_space.check_ownership_in_pending_and_current_state(bucket.getBucketId());
-}
-
api::StorageMessageAddress
DistributorComponent::nodeAddress(uint16_t nodeIndex) const
{
diff --git a/storage/src/vespa/storage/distributor/distributorcomponent.h b/storage/src/vespa/storage/distributor/distributorcomponent.h
index 805ecd5c7e3..709673da02b 100644
--- a/storage/src/vespa/storage/distributor/distributorcomponent.h
+++ b/storage/src/vespa/storage/distributor/distributorcomponent.h
@@ -43,14 +43,6 @@ public:
~DistributorComponent() override;
/**
- * Returns the ownership status of a bucket as decided with the given
- * distribution and cluster state -and- that of the pending cluster
- * state and distribution (if any pending exists).
- */
- BucketOwnership checkOwnershipInPendingAndCurrentState(
- const document::Bucket &bucket) const;
-
- /**
* Returns a reference to the current cluster state bundle. Valid until the
* next time the distributor main thread processes its message queue.
*/
@@ -166,9 +158,6 @@ public:
// Implements DistributorOperationContext
api::Timestamp generate_unique_timestamp() override { return getUniqueTimestamp(); }
- BucketOwnership check_ownership_in_pending_and_current_state(const document::Bucket &bucket) const override {
- return checkOwnershipInPendingAndCurrentState(bucket);
- }
void update_bucket_database(const document::Bucket& bucket,
const BucketCopy& changed_node,
uint32_t update_flags = 0) override {
@@ -182,7 +171,7 @@ public:
void remove_node_from_bucket_database(const document::Bucket& bucket, uint16_t node_index) override {
removeNodeFromDB(bucket, node_index);
}
- const DistributorBucketSpaceRepo& bucket_space_repo() const override {
+ DistributorBucketSpaceRepo& bucket_space_repo() override {
return getBucketSpaceRepo();
}
void send_inline_split_if_bucket_too_large(document::BucketSpace bucket_space,
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index 72193c99a64..46eb104db56 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -5,6 +5,7 @@
#include "putoperation.h"
#include "updateoperation.h"
#include <vespa/storage/distributor/distributor_bucket_space.h>
+#include <vespa/storage/distributor/distributor_bucket_space_repo.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/document.h>
@@ -251,8 +252,8 @@ TwoPhaseUpdateOperation::onStart(DistributorMessageSender& sender) {
bool
TwoPhaseUpdateOperation::lostBucketOwnershipBetweenPhases() const
{
- document::Bucket updateDocBucket(_updateCmd->getBucket().getBucketSpace(), _updateDocBucketId);
- BucketOwnership bo(_op_ctx.check_ownership_in_pending_and_current_state(updateDocBucket));
+ auto &bucket_space(_op_ctx.bucket_space_repo().get(_updateCmd->getBucket().getBucketSpace()));
+ BucketOwnership bo(bucket_space.check_ownership_in_pending_and_current_state(_updateDocBucketId));
return !bo.isOwned();
}
diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
index c35a6671c8d..251843c7873 100644
--- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp
@@ -276,8 +276,8 @@ VisitorOperation::verifyDistributorIsNotDown(const lib::ClusterState& state)
void
VisitorOperation::verifyDistributorOwnsBucket(const document::BucketId& bid)
{
- document::Bucket bucket(_msg->getBucketSpace(), bid);
- BucketOwnership bo(_op_ctx.check_ownership_in_pending_and_current_state(bucket));
+ auto &bucket_space(_op_ctx.bucket_space_repo().get(_msg->getBucketSpace()));
+ BucketOwnership bo(bucket_space.check_ownership_in_pending_and_current_state(bid));
if (!bo.isOwned()) {
verifyDistributorIsNotDown(bo.getNonOwnedState());
std::string systemStateStr = bo.getNonOwnedState().toString();