summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-04-30 13:50:30 +0000
committerGeir Storli <geirst@verizonmedia.com>2021-04-30 13:50:30 +0000
commitbcdf9c503f9b93d9949c09fbd9e3a1239f592e0b (patch)
tree85160e2977e1290cc35a3f6ba9426c52caa905bc /storage
parent724ae768c90eefd08ffab79d6dafc520abeacc04 (diff)
Add option on whether to use the bucket database in DistributorBucketSpace.
Don't use bucket databases in the top-level distributor component and bucket db updater. It is only distributor stripes that should have a bucket database.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space.h5
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp6
-rw-r--r--storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h3
-rw-r--r--storage/src/vespa/storage/distributor/distributor_component.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor_component.h4
6 files changed, 15 insertions, 11 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp
index 9ec4d31eb32..37e7dc86e43 100644
--- a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp
@@ -22,8 +22,8 @@ DistributorBucketSpace::DistributorBucketSpace()
{
}
-DistributorBucketSpace::DistributorBucketSpace(uint16_t node_index)
- : _bucketDatabase(std::make_unique<BTreeBucketDatabase>()),
+DistributorBucketSpace::DistributorBucketSpace(uint16_t node_index, bool use_bucket_db)
+ : _bucketDatabase(use_bucket_db ? std::make_unique<BTreeBucketDatabase>() : std::unique_ptr<BTreeBucketDatabase>()),
_clusterState(),
_distribution(),
_node_index(node_index),
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.h b/storage/src/vespa/storage/distributor/distributor_bucket_space.h
index 558cbada31f..8898039eb02 100644
--- a/storage/src/vespa/storage/distributor/distributor_bucket_space.h
+++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.h
@@ -47,7 +47,8 @@ class DistributorBucketSpace {
bool owns_bucket_in_state(const lib::Distribution& distribution, const lib::ClusterState& cluster_state, document::BucketId bucket) const;
public:
explicit DistributorBucketSpace();
- explicit DistributorBucketSpace(uint16_t node_index);
+ // TODO STRIPE: Remove the use_bucket_db parameter when legacy mode is gone.
+ explicit DistributorBucketSpace(uint16_t node_index, bool use_bucket_db = true);
~DistributorBucketSpace();
DistributorBucketSpace(const DistributorBucketSpace&) = delete;
@@ -56,9 +57,11 @@ public:
DistributorBucketSpace& operator=(DistributorBucketSpace&&) = delete;
BucketDatabase& getBucketDatabase() noexcept {
+ assert(_bucketDatabase);
return *_bucketDatabase;
}
const BucketDatabase& getBucketDatabase() const noexcept {
+ assert(_bucketDatabase);
return *_bucketDatabase;
}
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp
index 4f64dab9a68..368483d3f2d 100644
--- a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp
@@ -13,11 +13,11 @@ using document::BucketSpace;
namespace storage::distributor {
-DistributorBucketSpaceRepo::DistributorBucketSpaceRepo(uint16_t node_index)
+DistributorBucketSpaceRepo::DistributorBucketSpaceRepo(uint16_t node_index, bool use_bucket_db)
: _map()
{
- add(document::FixedBucketSpaces::default_space(), std::make_unique<DistributorBucketSpace>(node_index));
- add(document::FixedBucketSpaces::global_space(), std::make_unique<DistributorBucketSpace>(node_index));
+ add(document::FixedBucketSpaces::default_space(), std::make_unique<DistributorBucketSpace>(node_index, use_bucket_db));
+ add(document::FixedBucketSpaces::global_space(), std::make_unique<DistributorBucketSpace>(node_index, use_bucket_db));
}
DistributorBucketSpaceRepo::~DistributorBucketSpaceRepo() = default;
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h
index f012b25e351..e7552f058d8 100644
--- a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h
+++ b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h
@@ -19,7 +19,8 @@ private:
BucketSpaceMap _map;
public:
- explicit DistributorBucketSpaceRepo(uint16_t node_index);
+ // TODO STRIPE: Remove the use_bucket_db parameter when legacy mode is gone.
+ explicit DistributorBucketSpaceRepo(uint16_t node_index, bool use_bucket_db = true);
~DistributorBucketSpaceRepo();
DistributorBucketSpaceRepo(const DistributorBucketSpaceRepo&&) = delete;
diff --git a/storage/src/vespa/storage/distributor/distributor_component.cpp b/storage/src/vespa/storage/distributor/distributor_component.cpp
index 05a605fbcae..e01d7e7cb6d 100644
--- a/storage/src/vespa/storage/distributor/distributor_component.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_component.cpp
@@ -11,8 +11,8 @@ DistributorComponent::DistributorComponent(DistributorInterface& distributor,
const std::string& name)
: storage::DistributorComponent(comp_reg, name),
_distributor(distributor),
- _bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index())),
- _read_only_bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index()))
+ _bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index(), false)),
+ _read_only_bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index(), false))
{
}
diff --git a/storage/src/vespa/storage/distributor/distributor_component.h b/storage/src/vespa/storage/distributor/distributor_component.h
index 8db70f490ba..dabc927aa00 100644
--- a/storage/src/vespa/storage/distributor/distributor_component.h
+++ b/storage/src/vespa/storage/distributor/distributor_component.h
@@ -22,8 +22,8 @@ class DistributorComponent : public storage::DistributorComponent,
public DistributorOperationContext {
private:
DistributorInterface& _distributor;
- // TODO STRIPE: These bucket space repos are only temporary until we get an interface
- // to look at state per bucket space.
+ // TODO STRIPE: When legacy mode is removed, replace this with mapping from BucketSpace to struct with
+ // lib::ClusterState and lib::Distribution (need by BucketDBUpdater).
std::unique_ptr<DistributorBucketSpaceRepo> _bucket_space_repo;
std::unique_ptr<DistributorBucketSpaceRepo> _read_only_bucket_space_repo;