diff options
author | Geir Storli <geirstorli@yahoo.no> | 2017-11-17 13:13:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-17 13:13:45 +0100 |
commit | ef6ad29be045374dbd5a885d036fe12a95c5dc9c (patch) | |
tree | c5e2e878695992e4eb6c3b01ea88fd1881690a7d | |
parent | 7b2b3839f91b1cea95d6cf43a87d9df5b30217c2 (diff) | |
parent | 4c3d432733253d69d7c761aa1e0d2a5217c926bf (diff) |
Merge pull request #4184 from vespa-engine/toregge/stop-using-obsolete-api-to-get-distribution-and-bucketdb
Stop using old API to get distribution and bucket db.
3 files changed, 22 insertions, 16 deletions
diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index 4a3f93d3f45..ec2f79c42e0 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -145,6 +145,8 @@ protected: void adding_diverging_replica_to_existing_trusted_does_not_remove_trusted(); void batch_update_from_distributor_change_does_not_mark_diverging_replicas_as_trusted(); + auto &defaultDistributorBucketSpace() { return getBucketSpaceRepo().get(makeBucketSpace()); } + bool bucketExistsThatHasNode(int bucketCount, uint16_t node) const; ClusterInformation::CSP createClusterInfo(const std::string& clusterState) { @@ -185,8 +187,7 @@ public: } std::vector<uint16_t> nodes; - getBucketDBUpdater().getDistributorComponent() - .getDistribution().getIdealNodes( + defaultDistributorBucketSpace().getDistribution().getIdealNodes( lib::NodeType::STORAGE, state, document::BucketId(16, i), @@ -247,7 +248,7 @@ public: } std::vector<uint16_t> nodes; - getBucketDBUpdater().getDistributorComponent().getDistribution().getIdealNodes( + defaultDistributorBucketSpace().getDistribution().getIdealNodes( lib::NodeType::STORAGE, state, document::BucketId(id), @@ -585,7 +586,7 @@ BucketDBUpdaterTest::testNormalUsage() // Ensure distribution hash is set correctly CPPUNIT_ASSERT_EQUAL( - getBucketDBUpdater().getDistributorComponent().getDistribution() + defaultDistributorBucketSpace().getDistribution() .getNodeGraph().getDistributionConfigHash(), dynamic_cast<const RequestBucketInfoCommand&>( *_sender.commands[0]).getDistributionHash()); @@ -916,8 +917,7 @@ BucketDBUpdaterTest::testBitChange() int cnt=0; for (int i=0; cnt < 2; i++) { - lib::Distribution distribution = getBucketDBUpdater().getDistributorComponent() - .getDistribution(); + lib::Distribution distribution = defaultDistributorBucketSpace().getDistribution(); std::vector<uint16_t> distributors; if (distribution.getIdealDistributorNode( lib::ClusterState("redundancy:1 bits:14 storage:1 distributor:2"), @@ -1835,10 +1835,9 @@ BucketDBUpdaterTest::mergeBucketLists( } BucketDumper dumper(includeBucketInfo); - getBucketDBUpdater().getDistributorComponent() - .getBucketDatabase().forEach(dumper); - getBucketDBUpdater().getDistributorComponent() - .getBucketDatabase().clear(); + auto &bucketDb(defaultDistributorBucketSpace().getBucketDatabase()); + bucketDb.forEach(dumper); + bucketDb.clear(); return dumper.ost.str(); } diff --git a/storage/src/tests/distributor/operationtargetresolvertest.cpp b/storage/src/tests/distributor/operationtargetresolvertest.cpp index 30891d17b3f..72f028a3ff8 100644 --- a/storage/src/tests/distributor/operationtargetresolvertest.cpp +++ b/storage/src/tests/distributor/operationtargetresolvertest.cpp @@ -10,6 +10,7 @@ #include <tests/distributor/distributortestutil.h> #include <vespa/vdslib/distribution/idealnodecalculatorimpl.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/storage/distributor/distributor_bucket_space_repo.h> #include <vespa/storage/distributor/operationtargetresolverimpl.h> #include <vespa/storage/distributor/externaloperationhandler.h> #include <vespa/config/helper/configgetter.hpp> @@ -148,11 +149,13 @@ OperationTargetResolverTest::getInstances(const BucketId& id, bool stripToRedundancy) { lib::IdealNodeCalculatorImpl idealNodeCalc; - idealNodeCalc.setDistribution(getExternalOperationHandler().getDistribution()); + auto &bucketSpaceRepo(getExternalOperationHandler().getBucketSpaceRepo()); + auto &distributorBucketSpace(bucketSpaceRepo.get(makeBucketSpace())); + idealNodeCalc.setDistribution(distributorBucketSpace.getDistribution()); idealNodeCalc.setClusterState(getExternalOperationHandler().getClusterState()); OperationTargetResolverImpl resolver( - getExternalOperationHandler().getBucketDatabase(), idealNodeCalc, 16, - getExternalOperationHandler().getDistribution().getRedundancy(), + distributorBucketSpace.getBucketDatabase(), idealNodeCalc, 16, + distributorBucketSpace.getDistribution().getRedundancy(), makeBucketSpace()); if (stripToRedundancy) { return resolver.getInstances(OperationTargetResolver::PUT, id); @@ -179,11 +182,13 @@ OperationTargetResolverTest::testMultipleNodes() { setupDistributor(1, 2, "storage:2 distributor:1"); + auto &bucketSpaceRepo(getExternalOperationHandler().getBucketSpaceRepo()); + auto &distributorBucketSpace(bucketSpaceRepo.get(makeBucketSpace())); for (int i = 0; i < 100; ++i) { addNodesToBucketDB(BucketId(16, i), "0=0,1=0"); lib::IdealNodeCalculatorImpl idealNodeCalc; - idealNodeCalc.setDistribution(getExternalOperationHandler().getDistribution()); + idealNodeCalc.setDistribution(distributorBucketSpace.getDistribution()); idealNodeCalc.setClusterState(getExternalOperationHandler().getClusterState()); lib::IdealNodeList idealNodes( idealNodeCalc.getIdealStorageNodes(BucketId(16, i))); diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp index 51fe964a96b..1519a9183ba 100644 --- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp @@ -166,12 +166,14 @@ PersistenceMessageTrackerImpl::checkCopiesDeleted() // Don't check the buckets that have been remapped here, as we will // create them. + const auto &bucketSpaceRepo(_manager.getBucketSpaceRepo()); for (BucketInfoMap::const_iterator iter = _bucketInfo.begin(); iter != _bucketInfo.end(); iter++) { - BucketDatabase::Entry dbentry = - _manager.getBucketDatabase().get(iter->first.getBucketId()); + const auto &bucketSpace(bucketSpaceRepo.get(iter->first.getBucketSpace())); + const auto &bucketDb(bucketSpace.getBucketDatabase()); + BucketDatabase::Entry dbentry = bucketDb.get(iter->first.getBucketId()); if (!dbentry.valid()) { continue; |