diff options
84 files changed, 181 insertions, 162 deletions
diff --git a/persistence/src/vespa/persistence/spi/clusterstate.cpp b/persistence/src/vespa/persistence/spi/clusterstate.cpp index 8f25e7fb332..d3c7afda222 100644 --- a/persistence/src/vespa/persistence/spi/clusterstate.cpp +++ b/persistence/src/vespa/persistence/spi/clusterstate.cpp @@ -43,14 +43,6 @@ ClusterState::ClusterState(const ClusterState& other) { ClusterState::~ClusterState() = default; -ClusterState& ClusterState::operator=(const ClusterState& other) { - ClusterState copy(other); - _state = std::move(copy._state); - _nodeIndex = copy._nodeIndex; - _distribution = std::move(copy._distribution); - return *this; -} - bool ClusterState::shouldBeReady(const Bucket& b) const { assert(_distribution); assert(_state); diff --git a/persistence/src/vespa/persistence/spi/clusterstate.h b/persistence/src/vespa/persistence/spi/clusterstate.h index 5b2b41b3161..5ae692f7661 100644 --- a/persistence/src/vespa/persistence/spi/clusterstate.h +++ b/persistence/src/vespa/persistence/spi/clusterstate.h @@ -25,9 +25,8 @@ public: const lib::Distribution& distribution); ClusterState(vespalib::nbostream& i); - ClusterState(const ClusterState& other); - ClusterState& operator=(const ClusterState& other); + ClusterState& operator=(const ClusterState& other) = delete; ~ClusterState(); /** diff --git a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp index eee67ce6c6b..b639ae17bde 100644 --- a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp @@ -4,6 +4,7 @@ #include "ibucketstatechangedhandler.h" #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/vespalib/util/lambdatask.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.server.buckethandler"); @@ -35,12 +36,8 @@ BucketHandler::performSetCurrentState(BucketId bucketId, LOG(debug, "performSetCurrentState(%s, %s)", bucketId.toString().c_str(), (active ? "ACTIVE" : "NOT_ACTIVE")); _ready->setBucketState(bucketId, active); - if (!_changedHandlers.empty()) { - typedef std::vector<IBucketStateChangedHandler *> Chv; - Chv &chs(_changedHandlers); - for (Chv::const_iterator itr = chs.begin(); itr != chs.end(); ++itr) { - (*itr)->notifyBucketStateChanged(bucketId, newState); - } + for (const auto & ch : _changedHandlers) { + ch->notifyBucketStateChanged(bucketId, newState); } resultHandler->handle(Result()); } diff --git a/searchcore/src/vespa/searchcore/proton/server/buckethandler.h b/searchcore/src/vespa/searchcore/proton/server/buckethandler.h index 2ff93ad7cfc..1732a6cdd54 100644 --- a/searchcore/src/vespa/searchcore/proton/server/buckethandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/buckethandler.h @@ -2,11 +2,11 @@ #pragma once -#include <vespa/searchcore/proton/documentmetastore/i_bucket_handler.h> -#include <vespa/searchcore/proton/persistenceengine/resulthandler.h> -#include <vespa/vespalib/util/threadstackexecutorbase.h> #include "iclusterstatechangedhandler.h" #include "ibucketstatechangednotifier.h" +#include <vespa/searchcore/proton/documentmetastore/i_bucket_handler.h> +#include <vespa/searchcore/proton/persistenceengine/resulthandler.h> +#include <vespa/vespalib/util/executor.h> namespace proton { @@ -30,15 +30,13 @@ private: storage::spi::BucketInfo::ActiveState newState, IGenericResultHandler *resultHandler); - void - performPopulateActiveBuckets(document::BucketId::List buckets, - IGenericResultHandler *resultHandler); + void performPopulateActiveBuckets(document::BucketId::List buckets, + IGenericResultHandler *resultHandler); /** * Deactivate all active buckets when this node transitions from * up to down in cluster state. Called by document db executor thread. */ - void - deactivateAllActiveBuckets(); + void deactivateAllActiveBuckets(); public: /** @@ -47,9 +45,7 @@ public: * @param executor The executor in which to run all tasks. */ BucketHandler(vespalib::Executor &executor); - - virtual - ~BucketHandler(); + ~BucketHandler() override; void setReadyBucketHandler(documentmetastore::IBucketHandler &ready); @@ -67,14 +63,11 @@ public: IGenericResultHandler &resultHandler); // Implements IClusterStateChangedHandler - virtual void - notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) override; + void notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) override; // Implement IBucketStateChangedNotifier - virtual void - addBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; - virtual void - removeBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; + void addBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; + void removeBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; }; } // namespace proton diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp index f15a30d8805..e14bb8e11d1 100644 --- a/storage/src/tests/bucketdb/bucketmanagertest.cpp +++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp @@ -19,6 +19,8 @@ #include <tests/common/dummystoragelink.h> #include <tests/common/testhelper.h> #include <vespa/vdslib/state/random.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/gtest/gtest.h> #include <future> diff --git a/storage/src/tests/common/global_bucket_space_distribution_converter_test.cpp b/storage/src/tests/common/global_bucket_space_distribution_converter_test.cpp index 2103970a8f0..4eb8321699a 100644 --- a/storage/src/tests/common/global_bucket_space_distribution_converter_test.cpp +++ b/storage/src/tests/common/global_bucket_space_distribution_converter_test.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/storage/common/global_bucket_space_distribution_converter.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/config/config.h> #include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> diff --git a/storage/src/tests/common/testnodestateupdater.cpp b/storage/src/tests/common/testnodestateupdater.cpp index 27f21a31768..ffa76af1e8a 100644 --- a/storage/src/tests/common/testnodestateupdater.cpp +++ b/storage/src/tests/common/testnodestateupdater.cpp @@ -2,6 +2,7 @@ #include "testnodestateupdater.h" #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> namespace storage { @@ -23,7 +24,7 @@ TestNodeStateUpdater::getClusterStateBundle() const } void -TestNodeStateUpdater::setClusterState(lib::ClusterState::CSP c) +TestNodeStateUpdater::setClusterState(std::shared_ptr<const lib::ClusterState> c) { setClusterStateBundle(std::make_shared<const lib::ClusterStateBundle>(*c)); } diff --git a/storage/src/tests/common/testnodestateupdater.h b/storage/src/tests/common/testnodestateupdater.h index eb15b97a37f..5bf48c46f1a 100644 --- a/storage/src/tests/common/testnodestateupdater.h +++ b/storage/src/tests/common/testnodestateupdater.h @@ -10,6 +10,10 @@ #include <vespa/storage/common/nodestateupdater.h> +namespace storage::lib { + class ClusterState; + class ClusterStateBundle; +} namespace storage { struct TestNodeStateUpdater : public NodeStateUpdater @@ -46,7 +50,7 @@ public: _current = std::make_shared<lib::NodeState>(state); } - void setClusterState(lib::ClusterState::CSP c); + void setClusterState(std::shared_ptr<const lib::ClusterState> c); void setClusterStateBundle(std::shared_ptr<const lib::ClusterStateBundle> clusterStateBundle); size_t explicit_node_state_reply_send_invocations() const noexcept { diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index f932786e2e2..e61050c21a3 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -7,6 +7,8 @@ #include <vespa/config-load-type.h> #include <vespa/config-fleetcontroller.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/time.h> #include <vespa/config/config.h> diff --git a/storage/src/tests/common/teststorageapp.h b/storage/src/tests/common/teststorageapp.h index 3742879bd30..9e273002580 100644 --- a/storage/src/tests/common/teststorageapp.h +++ b/storage/src/tests/common/teststorageapp.h @@ -84,7 +84,7 @@ public: const document::BucketIdFactory& getBucketIdFactory() { return _compReg.getBucketIdFactory(); } TestNodeStateUpdater& getStateUpdater() { return _nodeStateUpdater; } - lib::Distribution::SP getDistribution() + std::shared_ptr<lib::Distribution> & getDistribution() { return _compReg.getDistribution(); } TestNodeStateUpdater& getNodeStateUpdater() { return _nodeStateUpdater; } uint16_t getIndex() const { return _compReg.getIndex(); } diff --git a/storage/src/tests/distributor/distributortestutil.cpp b/storage/src/tests/distributor/distributortestutil.cpp index b472ac1284e..2802b976256 100644 --- a/storage/src/tests/distributor/distributortestutil.cpp +++ b/storage/src/tests/distributor/distributortestutil.cpp @@ -6,6 +6,7 @@ #include <vespa/storage/distributor/distributor.h> #include <vespa/storage/distributor/distributor_bucket_space.h> #include <vespa/storage/distributor/distributorcomponent.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/text/stringtokenizer.h> using document::test::makeBucketSpace; diff --git a/storage/src/tests/distributor/distributortestutil.h b/storage/src/tests/distributor/distributortestutil.h index ee0e1a9eb65..630d466a72e 100644 --- a/storage/src/tests/distributor/distributortestutil.h +++ b/storage/src/tests/distributor/distributortestutil.h @@ -141,7 +141,7 @@ public: // "End to end" distribution change trigger, which will invoke the bucket // DB updater as expected based on the previous and new cluster state // and config. - void triggerDistributionChange(lib::Distribution::SP distr); + void triggerDistributionChange(std::shared_ptr<lib::Distribution> distr); framework::defaultimplementation::FakeClock& getClock() { return _node->getClock(); } DistributorComponentRegister& getComponentRegister() { return _node->getComponentRegister(); } diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index 90fcf40b3fe..7a90299bfb3 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -1,13 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/test/make_document_bucket.h> #include <tests/common/dummystoragelink.h> +#include <tests/distributor/distributortestutil.h> #include <vespa/storage/distributor/idealstatemanager.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/storage/distributor/operations/idealstate/mergeoperation.h> #include <vespa/storage/distributor/bucketdbupdater.h> #include <vespa/storage/distributor/distributor.h> #include <vespa/storage/distributor/operation_sequencer.h> -#include <tests/distributor/distributortestutil.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/document/test/make_document_bucket.h> #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/vespalib/gtest/gtest.h> diff --git a/storage/src/tests/distributor/operationtargetresolvertest.cpp b/storage/src/tests/distributor/operationtargetresolvertest.cpp index 721809d4515..a19708d6a27 100644 --- a/storage/src/tests/distributor/operationtargetresolvertest.cpp +++ b/storage/src/tests/distributor/operationtargetresolvertest.cpp @@ -9,6 +9,7 @@ #include <vespa/storageapi/message/persistence.h> #include <tests/distributor/distributortestutil.h> #include <vespa/vdslib/distribution/idealnodecalculatorimpl.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/storage/distributor/distributor_bucket_space_repo.h> #include <vespa/storage/distributor/distributor_bucket_space.h> #include <vespa/storage/distributor/operationtargetresolverimpl.h> diff --git a/storage/src/tests/distributor/removebucketoperationtest.cpp b/storage/src/tests/distributor/removebucketoperationtest.cpp index c670e89b065..ed669865313 100644 --- a/storage/src/tests/distributor/removebucketoperationtest.cpp +++ b/storage/src/tests/distributor/removebucketoperationtest.cpp @@ -8,6 +8,7 @@ #include <vespa/storage/distributor/distributor.h> #include <tests/distributor/distributortestutil.h> #include <vespa/document/test/make_document_bucket.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/gtest/gtest.h> #include "dummy_cluster_context.h" diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp index 8970ba09868..eda083dcc22 100644 --- a/storage/src/tests/distributor/statecheckerstest.cpp +++ b/storage/src/tests/distributor/statecheckerstest.cpp @@ -12,6 +12,7 @@ #include <vespa/storage/distributor/statecheckers.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/stat.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/gtest/gtest.h> #include <gmock/gmock.h> diff --git a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp index 47b1c43ca63..57fc54ed299 100644 --- a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp +++ b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp @@ -1,9 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/test/make_document_bucket.h> -#include <vespa/storage/persistence/bucketownershipnotifier.h> #include <tests/common/message_sender_stub.h> #include <tests/common/teststorageapp.h> +#include <vespa/document/test/make_document_bucket.h> +#include <vespa/storage/persistence/bucketownershipnotifier.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> using document::test::makeDocumentBucket; diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp index 0ba378e2ff2..bb4237e20da 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.cpp +++ b/storage/src/tests/persistence/common/filestortestfixture.cpp @@ -8,6 +8,7 @@ #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/test/make_document_bucket.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/persistence/spi/test.h> #include <sstream> diff --git a/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp b/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp index 0fe18335c23..a48d797d626 100644 --- a/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/deactivatebucketstest.cpp @@ -6,6 +6,7 @@ #include <tests/persistence/common/persistenceproviderwrapper.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <tests/persistence/common/filestortestfixture.h> +#include <vespa/vdslib/state/clusterstate.h> using storage::spi::test::makeSpiBucket; using namespace ::testing; diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 8e4671fc78b..290a3574209 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -24,6 +24,8 @@ #include <vespa/storage/storageserver/statemanager.h> #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/vdslib/state/random.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/util/gate.h> #include <vespa/vespalib/util/size_literals.h> diff --git a/storage/src/tests/persistence/persistencethread_splittest.cpp b/storage/src/tests/persistence/persistencethread_splittest.cpp index 7d83bacd44c..9da72440274 100644 --- a/storage/src/tests/persistence/persistencethread_splittest.cpp +++ b/storage/src/tests/persistence/persistencethread_splittest.cpp @@ -6,6 +6,7 @@ #include <vespa/persistence/spi/persistenceprovider.h> #include <tests/persistence/persistencetestutils.h> #include <vespa/document/test/make_document_bucket.h> +#include <vespa/vdslib/state/clusterstate.h> using storage::spi::test::makeSpiBucket; using document::test::makeDocumentBucket; diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index 097ea118f0c..03f2ace84fb 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -13,6 +13,7 @@ #include <vespa/document/fieldset/fieldsets.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/persistence/spi/bucket_limits.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/gtest/gtest.h> diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp index 22441223c5c..a1314479147 100644 --- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp +++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp @@ -1,5 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <tests/common/teststorageapp.h> +#include <tests/common/testhelper.h> +#include <tests/common/dummystoragelink.h> #include <vespa/document/base/testdocman.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/persistence/messages.h> @@ -8,13 +11,13 @@ #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/removelocation.h> #include <vespa/storageapi/message/persistence.h> -#include <tests/common/teststorageapp.h> -#include <tests/common/testhelper.h> -#include <tests/common/dummystoragelink.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/test/make_document_bucket.h> #include <vespa/storage/storageserver/changedbucketownershiphandler.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> + #include <vespa/vespalib/gtest/gtest.h> using document::test::makeDocumentBucket; diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp index d8156b21333..12ed9ead1b6 100644 --- a/storage/src/tests/storageserver/mergethrottlertest.cpp +++ b/storage/src/tests/storageserver/mergethrottlertest.cpp @@ -7,6 +7,7 @@ #include <tests/common/dummystoragelink.h> #include <vespa/document/test/make_document_bucket.h> #include <vespa/storage/storageserver/mergethrottler.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storage/persistence/messages.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp index 1a9882bd0fa..a263f971c8a 100644 --- a/storage/src/tests/storageserver/statemanagertest.cpp +++ b/storage/src/tests/storageserver/statemanagertest.cpp @@ -4,6 +4,7 @@ #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/storageserver/statemanager.h> #include <tests/common/teststorageapp.h> diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index 98b48806b90..c29bb4a4da8 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -18,6 +18,7 @@ #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/documentapi/messagebus/messages/visitor.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/objects/nbostream.h> diff --git a/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.cpp b/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.cpp index cbcaeef8fdf..8db96e19b82 100644 --- a/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.cpp +++ b/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "global_bucket_space_distribution_converter.h" +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/config/config.h> #include <vespa/config/print/asciiconfigwriter.h> #include <vespa/config/print/asciiconfigreader.h> @@ -9,7 +10,6 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <cassert> #include <map> -#include <memory> namespace storage { diff --git a/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.h b/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.h index b2be65dad42..2237aed406c 100644 --- a/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.h +++ b/storage/src/vespa/storage/common/global_bucket_space_distribution_converter.h @@ -2,10 +2,10 @@ #pragma once -#include <vespa/vdslib/distribution/distribution.h> #include <vespa/config-stor-distribution.h> #include <memory> +namespace storage::lib { class Distribution; } namespace storage { struct GlobalBucketSpaceDistributionConverter { diff --git a/storage/src/vespa/storage/common/nodestateupdater.h b/storage/src/vespa/storage/common/nodestateupdater.h index da7cb72e321..17f193decb4 100644 --- a/storage/src/vespa/storage/common/nodestateupdater.h +++ b/storage/src/vespa/storage/common/nodestateupdater.h @@ -25,7 +25,6 @@ #include <string> #include <vespa/vdslib/state/nodestate.h> -#include <vespa/vdslib/state/clusterstate.h> namespace storage { @@ -39,7 +38,7 @@ struct StateListener { struct NodeStateUpdater { typedef std::unique_ptr<NodeStateUpdater> UP; - virtual ~NodeStateUpdater() {} + virtual ~NodeStateUpdater() = default; virtual lib::NodeState::CSP getReportedNodeState() const = 0; virtual lib::NodeState::CSP getCurrentNodeState() const = 0; diff --git a/storage/src/vespa/storage/distributor/bucket_ownership_flags.h b/storage/src/vespa/storage/distributor/bucket_ownership_flags.h index c9003552f12..8745309595e 100644 --- a/storage/src/vespa/storage/distributor/bucket_ownership_flags.h +++ b/storage/src/vespa/storage/distributor/bucket_ownership_flags.h @@ -1,6 +1,8 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <cstdint> + namespace storage::distributor { /* @@ -17,8 +19,7 @@ class BucketOwnershipFlags { public: BucketOwnershipFlags() noexcept : _flags(0) - { - } + { } bool owned_in_current_state() const noexcept { return ((_flags & owned_in_current_state_flag) != 0); } bool owned_in_pending_state() const noexcept { return ((_flags & owned_in_pending_state_flag) != 0); } diff --git a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp index c6def05ef25..3f949011eea 100644 --- a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp +++ b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.cpp @@ -1,5 +1,7 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucket_space_distribution_context.h" +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> namespace storage::distributor { diff --git a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h index 662a1b1daac..5560f6f6ad3 100644 --- a/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h +++ b/storage/src/vespa/storage/distributor/bucket_space_distribution_context.h @@ -1,11 +1,14 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vdslib/state/clusterstate.h> #include <memory> #include <cstdint> +namespace storage::lib { + class Distribution; + class ClusterState; +} +namespace document { class BucketId; } namespace storage::distributor { /** diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index ab2731e0845..17a9b4f5127 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -10,6 +10,8 @@ #include <vespa/document/bucket/fixed_bucket_spaces.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/removelocation.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/util/xmlstream.h> #include <thread> diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index ccfee1e0c36..d70a4fe3409 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -33,7 +33,6 @@ class BucketDBUpdater : public framework::StatusReporter, public api::MessageHandler { public: - using OutdatedNodes = dbtransition::OutdatedNodes; using OutdatedNodesMap = dbtransition::OutdatedNodesMap; BucketDBUpdater(Distributor& owner, DistributorBucketSpaceRepo& bucketSpaceRepo, diff --git a/storage/src/vespa/storage/distributor/bucketownership.h b/storage/src/vespa/storage/distributor/bucketownership.h index c22f690a830..4b1e7b22be1 100644 --- a/storage/src/vespa/storage/distributor/bucketownership.h +++ b/storage/src/vespa/storage/distributor/bucketownership.h @@ -1,9 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vdslib/state/clusterstate.h> #include <cassert> +namespace storage::lib { class ClusterState; } + namespace storage::distributor { class BucketOwnership diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp index e93bb00b564..2b24eb1195a 100644 --- a/storage/src/vespa/storage/distributor/distributor.cpp +++ b/storage/src/vespa/storage/distributor/distributor.cpp @@ -15,6 +15,7 @@ #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h> #include <vespa/storageframework/generic/status/xmlstatusreporter.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/util/memoryusage.h> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/distributor/distributorcomponent.cpp b/storage/src/vespa/storage/distributor/distributorcomponent.cpp index fa5dfa73efc..3f6c125bbfa 100644 --- a/storage/src/vespa/storage/distributor/distributorcomponent.cpp +++ b/storage/src/vespa/storage/distributor/distributorcomponent.cpp @@ -5,7 +5,7 @@ #include "pendingmessagetracker.h" #include <vespa/document/select/parser.h> #include <vespa/vdslib/state/cluster_state_bundle.h> - +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/log/log.h> LOG_SETUP(".distributorstoragelink"); diff --git a/storage/src/vespa/storage/distributor/distributorcomponent.h b/storage/src/vespa/storage/distributor/distributorcomponent.h index fc5f1663cfe..8b0dfecc125 100644 --- a/storage/src/vespa/storage/distributor/distributorcomponent.h +++ b/storage/src/vespa/storage/distributor/distributorcomponent.h @@ -11,8 +11,11 @@ #include <vespa/storage/storageutil/utils.h> #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/buckets/bucketinfo.h> -#include <vespa/vdslib/state/clusterstate.h> +namespace staorage::lib { + class ClusterState; + class ClusterStateBundle; +} namespace storage::distributor { class DistributorBucketSpaceRepo; diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.h b/storage/src/vespa/storage/distributor/externaloperationhandler.h index 1d42f4b3ca8..3f4a6674761 100644 --- a/storage/src/vespa/storage/distributor/externaloperationhandler.h +++ b/storage/src/vespa/storage/distributor/externaloperationhandler.h @@ -3,7 +3,6 @@ #include <vespa/document/bucket/bucketid.h> #include <vespa/document/bucket/bucketidfactory.h> -#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storage/distributor/distributorcomponent.h> #include <vespa/storageapi/messageapi/messagehandler.h> #include <atomic> @@ -11,12 +10,10 @@ #include <mutex> namespace documentapi { class TestAndSetCondition; } +namespace storage::lib { class ClusterState; } +namespace storage { class PersistenceOperationMetricSet; } -namespace storage { - -class PersistenceOperationMetricSet; - -namespace distributor { +namespace storage::distributor { class DistributorMetricSet; class Distributor; @@ -139,6 +136,3 @@ private: }; } - -} - diff --git a/storage/src/vespa/storage/distributor/idealstatemanager.h b/storage/src/vespa/storage/distributor/idealstatemanager.h index b30d7b35a6d..7ed28d845d7 100644 --- a/storage/src/vespa/storage/distributor/idealstatemanager.h +++ b/storage/src/vespa/storage/distributor/idealstatemanager.h @@ -6,7 +6,6 @@ #include <vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h> #include <vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h> #include <vespa/storageframework/generic/status/htmlstatusreporter.h> -#include <vespa/vdslib/state/clusterstate.h> namespace storage::distributor { diff --git a/storage/src/vespa/storage/distributor/operationowner.h b/storage/src/vespa/storage/distributor/operationowner.h index 5cd0fcb644d..56a5f28f2b6 100644 --- a/storage/src/vespa/storage/distributor/operationowner.h +++ b/storage/src/vespa/storage/distributor/operationowner.h @@ -5,7 +5,6 @@ #include "distributormessagesender.h" #include "operationstarter.h" #include <vespa/storage/common/storagelink.h> -#include <vespa/vdslib/state/clusterstate.h> namespace storage::framework { struct Clock; } diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp index 380c4fdf332..cb3c0be6cc5 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp @@ -8,7 +8,9 @@ #include <vespa/storage/distributor/pendingmessagetracker.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/vdslib/distribution/idealnodecalculatorimpl.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storage/distributor/distributor_bucket_space.h> +#include <vespa/vdslib/distribution/distribution.h> #include <algorithm> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp index c0d06171320..ad308ee0c19 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp @@ -6,6 +6,8 @@ #include <vespa/document/fieldvalue/document.h> #include <vespa/document/select/parser.h> #include <vespa/storage/distributor/distributor_bucket_space.h> +#include <vespa/vdslib/state/clusterstate.h> + #include <vespa/log/log.h> LOG_SETUP(".distributor.callback.doc.removelocation"); diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp index 6a7ea8b8f89..722bcc7d27e 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp @@ -2,6 +2,7 @@ #include "removeoperation.h" #include <vespa/storageapi/message/persistence.h> #include <vespa/storage/distributor/distributor_bucket_space.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/log/log.h> LOG_SETUP(".distributor.operation.external.remove"); diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp index f0cd53c15f5..593814cb2f9 100644 --- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.cpp @@ -7,6 +7,7 @@ #include <vespa/storageapi/message/persistence.h> #include <vespa/storage/distributor/distributormetricsset.h> #include <vespa/storage/distributor/distributor_bucket_space.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp index 7a1529606b0..dfbff93757a 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp @@ -3,6 +3,8 @@ #include <vespa/storage/distributor/idealstatemanager.h> #include <vespa/storage/distributor/distributor_bucket_space.h> #include <vespa/storage/distributor/pendingmessagetracker.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <array> #include <vespa/log/bufferedlogger.h> @@ -10,7 +12,7 @@ LOG_SETUP(".distributor.operation.idealstate.merge"); namespace storage::distributor { -MergeOperation::~MergeOperation() {} +MergeOperation::~MergeOperation() = default; std::string MergeOperation::getStatus() const 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 7eb2e2bf236..af6223afe28 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 @@ -4,6 +4,8 @@ #include "clusterinformation.h" #include "pendingclusterstate.h" #include "distributor_bucket_space.h" +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <algorithm> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index d009375a641..c694fda2c1b 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -8,6 +8,7 @@ #include <vespa/storageframework/defaultimplementation/clock/realclock.h> #include <vespa/storage/common/global_bucket_space_distribution_converter.h> #include <vespa/document/bucket/fixed_bucket_spaces.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/util/xmlstream.hpp> #include <climits> @@ -358,4 +359,13 @@ PendingClusterState::getPendingBucketSpaceDbTransition(document::BucketSpace buc return *transitionIter->second; } +std::string +PendingClusterState::getNewClusterStateBundleString() const { + return _newClusterStateBundle.getBaselineClusterState()->toString(); +} +std::string +PendingClusterState::getPrevClusterStateBundleString() const { + return _prevClusterStateBundle.getBaselineClusterState()->toString(); +} + } diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.h b/storage/src/vespa/storage/distributor/pendingclusterstate.h index c355af3e00f..6d558d05640 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.h +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.h @@ -7,7 +7,6 @@ #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/storageframework/generic/clock/clock.h> -#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/cluster_state_bundle.h> #include <vespa/vespalib/util/xmlserializable.h> #include "outdated_nodes_map.h" @@ -209,12 +208,8 @@ private: bool iAmDown() const; bool storageNodeUpInNewState(document::BucketSpace bucketSpace, uint16_t node) const; - std::string getNewClusterStateBundleString() const { - return _newClusterStateBundle.getBaselineClusterState()->toString(); - } - std::string getPrevClusterStateBundleString() const { - return _prevClusterStateBundle.getBaselineClusterState()->toString(); - } + std::string getNewClusterStateBundleString() const; + std::string getPrevClusterStateBundleString() const; void update_reply_failure_statistics(const api::ReturnCode& result, const BucketSpaceAndNode& source); std::shared_ptr<api::SetSystemStateCommand> _cmd; diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp index 10e69bcfd14..173e29566ac 100644 --- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp @@ -1,13 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "persistencemessagetracker.h" -#include <vespa/storage/common/vectorprinter.h> -#include <vespa/storageapi/message/persistence.h> #include "distributor_bucket_space_repo.h" #include "distributor_bucket_space.h" +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/storage/common/vectorprinter.h> +#include <vespa/storageapi/message/persistence.h> #include <vespa/log/log.h> - LOG_SETUP(".persistencemessagetracker"); namespace storage::distributor { diff --git a/storage/src/vespa/storage/distributor/simpleclusterinformation.h b/storage/src/vespa/storage/distributor/simpleclusterinformation.h index 1247d425e50..554ef0dbb5c 100644 --- a/storage/src/vespa/storage/distributor/simpleclusterinformation.h +++ b/storage/src/vespa/storage/distributor/simpleclusterinformation.h @@ -2,8 +2,7 @@ #pragma once #include "clusterinformation.h" -#include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/vdslib/state/cluster_state_bundle.h> namespace storage::distributor { diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index 2740d275732..22605d56a74 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -2,6 +2,8 @@ #include "statechecker.h" #include "distributorcomponent.h" #include "distributor_bucket_space.h" +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/log/log.h> LOG_SETUP(".distributor.statechecker"); diff --git a/storage/src/vespa/storage/distributor/statechecker.h b/storage/src/vespa/storage/distributor/statechecker.h index 5b9ce065f99..734b44bd7d1 100644 --- a/storage/src/vespa/storage/distributor/statechecker.h +++ b/storage/src/vespa/storage/distributor/statechecker.h @@ -6,17 +6,16 @@ #include <vespa/storage/distributor/operations/idealstate/idealstateoperation.h> #include <vespa/storage/common/storagecomponent.h> #include <vespa/storage/bucketdb/bucketdatabase.h> -#include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vdslib/state/clusterstate.h> #include <unordered_set> #include <map> #include <set> -namespace storage { - -class DistributorConfiguration; +namespace storage::lib { + class ClusterState; +} +namespace storage { class DistributorConfiguration; } -namespace distributor { +namespace storage::distributor { class DistributorComponent; class DistributorBucketSpace; @@ -165,6 +164,3 @@ public: }; } - -} - diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp index bdd850e1e23..ed3e47fcafb 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.cpp +++ b/storage/src/vespa/storage/distributor/statecheckers.cpp @@ -9,6 +9,8 @@ #include <vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h> #include <vespa/storage/distributor/operations/idealstate/mergeoperation.h> #include <vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp index efd558a0b4b..629ebb68c43 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp @@ -2,11 +2,13 @@ #include "distributorcomponentregisterimpl.h" #include <vespa/vespalib/util/exceptions.h> #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> namespace storage { DistributorComponentRegisterImpl::DistributorComponentRegisterImpl() - : _timeCalculator(0) + : _timeCalculator(0), + _clusterState(std::make_shared<lib::ClusterState>()) { } @@ -16,7 +18,7 @@ void DistributorComponentRegisterImpl::handleNewState() { auto clusterStateBundle = getNodeStateUpdater().getClusterStateBundle(); - _clusterState = *clusterStateBundle->getBaselineClusterState(); + _clusterState = std::make_shared<lib::ClusterState>(*clusterStateBundle->getBaselineClusterState()); } void @@ -72,7 +74,7 @@ DistributorComponentRegisterImpl::setNodeStateUpdater(NodeStateUpdater& updater) StorageComponentRegisterImpl::setNodeStateUpdater(updater); auto clusterStateBundle = updater.getClusterStateBundle(); if (clusterStateBundle) { - _clusterState = *clusterStateBundle->getBaselineClusterState(); + _clusterState = std::make_shared<lib::ClusterState>(*clusterStateBundle->getBaselineClusterState()); } updater.addStateListener(*this); } diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h index a6c678630e0..8a2e4eef491 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h @@ -11,11 +11,13 @@ #include <vespa/storage/common/distributorcomponent.h> #include <vespa/storage/common/nodestateupdater.h> -namespace storage { -namespace lib { +namespace storage::lib { class IdealNodeCalculatorConfigurable; + class ClusterState; } +namespace storage { + class DistributorComponentRegisterImpl : public virtual DistributorComponentRegister, public virtual StorageComponentRegisterImpl, @@ -27,7 +29,7 @@ class DistributorComponentRegisterImpl UniqueTimeCalculator* _timeCalculator; DistributorConfig _distributorConfig; VisitorConfig _visitorConfig; - lib::ClusterState _clusterState; + std::shared_ptr<lib::ClusterState> _clusterState; public: typedef std::unique_ptr<DistributorComponentRegisterImpl> UP; @@ -44,4 +46,4 @@ private: void setNodeStateUpdater(NodeStateUpdater& updater) override; }; -} // storage +} diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp index e2a06ee640b..d2b6578c66b 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp @@ -23,7 +23,7 @@ ServiceLayerComponentRegisterImpl::registerServiceLayerComponent(ServiceLayerMan } void -ServiceLayerComponentRegisterImpl::setDistribution(lib::Distribution::SP distribution) +ServiceLayerComponentRegisterImpl::setDistribution(std::shared_ptr<lib::Distribution> distribution) { _bucketSpaceRepo.get(document::FixedBucketSpaces::default_space()).setDistribution(distribution); auto global_distr = GlobalBucketSpaceDistributionConverter::convert_to_global(*distribution); diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h index a77b8061842..6bed5e82fd3 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h @@ -34,7 +34,7 @@ public: } void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; - void setDistribution(lib::Distribution::SP distribution) override; + void setDistribution(std::shared_ptr<lib::Distribution> distribution) override; }; } // storage diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp index 3ce02a73324..72dfd30fee3 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp @@ -91,7 +91,7 @@ StorageComponentRegisterImpl::setBucketIdFactory(const document::BucketIdFactory } void -StorageComponentRegisterImpl::setDistribution(lib::Distribution::SP distribution) +StorageComponentRegisterImpl::setDistribution(std::shared_ptr<lib::Distribution> distribution) { std::lock_guard lock(_componentLock); _distribution = distribution; diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index 85edfe78c28..70ee110ed87 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -11,8 +11,8 @@ #include <vespa/storage/common/storagecomponent.h> #include <vespa/config-bucketspaces.h> #include <vespa/storageframework/defaultimplementation/component/componentregisterimpl.h> -#include <vespa/vdslib/distribution/distribution.h> +namespace storage::lib { class Distribution; } namespace storage { class StorageComponentRegisterImpl @@ -28,7 +28,7 @@ class StorageComponentRegisterImpl uint16_t _index; std::shared_ptr<const document::DocumentTypeRepo> _docTypeRepo; document::BucketIdFactory _bucketIdFactory; - lib::Distribution::SP _distribution; + std::shared_ptr<lib::Distribution> _distribution; NodeStateUpdater* _nodeStateUpdater; BucketspacesConfig _bucketSpacesConfig; @@ -42,7 +42,7 @@ public: uint16_t getIndex() const { return _index; } std::shared_ptr<const document::DocumentTypeRepo> getTypeRepo() { return _docTypeRepo; } const document::BucketIdFactory& getBucketIdFactory() { return _bucketIdFactory; } - lib::Distribution::SP getDistribution() { return _distribution; } + std::shared_ptr<lib::Distribution> & getDistribution() { return _distribution; } NodeStateUpdater& getNodeStateUpdater() { return *_nodeStateUpdater; } void registerStorageComponent(StorageComponent&) override; @@ -51,7 +51,7 @@ public: virtual void setNodeStateUpdater(NodeStateUpdater& updater); virtual void setDocumentTypeRepo(std::shared_ptr<const document::DocumentTypeRepo>); virtual void setBucketIdFactory(const document::BucketIdFactory&); - virtual void setDistribution(lib::Distribution::SP); + virtual void setDistribution(std::shared_ptr<lib::Distribution>); virtual void setBucketSpacesConfig(const BucketspacesConfig&); }; diff --git a/storage/src/vespa/storage/persistence/bucketownershipnotifier.h b/storage/src/vespa/storage/persistence/bucketownershipnotifier.h index 948fc54726f..f3e3f60b633 100644 --- a/storage/src/vespa/storage/persistence/bucketownershipnotifier.h +++ b/storage/src/vespa/storage/persistence/bucketownershipnotifier.h @@ -3,7 +3,6 @@ #include <vector> #include <vespa/document/bucket/bucket.h> -#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storageapi/buckets/bucketinfo.h> #include <vespa/storage/common/messagesender.h> #include <vespa/storage/common/servicelayercomponent.h> diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index eee509e79f8..f4a94af0d35 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -7,6 +7,7 @@ #include <vespa/storage/common/content_bucket_space_repo.h> #include <vespa/storage/common/doneinitializehandler.h> #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/storage/common/hostreporter/hostinfo.h> #include <vespa/storage/common/messagebucket.h> #include <vespa/storage/config/config-stor-server.h> diff --git a/storage/src/vespa/storage/storageserver/bouncer.cpp b/storage/src/vespa/storage/storageserver/bouncer.cpp index 9ef8a02b74e..de9033b8d0e 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.cpp +++ b/storage/src/vespa/storage/storageserver/bouncer.cpp @@ -4,6 +4,7 @@ #include "bouncer_metrics.h" #include "config_logging.h" #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/persistence/spi/bucket_limits.h> #include <vespa/storageapi/message/state.h> #include <vespa/storageapi/message/persistence.h> diff --git a/storage/src/vespa/storage/storageserver/bouncer.h b/storage/src/vespa/storage/storageserver/bouncer.h index 7e1d6eaa4ba..9f9d82217df 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.h +++ b/storage/src/vespa/storage/storageserver/bouncer.h @@ -12,7 +12,7 @@ #pragma once #include <vespa/config/helper/configfetcher.h> -#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/vdslib/state/nodestate.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/common/storagecomponent.h> #include <vespa/storage/common/storagelink.h> diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp index a736ea58406..6b121dd9a9e 100644 --- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp +++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp @@ -5,6 +5,7 @@ #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/vdslib/state/clusterstate.h> #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/storage/common/messagebucket.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/common/content_bucket_space_repo.h> diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h index b2661ce0d8d..3455108119e 100644 --- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h +++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h @@ -3,7 +3,6 @@ #include <vespa/document/bucket/bucketid.h> #include <vespa/storage/common/storagelink.h> -#include <vespa/vdslib/distribution/distribution.h> #include <vespa/config/config.h> #include <vespa/config-persistence.h> #include <vespa/storage/common/servicelayercomponent.h> @@ -18,8 +17,9 @@ namespace storage { namespace lib { -class ClusterState; -class ClusterStateBundle; + class ClusterState; + class ClusterStateBundle; + class Distribution; } /** diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index 2984ba27344..dc8457769a2 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -3,6 +3,7 @@ #include "mergethrottler.h" #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/persistence/messages.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/messagebus/message.h> #include <vespa/messagebus/error.h> #include <vespa/config/common/exceptions.h> diff --git a/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp b/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp index 4c7cf05241a..60a0fdac341 100644 --- a/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp +++ b/storage/src/vespa/storage/storageserver/rpc/cluster_controller_api_rpc_service.cpp @@ -5,6 +5,7 @@ #include <vespa/storage/storageserver/communicationmanager.h> #include <vespa/storage/storageserver/message_dispatcher.h> #include <vespa/storage/storageserver/rpcrequestwrapper.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/fnet/frt/supervisor.h> #include <vespa/fnet/frt/rpcrequest.h> #include <vespa/storageapi/message/state.h> diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index f2b23724c98..68ba9199f7b 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -8,6 +8,7 @@ #include <vespa/metrics/metricmanager.h> #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/vdslib/state/cluster_state_bundle.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/exceptions.h> diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index 79205b8b513..bf517bd6869 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -14,6 +14,7 @@ #include <vespa/storage/common/storage_chain_builder.h> #include <vespa/storage/frameworkimpl/status/statuswebserver.h> #include <vespa/storage/frameworkimpl/thread/deadlockdetector.h> +#include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/time.h> @@ -107,7 +108,7 @@ StorageNode::StorageNode( void StorageNode::subscribeToConfigs() { - _configFetcher.reset(new config::ConfigFetcher(_configUri.getContext())); + _configFetcher = std::make_unique<config::ConfigFetcher>(_configUri.getContext()); _configFetcher->subscribe<StorDistributionConfig>(_configUri.getConfigId(), this); _configFetcher->subscribe<UpgradingConfig>(_configUri.getConfigId(), this); _configFetcher->subscribe<StorServerConfig>(_configUri.getConfigId(), this); @@ -181,7 +182,7 @@ StorageNode::initialize() _generationFetcher); // Start deadlock detector - _deadLockDetector.reset(new DeadLockDetector(_context.getComponentRegister())); + _deadLockDetector = std::make_unique<DeadLockDetector>(_context.getComponentRegister()); _deadLockDetector->enableWarning(_serverConfig->enableDeadLockDetectorWarnings); _deadLockDetector->enableShutdown(_serverConfig->enableDeadLockDetector); _deadLockDetector->setProcessSlack(vespalib::from_s(_serverConfig->deadLockDetectorTimeoutSlack)); diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index 652a58296f2..c1f9cf9efdc 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -10,6 +10,7 @@ #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> #include <vespa/storageapi/message/visitor.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/document/base/testdocman.h> #include <vespa/document/document.h> #include <vespa/document/update/fieldpathupdates.h> diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp index 45d9d2bd711..61a35a98f1b 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp @@ -6,6 +6,7 @@ #include "storagereply.h" #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/visitor.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/bucket/fixed_bucket_spaces.h> #include <sstream> diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization7.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization7.cpp index 98f76b4afb7..64c70dbb676 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization7.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization7.cpp @@ -11,6 +11,7 @@ #include <vespa/storageapi/message/removelocation.h> #include <vespa/storageapi/message/visitor.h> #include <vespa/storageapi/message/stat.h> +#include <vespa/vdslib/state/clusterstate.h> namespace storage::mbusprot { diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp index 1262c5db632..fdc19d63134 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.cpp +++ b/storageapi/src/vespa/storageapi/message/bucket.cpp @@ -2,6 +2,7 @@ #include "bucket.h" #include <vespa/document/fieldvalue/document.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/array.hpp> diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index 072d02c7d32..cde440b91de 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -13,12 +13,14 @@ #include <vespa/storageapi/messageapi/bucketinforeply.h> #include <vespa/storageapi/messageapi/maintenancecommand.h> #include <vespa/document/base/globalid.h> -#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/document/util/printable.h> #include <vespa/vespalib/util/array.h> #include <vespa/storageapi/defs.h> namespace document { class DocumentTypeRepo; } +namespace storage::lib { class ClusterState; } + namespace storage::api { /** diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index a1c5e541f3b..7210ebd960d 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -7,6 +7,7 @@ #include <vespa/fastos/file.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/distribution/idealnodecalculator.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vdslib/state/random.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/gtest/gtest.h> @@ -39,14 +40,13 @@ TEST(DistributionTest, test_verify_java_distributions) tests.push_back("retired"); for (uint32_t i=0; i<tests.size(); ++i) { std::string test = tests[i]; - ClusterState state; + std::string mystate; { std::ifstream in("distribution/testdata/java_" + test + ".state"); - std::string mystate; in >> mystate; in.close(); - state = ClusterState(mystate); } + ClusterState state(mystate); Distribution distr(readConfig<vespa::config::content::StorDistributionConfig>( "file:distribution/testdata/java_" + test + ".cfg")); std::ofstream of("distribution/testdata/cpp_" + test + ".distribution"); @@ -499,21 +499,21 @@ TEST(DistributionTest, test_move) TEST(DistributionTest, test_move_constraints) { - ClusterState systemState("storage:10"); + ClusterState clusterState("storage:10"); Distribution distr(Distribution::getDefaultDistributionConfig(3, 12)); std::vector<std::vector<uint16_t> > initBuckets(10000); for (unsigned i = 0; i < initBuckets.size(); i++) { initBuckets[i] = distr.getIdealStorageNodes( - systemState, document::BucketId(16, i)); + clusterState, document::BucketId(16, i)); sort(initBuckets[i].begin(), initBuckets[i].end()); } { // Check that adding a down node has no effect std::vector<std::vector<uint16_t> > addedDownBuckets(10000); - systemState = ClusterState("storage:11 .10.s:d"); + ClusterState systemState("storage:11 .10.s:d"); for (unsigned i = 0; i < addedDownBuckets.size(); i++) { addedDownBuckets[i] = distr.getIdealStorageNodes( @@ -537,7 +537,7 @@ TEST(DistributionTest, test_move_constraints) // Check that if we disable one node, we're not moving stuff away from // any other node std::vector<std::vector<uint16_t> > removed0Buckets(10000); - systemState = ClusterState("storage:10 .0.s:d"); + ClusterState systemState("storage:10 .0.s:d"); for (unsigned i = 0; i < removed0Buckets.size(); i++) { removed0Buckets[i] = distr.getIdealStorageNodes( @@ -568,7 +568,7 @@ TEST(DistributionTest, test_move_constraints) // Check that if we're adding one node, we're not moving stuff to any // other node std::vector<std::vector<uint16_t> > added10Buckets(10000); - systemState = ClusterState("storage:11"); + ClusterState systemState("storage:11"); for (unsigned i = 0; i < added10Buckets.size(); i++) { added10Buckets[i] = distr.getIdealStorageNodes( @@ -823,10 +823,9 @@ TEST(DistributionTest, test_hierarchical_no_redistribution) EXPECT_EQ(0, v.size()); v.clear(); - state = ClusterState( - "distributor:5 .0.s:d storage:5 .0.s:d .1.s:d .1.m:foo\\x20bar"); + ClusterState state2("distributor:5 .0.s:d storage:5 .0.s:d .1.s:d .1.m:foo\\x20bar"); std::ostringstream ost; - state.printStateGroupwise(ost, distribution, true, ""); + state2.printStateGroupwise(ost, distribution, true, ""); EXPECT_EQ(std::string("\n" "ClusterState(Version: 0, Cluster state: Up, Distribution bits: 16) {\n" " Top group. 2 branches with distribution *|* {\n" diff --git a/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp b/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp index f54c94ae8f9..5bca51f8111 100644 --- a/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp +++ b/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp @@ -2,6 +2,8 @@ #include <vespa/config-stor-distribution.h> #include <vespa/vdslib/distribution/idealnodecalculatorimpl.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> namespace storage::lib { diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp index e622d0fd0d9..d51e9ee4f49 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp +++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "distribution.h" -#include <vespa/vdslib/distribution/distribution_config_util.h> +#include "distribution_config_util.h" #include <vespa/vdslib/state/clusterstate.h> #include <vespa/vdslib/state/random.h> #include <vespa/vespalib/util/bobhash.h> @@ -106,18 +106,8 @@ Distribution::Distribution(const vespalib::string& serialized) configure(*reader.read()); } -Distribution& -Distribution::operator=(const Distribution& d) -{ - vespalib::asciistream ist(d.serialize()); - config::AsciiConfigReader<vespa::config::content::StorDistributionConfig> reader(ist); - configure(*reader.read()); - return *this; -} - Distribution::~Distribution() = default; - void Distribution::configure(const vespa::config::content::StorDistributionConfig& config) { diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.h b/vdslib/src/vespa/vdslib/distribution/distribution.h index 407740e2bc7..aef48b0c09c 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.h +++ b/vdslib/src/vespa/vdslib/distribution/distribution.h @@ -112,7 +112,7 @@ public: Distribution(const vespalib::string& serialized); ~Distribution(); - Distribution& operator=(const Distribution&); + Distribution& operator=(const Distribution&) = delete; const vespalib::string& serialize() const { return _serialized; } diff --git a/vdslib/src/vespa/vdslib/distribution/group.h b/vdslib/src/vespa/vdslib/distribution/group.h index d6af005130d..3ce7f9c7a7a 100644 --- a/vdslib/src/vespa/vdslib/distribution/group.h +++ b/vdslib/src/vespa/vdslib/distribution/group.h @@ -21,14 +21,11 @@ namespace vespalib { class asciistream; } namespace storage::lib { -class IdealGroup; -class SystemState; - class Group : public document::Printable { public: - typedef std::unique_ptr<Group> UP; - typedef RedundancyGroupDistribution Distribution; + using UP = std::unique_ptr<Group>; + using Distribution = RedundancyGroupDistribution ; private: vespalib::string _name; diff --git a/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h b/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h index d1be4a2229c..ecb7beed140 100644 --- a/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h +++ b/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h @@ -7,12 +7,15 @@ #pragma once #include <vespa/document/bucket/bucketid.h> -#include <vespa/vdslib/state/clusterstate.h> -#include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vdslib/state/nodetype.h> +#include <vespa/document/util/printable.h> +#include <vespa/vdslib/state/node.h> +#include <vector> namespace storage::lib { +class Distribution; +class ClusterState; + /** * A list of ideal nodes, sorted in preferred order. Wraps a vector to hide * unneeded details, and make it easily printable. diff --git a/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp b/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp index 8379018d4d7..c9732f1af8b 100644 --- a/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp +++ b/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "idealnodecalculatorimpl.h" +#include "distribution.h" #include <vespa/vespalib/util/exceptions.h> #include <ostream> #include <cassert> diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.cpp b/vdslib/src/vespa/vdslib/state/clusterstate.cpp index 983018c2a21..cc863fd6f48 100644 --- a/vdslib/src/vespa/vdslib/state/clusterstate.cpp +++ b/vdslib/src/vespa/vdslib/state/clusterstate.cpp @@ -13,8 +13,7 @@ LOG_SETUP(".vdslib.state.cluster"); using vespalib::IllegalArgumentException; -namespace storage { -namespace lib { +namespace storage::lib { ClusterState::ClusterState() : Printable(), @@ -27,7 +26,7 @@ ClusterState::ClusterState() { } ClusterState::ClusterState(const ClusterState& other) = default; -ClusterState::~ClusterState() { } +ClusterState::~ClusterState() = default; struct NodeData { bool empty; @@ -244,20 +243,6 @@ ClusterState::serialize(vespalib::asciistream & out, bool ignoreNewFeatures) con } } -ClusterState& -ClusterState::operator=(const ClusterState& other) -{ - if (this != &other) { - _version = other._version; - _clusterState = other._clusterState; - _nodeStates = other._nodeStates; - _nodeCount = other._nodeCount; - _description = other._description; - _distributionBits = other._distributionBits; - } - return *this; -} - bool ClusterState::operator==(const ClusterState& other) const { @@ -515,5 +500,4 @@ ClusterState::printStateGroupwise(std::ostream& out, const Group& group, out << "\n" << indent << "}"; } -} // lib -} // storage +} diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.h b/vdslib/src/vespa/vdslib/state/clusterstate.h index 723703a1aa5..6f196f04626 100644 --- a/vdslib/src/vespa/vdslib/state/clusterstate.h +++ b/vdslib/src/vespa/vdslib/state/clusterstate.h @@ -39,12 +39,12 @@ public: // FIXME make ClusterState parsing not require null termination of string, // then move to vespalib::stringref explicit ClusterState(const vespalib::string& serialized); + ClusterState& operator=(const ClusterState& other) = delete; ~ClusterState(); std::string getTextualDifference(const ClusterState& other) const; void serialize(vespalib::asciistream & out, bool ignoreNewFeatures) const; - ClusterState& operator=(const ClusterState& other); bool operator==(const ClusterState& other) const; bool operator!=(const ClusterState& other) const; |