diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-11-09 11:25:28 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-11-10 10:07:50 +0000 |
commit | c70c1047b80c0beac1c11fdb6b11bcd5b6efcb5b (patch) | |
tree | 2863927bf143a13cb9bf2ac24eae7d635861313d /storage | |
parent | 33f10442e9eac7a0b3776cfe19a128b8d3b46f9c (diff) |
Pass distributor bucket space to pending bucket space db transition.
Diffstat (limited to 'storage')
3 files changed, 14 insertions, 7 deletions
diff --git a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp index 36961a0fec0..c2b4358333a 100644 --- a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp +++ b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp @@ -3,6 +3,7 @@ #include "pending_bucket_space_db_transition.h" #include "clusterinformation.h" #include "pendingclusterstate.h" +#include "distributor_bucket_space.h" #include <vespa/storage/common/bucketoperationlogger.h> #include <algorithm> @@ -12,6 +13,7 @@ LOG_SETUP(".pendingbucketspacedbtransition"); namespace storage::distributor { PendingBucketSpaceDbTransition::PendingBucketSpaceDbTransition(const PendingClusterState &pendingClusterState, + DistributorBucketSpace &distributorBucketSpace, std::shared_ptr<const ClusterInformation> clusterInfo, const lib::ClusterState &newClusterState, api::Timestamp creationTimestamp) @@ -23,7 +25,8 @@ PendingBucketSpaceDbTransition::PendingBucketSpaceDbTransition(const PendingClus _outdatedNodes(pendingClusterState.getOutdatedNodeSet()), _newClusterState(newClusterState), _creationTimestamp(creationTimestamp), - _pendingClusterState(pendingClusterState) + _pendingClusterState(pendingClusterState), + _distributorBucketSpace(distributorBucketSpace) { } @@ -192,8 +195,9 @@ PendingBucketSpaceDbTransition::addToBucketDB(BucketDatabase& db, const Range& r } void -PendingBucketSpaceDbTransition::mergeInto(BucketDatabase& db) +PendingBucketSpaceDbTransition::mergeIntoBucketDatabase() { + BucketDatabase &db(_distributorBucketSpace.getBucketDatabase()); std::sort(_entries.begin(), _entries.end()); db.forEach(*this); diff --git a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h index 649ce676d88..730d6540820 100644 --- a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h +++ b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h @@ -12,6 +12,7 @@ namespace storage::distributor { class ClusterInformation; class PendingClusterState; +class DistributorBucketSpace; /** * Class used by PendingClusterState to track request bucket info @@ -42,6 +43,7 @@ private: const lib::ClusterState &_newClusterState; const api::Timestamp _creationTimestamp; const PendingClusterState &_pendingClusterState; + DistributorBucketSpace &_distributorBucketSpace; // BucketDataBase::MutableEntryProcessor API bool process(BucketDatabase::Entry& e) override; @@ -73,13 +75,14 @@ private: public: PendingBucketSpaceDbTransition(const PendingClusterState &pendingClusterState, + DistributorBucketSpace &distributorBucketSpace, std::shared_ptr<const ClusterInformation> clusterInfo, const lib::ClusterState &newClusterState, api::Timestamp creationTimestamp); ~PendingBucketSpaceDbTransition(); - // Merges all the results with the given bucket database. - void mergeInto(BucketDatabase& db); + // Merges all the results with the corresponding bucket database. + void mergeIntoBucketDatabase(); // Adds the info from the reply to our list of information. void onRequestBucketInfoReply(const api::RequestBucketInfoReply &reply, uint16_t node); diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index e8f9442c76f..833899140d8 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -80,7 +80,7 @@ void PendingClusterState::initializeBucketSpaceTransitions() { for (auto &elem : _bucketSpaceRepo) { - _pendingTransitions.emplace(elem.first, std::make_unique<PendingBucketSpaceDbTransition>(*this, _clusterInfo, _newClusterState, _creationTimestamp)); + _pendingTransitions.emplace(elem.first, std::make_unique<PendingBucketSpaceDbTransition>(*this, *elem.second, _clusterInfo, _newClusterState, _creationTimestamp)); } if (shouldRequestBucketInfo()) { requestNodes(); @@ -420,8 +420,8 @@ PendingClusterState::requestNodesToString() const void PendingClusterState::mergeIntoBucketDatabases() { - for (auto &elem : _bucketSpaceRepo) { - _pendingTransitions[elem.first]->mergeInto(elem.second->getBucketDatabase()); + for (auto &elem : _pendingTransitions) { + elem.second->mergeIntoBucketDatabase(); } } |