diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-02 13:45:49 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-02 13:45:49 +0100 |
commit | f52796b5398f0b32037e4ab84a439d16c7ade9af (patch) | |
tree | 50556df0195efb14dad874605aa75d5ed3a2ca93 /storage | |
parent | 1dd6bcf0478568cb01ce6192caafde7fcd8d1faf (diff) |
Use mutable hash maps in DistributorBucketSpace.
Diffstat (limited to 'storage')
4 files changed, 8 insertions, 8 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp index 111e58045a1..82bbeadb9a5 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp @@ -168,7 +168,7 @@ DistributorBucketSpace::check_ownership_in_pending_and_current_state_fallback(do } std::vector<uint16_t> -DistributorBucketSpace::get_ideal_nodes(document::BucketId bucket) +DistributorBucketSpace::get_ideal_nodes(document::BucketId bucket) const { assert(bucket.getUsedBits() >= _distribution_bits); if (bucket.getUsedBits() > 33) { // cf. storage::lib::Distribution::getStorageSeed @@ -186,7 +186,7 @@ DistributorBucketSpace::get_ideal_nodes(document::BucketId bucket) } BucketOwnership -DistributorBucketSpace::check_ownership_in_pending_and_current_state(document::BucketId bucket) +DistributorBucketSpace::check_ownership_in_pending_and_current_state(document::BucketId bucket) const { if (bucket.getUsedBits() < _distribution_bits) { // Cannot map to super bucket ==> cannot cache result diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.h b/storage/src/vespa/storage/distributor/distributor_bucket_space.h index bd28c2bbce6..52f8f5f869c 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space.h +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.h @@ -37,8 +37,8 @@ class DistributorBucketSpace { uint16_t _distribution_bits; std::shared_ptr<const lib::ClusterState> _pending_cluster_state; std::vector<bool> _available_nodes; - vespalib::hash_map<document::BucketId, BucketOwnership, document::BucketId::hash> _ownerships; - vespalib::hash_map<document::BucketId, std::vector<uint16_t>, document::BucketId::hash> _ideal_nodes; + mutable vespalib::hash_map<document::BucketId, BucketOwnership, document::BucketId::hash> _ownerships; + mutable vespalib::hash_map<document::BucketId, std::vector<uint16_t>, document::BucketId::hash> _ideal_nodes; void clear(); void enumerate_available_nodes(); @@ -109,13 +109,13 @@ public: 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); + std::vector<uint16_t> get_ideal_nodes(document::BucketId bucket) const; /** * 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); + BucketOwnership check_ownership_in_pending_and_current_state(document::BucketId bucket) const; }; } diff --git a/storage/src/vespa/storage/distributor/distributor_operation_context.h b/storage/src/vespa/storage/distributor/distributor_operation_context.h index c439c89bc4d..9b2c46f0071 100644 --- a/storage/src/vespa/storage/distributor/distributor_operation_context.h +++ b/storage/src/vespa/storage/distributor/distributor_operation_context.h @@ -30,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 DistributorBucketSpaceRepo& bucket_space_repo() = 0; + virtual const DistributorBucketSpaceRepo& bucket_space_repo() const = 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.h b/storage/src/vespa/storage/distributor/distributorcomponent.h index 709673da02b..896166c74ce 100644 --- a/storage/src/vespa/storage/distributor/distributorcomponent.h +++ b/storage/src/vespa/storage/distributor/distributorcomponent.h @@ -171,7 +171,7 @@ public: void remove_node_from_bucket_database(const document::Bucket& bucket, uint16_t node_index) override { removeNodeFromDB(bucket, node_index); } - DistributorBucketSpaceRepo& bucket_space_repo() override { + const DistributorBucketSpaceRepo& bucket_space_repo() const override { return getBucketSpaceRepo(); } void send_inline_split_if_bucket_too_large(document::BucketSpace bucket_space, |