From c0518dde43775f24955612ab46398a1c21f3ff50 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 2 May 2017 14:42:00 +0200 Subject: Fix warnings hidden earlier due to including application headers as system includes --- storage/src/tests/common/CMakeLists.txt | 1 + storage/src/tests/common/storagelinktest.h | 14 +--- storage/src/tests/common/testnodestateupdater.h | 32 +++----- storage/src/tests/common/teststorageapp.cpp | 13 +-- storage/src/tests/common/teststorageapp.h | 26 +++--- .../src/tests/distributor/bucketdatabasetest.cpp | 2 +- storage/src/tests/distributor/bucketdatabasetest.h | 7 +- .../src/tests/distributor/distributortestutil.cpp | 14 +--- .../src/tests/distributor/distributortestutil.h | 18 ++--- storage/src/tests/distributor/maintenancemocks.h | 30 +++---- .../src/tests/distributor/messagesenderstub.cpp | 18 +++-- storage/src/tests/distributor/messagesenderstub.h | 16 ++-- .../tests/persistence/common/filestortestfixture.h | 2 +- .../common/persistenceproviderwrapper.cpp | 16 +++- .../common/persistenceproviderwrapper.h | 94 +++++++--------------- .../filestorage/forwardingmessagesender.h | 8 +- .../src/tests/persistence/persistencetestutils.h | 20 ++--- .../storageserver/testvisitormessagesession.h | 24 ++---- .../src/vespa/storage/bucketdb/bucketmanager.cpp | 11 +-- storage/src/vespa/storage/bucketdb/bucketmanager.h | 15 ++-- storage/src/vespa/storage/bucketdb/lockablemap.h | 1 + storage/src/vespa/storage/bucketdb/lockablemap.hpp | 6 +- .../vespa/storage/bucketdb/mapbucketdatabase.cpp | 15 ++-- .../src/vespa/storage/bucketdb/mapbucketdatabase.h | 86 ++++++-------------- .../vespa/storage/common/distributorcomponent.h | 24 +++--- .../src/vespa/storage/common/storagecomponent.h | 3 +- storage/src/vespa/storage/common/storagelink.h | 3 +- .../distributor/blockingoperationstarter.cpp | 10 +-- .../storage/distributor/blockingoperationstarter.h | 16 ++-- .../vespa/storage/distributor/bucketdbupdater.cpp | 29 +++---- .../storage/distributor/distributormessagesender.h | 3 +- .../maintenance/simplebucketprioritydatabase.h | 24 +++--- .../maintenance/simplemaintenancescanner.cpp | 20 ++--- .../maintenance/simplemaintenancescanner.h | 32 ++++---- .../vespa/storage/distributor/messagetracker.cpp | 9 ++- .../src/vespa/storage/distributor/messagetracker.h | 14 ++-- .../vespa/storage/distributor/operationowner.cpp | 16 ++-- .../src/vespa/storage/distributor/operationowner.h | 41 +++------- .../external/multioperationoperation.cpp | 24 +++--- .../operations/external/multioperationoperation.h | 32 +++----- .../external/removelocationoperation.cpp | 14 ++-- .../operations/external/removelocationoperation.h | 21 ++--- .../operations/external/removeoperation.cpp | 14 ++-- .../operations/external/removeoperation.h | 19 ++--- .../operations/external/statbucketoperation.cpp | 11 ++- .../operations/external/statbucketoperation.h | 20 ++--- .../operations/external/visitoroperation.cpp | 22 +++-- .../operations/external/visitoroperation.h | 29 +++---- .../idealstate/garbagecollectionoperation.cpp | 16 ++-- .../idealstate/garbagecollectionoperation.h | 34 +++----- .../operations/idealstate/idealstateoperation.h | 26 ++---- .../operations/idealstate/mergeoperation.cpp | 30 ++----- .../operations/idealstate/mergeoperation.h | 38 ++++----- .../idealstate/removebucketoperation.cpp | 8 +- .../operations/idealstate/removebucketoperation.h | 32 +++----- .../idealstate/setbucketstateoperation.cpp | 22 ++--- .../idealstate/setbucketstateoperation.h | 33 +++----- .../operations/idealstate/splitoperation.cpp | 20 +++-- .../operations/idealstate/splitoperation.h | 37 ++------- .../vespa/storage/distributor/operationstarter.h | 13 +-- .../storage/distributor/pendingclusterstate.cpp | 40 +++++---- .../storage/distributor/pendingclusterstate.h | 86 +++++++------------- .../storage/distributor/pendingmessagetracker.cpp | 6 +- .../storage/distributor/pendingmessagetracker.h | 25 ++---- .../distributor/persistencemessagetracker.cpp | 17 ++-- .../distributor/persistencemessagetracker.h | 64 +++++---------- .../storage/distributor/simpleclusterinformation.h | 15 ++-- .../src/vespa/storage/distributor/statechecker.cpp | 17 ++-- .../src/vespa/storage/distributor/statechecker.h | 16 ++-- .../distributor/throttlingoperationstarter.cpp | 7 +- .../distributor/throttlingoperationstarter.h | 36 +++------ .../persistence/filestorage/mergestatus.cpp | 5 +- .../storage/persistence/filestorage/mergestatus.h | 1 + storage/src/vespa/storage/persistence/messages.h | 7 +- .../storage/storageserver/communicationmanager.cpp | 1 + .../storage/storageserver/communicationmanager.h | 8 +- .../storage/storageserver/documentapiconverter.h | 8 +- .../vespa/storage/storageserver/fnetlistener.cpp | 6 +- .../vespa/storage/storageserver/mergethrottler.h | 4 +- .../vespa/storage/storageserver/messagesink.cpp | 7 +- .../src/vespa/storage/storageserver/messagesink.h | 11 +-- .../src/vespa/storage/storageserver/opslogger.h | 3 +- .../storage/storageserver/priorityconverter.h | 2 +- .../src/vespa/storage/storageserver/statemanager.h | 1 + storage/src/vespa/storage/storageutil/graph.cpp | 19 +++-- storage/src/vespa/storage/storageutil/graph.h | 7 +- storage/src/vespa/storage/storageutil/piechart.cpp | 9 +-- storage/src/vespa/storage/storageutil/piechart.h | 1 + .../visiting/messagebusvisitormessagesession.h | 16 ++-- 89 files changed, 644 insertions(+), 1049 deletions(-) diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt index 13ac34c2726..be12ba3aceb 100644 --- a/storage/src/tests/common/CMakeLists.txt +++ b/storage/src/tests/common/CMakeLists.txt @@ -5,6 +5,7 @@ vespa_add_library(storage_testcommon TEST testhelper.cpp metricstest.cpp storagelinktest.cpp + testnodestateupdater.cpp teststorageapp.cpp DEPENDS storage diff --git a/storage/src/tests/common/storagelinktest.h b/storage/src/tests/common/storagelinktest.h index 22c85763009..089ba885ef7 100644 --- a/storage/src/tests/common/storagelinktest.h +++ b/storage/src/tests/common/storagelinktest.h @@ -15,23 +15,18 @@ struct StorageLinkTest : public CppUnit::TestFixture { StorageLinkTest(); - void setUp(); + void setUp() override; void testPrinting(); void testNotImplemented(); - static bool callOnUp(StorageLink& link, - const api::StorageMessage::SP& msg) - { + static bool callOnUp(StorageLink& link, const api::StorageMessage::SP& msg) { return link.onUp(msg); } - static bool callOnDown(StorageLink& link, - const api::StorageMessage::SP& msg) - { + static bool callOnDown(StorageLink& link, const api::StorageMessage::SP& msg) { return link.onDown(msg); } - static void callOnFlush(StorageLink& link, bool downwards) - { + static void callOnFlush(StorageLink& link, bool downwards) { link.onFlush(downwards); } @@ -42,4 +37,3 @@ struct StorageLinkTest : public CppUnit::TestFixture { }; } - diff --git a/storage/src/tests/common/testnodestateupdater.h b/storage/src/tests/common/testnodestateupdater.h index 9f5b2d8ba51..9385a93f1c4 100644 --- a/storage/src/tests/common/testnodestateupdater.h +++ b/storage/src/tests/common/testnodestateupdater.h @@ -20,25 +20,20 @@ struct TestNodeStateUpdater : public NodeStateUpdater std::vector _listeners; public: - TestNodeStateUpdater(const lib::NodeType& type) { - _reported.reset(new lib::NodeState(type, lib::State::UP)); - _current.reset(new lib::NodeState(type, lib::State::UP)); - } + TestNodeStateUpdater(const lib::NodeType& type); + ~TestNodeStateUpdater(); - lib::NodeState::CSP getReportedNodeState() const { return _reported; } - lib::NodeState::CSP getCurrentNodeState() const { return _current; } - lib::ClusterState::CSP getSystemState() const { return _cluster; } - void addStateListener(StateListener& s) { - _listeners.push_back(&s); - } - void removeStateListener(StateListener&) {} - Lock::SP grabStateChangeLock() { return Lock::SP(new Lock); } - void setReportedNodeState(const lib::NodeState& state) - { _reported.reset(new lib::NodeState(state)); } - void setCurrentNodeState(const lib::NodeState& state) - { _current.reset(new lib::NodeState(state)); } - - void setClusterState(lib::ClusterState::CSP c) { + lib::NodeState::CSP getReportedNodeState() const override { return _reported; } + lib::NodeState::CSP getCurrentNodeState() const override { return _current; } + lib::ClusterState::CSP getSystemState() const override { return _cluster; } + void addStateListener(StateListener& s) override { _listeners.push_back(&s); } + void removeStateListener(StateListener&) override {} + Lock::SP grabStateChangeLock() override { return Lock::SP(new Lock); } + void setReportedNodeState(const lib::NodeState& state) override { _reported.reset(new lib::NodeState(state)); } + + void setCurrentNodeState(const lib::NodeState& state) { _current.reset(new lib::NodeState(state)); } + + void setClusterState(lib::ClusterState::CSP c) { _cluster = c; for (uint32_t i = 0; i < _listeners.size(); ++i) { _listeners[i]->handleNewState(); @@ -47,4 +42,3 @@ public: }; } // storage - diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index de4d52d8f45..92516f15ee1 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "teststorageapp.h" #include #include #include #include -#include -#include #include +#include #include #include #include @@ -38,8 +36,7 @@ TestStorageApp::TestStorageApp(StorageComponentRegisterImpl::UP compReg, const lib::NodeType& type, NodeIndex index, vespalib::stringref configId) : TestComponentRegister(ComponentRegisterImpl::UP(std::move(compReg))), - _compReg(dynamic_cast( - TestComponentRegister::getComponentRegister())), + _compReg(dynamic_cast(TestComponentRegister::getComponentRegister())), _docMan(), _nodeStateUpdater(type), _configId(configId), @@ -81,6 +78,8 @@ TestStorageApp::TestStorageApp(StorageComponentRegisterImpl::UP compReg, _compReg.setDistribution(distr); } +TestStorageApp::~TestStorageApp() {} + void TestStorageApp::setDistribution(Redundancy redundancy, NodeCount nodeCount) { @@ -176,6 +175,8 @@ TestServiceLayerApp::TestServiceLayerApp(DiskCount dc, NodeIndex index, CPPUNIT_ASSERT(dc > 0); } +TestServiceLayerApp::~TestServiceLayerApp() {} + void TestServiceLayerApp::setupDummyPersistence() { diff --git a/storage/src/tests/common/teststorageapp.h b/storage/src/tests/common/teststorageapp.h index e535fbfbc6e..3b64fb6e6fa 100644 --- a/storage/src/tests/common/teststorageapp.h +++ b/storage/src/tests/common/teststorageapp.h @@ -17,8 +17,7 @@ */ #pragma once -#include -#include +#include "testnodestateupdater.h" #include #include #include @@ -28,7 +27,8 @@ #include #include #include -#include +#include +#include namespace storage { @@ -64,6 +64,7 @@ public: TestStorageApp(StorageComponentRegisterImpl::UP compReg, const lib::NodeType&, NodeIndex = NodeIndex(0xffff), vespalib::stringref configId = ""); + ~TestStorageApp(); // Set functions, to be able to modify content while running. void setDistribution(Redundancy, NodeCount); @@ -89,7 +90,7 @@ public: // The storage app also implements the done initializer interface, so it can // be sent to components needing this. DoneInitializeHandler& getDoneInitializeHandler() { return *this; } - virtual void notifyDoneInitializing() { _initialized = true; } + void notifyDoneInitializing() override { _initialized = true; } bool isInitialized() const { return _initialized; } void waitUntilInitialized( StorageBucketDBInitializer* initializer = 0, @@ -113,25 +114,23 @@ public: TestServiceLayerApp(vespalib::stringref configId = ""); TestServiceLayerApp(DiskCount diskCount, NodeIndex = NodeIndex(0xffff), vespalib::stringref configId = ""); + ~TestServiceLayerApp(); void setupDummyPersistence(); void setPersistenceProvider(spi::PersistenceProvider::UP); - ServiceLayerComponentRegisterImpl& getComponentRegister() - { return _compReg; } + ServiceLayerComponentRegisterImpl& getComponentRegister() { return _compReg; } spi::PersistenceProvider& getPersistenceProvider(); spi::PartitionStateList& getPartitions(); - uint16_t getPartition(const document::BucketId&); - virtual StorBucketDatabase& getStorageBucketDatabase() - { return _compReg.getBucketDatabase(); } + StorBucketDatabase& getStorageBucketDatabase() override { return _compReg.getBucketDatabase(); } private: - // For storage server interface implementation we'll get rid of soon. - // Use getPartitions().size() instead. - virtual uint16_t getDiskCount() const { return _compReg.getDiskCount(); } + // For storage server interface implementation we'll get rid of soon. + // Use getPartitions().size() instead. + uint16_t getDiskCount() const override { return _compReg.getDiskCount(); } }; class TestDistributorApp : public TestStorageApp, @@ -152,8 +151,7 @@ public: return _compReg; } - virtual api::Timestamp getUniqueTimestamp(); + api::Timestamp getUniqueTimestamp() override; }; } // storageo - diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index 5d1bb17a1c6..a0d8e90b9d3 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -1,5 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "bucketdatabasetest.h" #include #include diff --git a/storage/src/tests/distributor/bucketdatabasetest.h b/storage/src/tests/distributor/bucketdatabasetest.h index 63c3a4cc4eb..321f4dafe49 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.h +++ b/storage/src/tests/distributor/bucketdatabasetest.h @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include -#include +#include #include +#include #include -#include #define SETUP_DATABASE_TESTS() \ CPPUNIT_TEST(testUpdateGetAndRemove); \ @@ -24,7 +23,7 @@ namespace storage { namespace distributor { struct BucketDatabaseTest : public CppUnit::TestFixture { - void setUp(); + void setUp() override ; void testUpdateGetAndRemove(); void testClear(); diff --git a/storage/src/tests/distributor/distributortestutil.cpp b/storage/src/tests/distributor/distributortestutil.cpp index 1570aa98acc..7c709eed097 100644 --- a/storage/src/tests/distributor/distributortestutil.cpp +++ b/storage/src/tests/distributor/distributortestutil.cpp @@ -1,16 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include +#include "distributortestutil.h" #include #include -namespace storage { - -namespace distributor { +namespace storage::distributor { DistributorTestUtil::DistributorTestUtil() - : _messageSender(_sender, _senderDown) + : _messageSender(_sender, _senderDown) { _config = getStandardConfig(false); } @@ -358,7 +354,3 @@ DistributorTestUtil::getDistribution() const { } } - -} - - diff --git a/storage/src/tests/distributor/distributortestutil.h b/storage/src/tests/distributor/distributortestutil.h index d984e486cee..0c2609780dc 100644 --- a/storage/src/tests/distributor/distributortestutil.h +++ b/storage/src/tests/distributor/distributortestutil.h @@ -1,18 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "messagesenderstub.h" +#include +#include #include -#include #include #include #include -#include -#include +#include #include -#include namespace storage { - namespace framework { class TickingThreadPool; } + +namespace framework { class TickingThreadPool; } namespace distributor { @@ -149,7 +150,7 @@ public: void setRedundancy(uint32_t redundancy); - virtual void notifyDoneInitializing() {} + void notifyDoneInitializing() override {} // Must implement this for storage server interface for now virtual api::Timestamp getUniqueTimestamp() { @@ -176,10 +177,10 @@ protected: MessageSenderImpl(MessageSenderStub& up, MessageSenderStub& down) : _sender(up), _senderDown(down) {} - void sendUp(const std::shared_ptr& msg) { + void sendUp(const std::shared_ptr& msg) override { _sender.send(msg); } - void sendDown(const std::shared_ptr& msg) { + void sendDown(const std::shared_ptr& msg) override { _senderDown.send(msg); } }; @@ -189,4 +190,3 @@ protected: } } - diff --git a/storage/src/tests/distributor/maintenancemocks.h b/storage/src/tests/distributor/maintenancemocks.h index 923f7edec2b..a3c8400fd3c 100644 --- a/storage/src/tests/distributor/maintenancemocks.h +++ b/storage/src/tests/distributor/maintenancemocks.h @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include #include #include #include #include +#include namespace storage { namespace distributor { @@ -16,7 +16,7 @@ class MockMaintenancePriorityGenerator { MaintenancePriorityAndType prioritize( const document::BucketId&, - NodeMaintenanceStatsTracker& stats) const + NodeMaintenanceStatsTracker& stats) const override { stats.incMovingOut(1); stats.incCopyingIn(2); @@ -38,23 +38,18 @@ public: _shouldBlock(false) {} - std::string toString() const { + std::string toString() const override { return _bucketId.toString(); } - void onClose(DistributorMessageSender&) { - } - const char* getName() const { - return "MockOperation"; - } - virtual const std::string& getDetailedReason() const { + void onClose(DistributorMessageSender&) override {} + const char* getName() const override { return "MockOperation"; } + const std::string& getDetailedReason() const override { return _reason; } - void onStart(DistributorMessageSender&) { - } - void onReceive(DistributorMessageSender&, const std::shared_ptr&) { - } - bool isBlocked(const PendingMessageTracker&) const { + void onStart(DistributorMessageSender&) override {} + void onReceive(DistributorMessageSender&, const std::shared_ptr&) override {} + bool isBlocked(const PendingMessageTracker&) const override { return _shouldBlock; } void setShouldBlock(bool shouldBlock) { @@ -66,13 +61,13 @@ class MockMaintenanceOperationGenerator : public MaintenanceOperationGenerator { public: - MaintenanceOperation::SP generate(const document::BucketId& id) const { + MaintenanceOperation::SP generate(const document::BucketId& id) const override { return MaintenanceOperation::SP(new MockOperation(id)); } std::vector generateAll( const document::BucketId& id, - NodeMaintenanceStatsTracker& tracker) const + NodeMaintenanceStatsTracker& tracker) const override { (void) tracker; std::vector ret; @@ -93,8 +88,7 @@ public: : _shouldStart(true) {} - bool start(const std::shared_ptr& operation, - Priority priority) + bool start(const std::shared_ptr& operation, Priority priority) override { if (_shouldStart) { _started << operation->toString() diff --git a/storage/src/tests/distributor/messagesenderstub.cpp b/storage/src/tests/distributor/messagesenderstub.cpp index 88210a94848..fae49f033a1 100644 --- a/storage/src/tests/distributor/messagesenderstub.cpp +++ b/storage/src/tests/distributor/messagesenderstub.cpp @@ -1,20 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include + +#include "messagesenderstub.h" +#include "distributortestutil.h" namespace storage { +MessageSenderStub::MessageSenderStub() + : _clusterName("storage"), + _pendingMessageTracker(0) +{} +MessageSenderStub::~MessageSenderStub() {} + std::string MessageSenderStub::getLastCommand(bool verbose) const { if (commands.empty()) { throw std::logic_error("Expected command where there was none"); } - return dumpMessage(*commands[commands.size() - 1], - true, - verbose); - + return dumpMessage(*commands[commands.size() - 1], true, verbose); } std::string @@ -85,4 +88,3 @@ MessageSenderStub::getReplies(bool includeAddress, bool verbose) const } } - diff --git a/storage/src/tests/distributor/messagesenderstub.h b/storage/src/tests/distributor/messagesenderstub.h index 629c1c6e346..07da2b861e2 100644 --- a/storage/src/tests/distributor/messagesenderstub.h +++ b/storage/src/tests/distributor/messagesenderstub.h @@ -11,21 +11,19 @@ struct MessageSenderStub : distributor::DistributorMessageSender std::vector > commands; std::vector > replies; - MessageSenderStub() - : _clusterName("storage"), - _pendingMessageTracker(0) - {} + MessageSenderStub(); + ~MessageSenderStub(); void clear() { commands.clear(); replies.clear(); } - virtual void sendCommand(const std::shared_ptr& cmd) { + void sendCommand(const std::shared_ptr& cmd) override { commands.push_back(cmd); } - virtual void sendReply(const std::shared_ptr& reply) { + void sendReply(const std::shared_ptr& reply) override { replies.push_back(reply); } @@ -44,15 +42,15 @@ struct MessageSenderStub : distributor::DistributorMessageSender bool includeAddress, bool verbose) const; - virtual int getDistributorIndex() const { + int getDistributorIndex() const override { return 0; } - virtual const std::string& getClusterName() const { + const std::string& getClusterName() const override { return _clusterName; } - virtual const distributor::PendingMessageTracker& getPendingMessageTracker() const { + const distributor::PendingMessageTracker& getPendingMessageTracker() const override { assert(_pendingMessageTracker); return *_pendingMessageTracker; } diff --git a/storage/src/tests/persistence/common/filestortestfixture.h b/storage/src/tests/persistence/common/filestortestfixture.h index 4f1de549f47..08f0e98f578 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.h +++ b/storage/src/tests/persistence/common/filestortestfixture.h @@ -48,7 +48,7 @@ public: struct NoOpStorageLinkInjector : StorageLinkInjector { - void inject(DummyStorageLink&) const {} + void inject(DummyStorageLink&) const override {} }; void diff --git a/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp b/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp index 1247ce68058..0f83d1e3d9e 100644 --- a/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp +++ b/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp @@ -1,10 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include + +#include "persistenceproviderwrapper.h" #include #include +#include #define LOG_SPI(ops) \ { \ @@ -40,6 +39,15 @@ includedVersionsToString(spi::IncludedVersions versions) } // anon namespace +PersistenceProviderWrapper::PersistenceProviderWrapper(spi::PersistenceProvider& spi) + : _spi(spi), + _result(spi::Result(spi::Result::NONE, "")), + _log(), + _failureMask(0) +{ } +PersistenceProviderWrapper::~PersistenceProviderWrapper() {} + + std::string PersistenceProviderWrapper::toString() const { diff --git a/storage/src/tests/persistence/common/persistenceproviderwrapper.h b/storage/src/tests/persistence/common/persistenceproviderwrapper.h index 0f1f704a31b..07388b38d16 100644 --- a/storage/src/tests/persistence/common/persistenceproviderwrapper.h +++ b/storage/src/tests/persistence/common/persistenceproviderwrapper.h @@ -15,9 +15,10 @@ */ #pragma once + +#include #include #include -#include namespace storage { @@ -53,13 +54,8 @@ private: mutable std::vector _log; uint32_t _failureMask; public: - PersistenceProviderWrapper(spi::PersistenceProvider& spi) - : _spi(spi), - _result(spi::Result(spi::Result::NONE, "")), - _log(), - _failureMask(0) - { - } + PersistenceProviderWrapper(spi::PersistenceProvider& spi); + ~PersistenceProviderWrapper(); /** * Explicitly set result to anything != NONE to have all operations @@ -89,65 +85,29 @@ public: void clearOperationLog() { _log.clear(); } const std::vector& getOperationLog() const { return _log; } - spi::Result createBucket(const spi::Bucket&, spi::Context&); - - spi::PartitionStateListResult getPartitionStates() const; - - spi::BucketIdListResult listBuckets(spi::PartitionId) const; - - spi::BucketInfoResult getBucketInfo(const spi::Bucket&) const; - - spi::Result put(const spi::Bucket&, spi::Timestamp, const spi::DocumentSP&, spi::Context&); - - spi::RemoveResult remove(const spi::Bucket&, - spi::Timestamp, - const spi::DocumentId&, - spi::Context&); - - spi::RemoveResult removeIfFound(const spi::Bucket&, - spi::Timestamp, - const spi::DocumentId&, - spi::Context&); - - spi::UpdateResult update(const spi::Bucket&, - spi::Timestamp, - const spi::DocumentUpdateSP&, - spi::Context&); - - spi::GetResult get(const spi::Bucket&, - const document::FieldSet&, - const spi::DocumentId&, - spi::Context&) const; - - spi::Result flush(const spi::Bucket&, spi::Context&); - - spi::CreateIteratorResult createIterator(const spi::Bucket&, - const document::FieldSet&, - const spi::Selection&, - spi::IncludedVersions versions, - spi::Context&); - - spi::IterateResult iterate(spi::IteratorId, - uint64_t maxByteSize, spi::Context&) const; - - spi::Result destroyIterator(spi::IteratorId, spi::Context&); - - spi::Result deleteBucket(const spi::Bucket&, spi::Context&); - - spi::Result split(const spi::Bucket& source, - const spi::Bucket& target1, - const spi::Bucket& target2, - spi::Context&); - - spi::Result join(const spi::Bucket& source1, - const spi::Bucket& source2, - const spi::Bucket& target, - spi::Context&); - - spi::Result removeEntry(const spi::Bucket&, - spi::Timestamp, - spi::Context&); + spi::Result createBucket(const spi::Bucket&, spi::Context&) override; + spi::PartitionStateListResult getPartitionStates() const override; + spi::BucketIdListResult listBuckets(spi::PartitionId) const override; + spi::BucketInfoResult getBucketInfo(const spi::Bucket&) const override; + spi::Result put(const spi::Bucket&, spi::Timestamp, const spi::DocumentSP&, spi::Context&) override; + spi::RemoveResult remove(const spi::Bucket&, spi::Timestamp, const spi::DocumentId&, spi::Context&) override; + spi::RemoveResult removeIfFound(const spi::Bucket&, spi::Timestamp, const spi::DocumentId&, spi::Context&) override; + spi::UpdateResult update(const spi::Bucket&, spi::Timestamp, const spi::DocumentUpdateSP&, spi::Context&) override; + spi::GetResult get(const spi::Bucket&, const document::FieldSet&, + const spi::DocumentId&, spi::Context&) const override ; + + spi::Result flush(const spi::Bucket&, spi::Context&) override; + spi::CreateIteratorResult createIterator(const spi::Bucket&, const document::FieldSet&, const spi::Selection&, + spi::IncludedVersions versions, spi::Context&) override; + + spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize, spi::Context&) const override; + spi::Result destroyIterator(spi::IteratorId, spi::Context&) override; + spi::Result deleteBucket(const spi::Bucket&, spi::Context&) override; + spi::Result split(const spi::Bucket& source, const spi::Bucket& target1, + const spi::Bucket& target2, spi::Context&) override; + spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2, + const spi::Bucket& target, spi::Context&) override; + spi::Result removeEntry(const spi::Bucket&, spi::Timestamp, spi::Context&) override; }; } // storage - diff --git a/storage/src/tests/persistence/filestorage/forwardingmessagesender.h b/storage/src/tests/persistence/filestorage/forwardingmessagesender.h index 691e291e534..2ae0626e79f 100644 --- a/storage/src/tests/persistence/filestorage/forwardingmessagesender.h +++ b/storage/src/tests/persistence/filestorage/forwardingmessagesender.h @@ -15,12 +15,8 @@ struct ForwardingMessageSender : public MessageSender { ForwardingMessageSender(StorageLink& l) : link(l) {} - void sendCommand(const std::shared_ptr & cmd) - { link.sendUp(cmd); } - - void sendReply(const std::shared_ptr & reply) - { link.sendUp(reply); } + void sendCommand(const std::shared_ptr & cmd) override { link.sendUp(cmd); } + void sendReply(const std::shared_ptr & reply) override { link.sendUp(reply); } }; } // storage - diff --git a/storage/src/tests/persistence/persistencetestutils.h b/storage/src/tests/persistence/persistencetestutils.h index 4a51faafe05..5119748b802 100644 --- a/storage/src/tests/persistence/persistencetestutils.h +++ b/storage/src/tests/persistence/persistencetestutils.h @@ -1,25 +1,25 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include +#include +#include +#include #include #include +#include +#include #include -#include -#include #include -#include #include +#include namespace storage { struct MessageKeeper : public MessageSender { std::vector _msgs; - void sendCommand(const api::StorageCommand::SP& m) { _msgs.push_back(m); } - void sendReply(const api::StorageReply::SP& m) { _msgs.push_back(m); } + void sendCommand(const api::StorageCommand::SP& m) override { _msgs.push_back(m); } + void sendReply(const api::StorageReply::SP& m) override { _msgs.push_back(m); } }; struct PersistenceTestEnvironment { @@ -52,7 +52,7 @@ public: void setupDisks(uint32_t disks); - void tearDown() { + void tearDown() override { _env.reset(); } @@ -204,7 +204,7 @@ public: class SingleDiskPersistenceTestUtils : public PersistenceTestUtils { public: - void setUp() { + void setUp() override { setupDisks(1); } }; diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h index 9b2f645905d..9ebebf73bea 100644 --- a/storage/src/tests/storageserver/testvisitormessagesession.h +++ b/storage/src/tests/storageserver/testvisitormessagesession.h @@ -2,11 +2,11 @@ #pragma once -#include #include #include #include #include +#include namespace storage { @@ -34,13 +34,9 @@ public: bool autoReply); void reply(mbus::Reply::UP rep); - - uint32_t pending() { return pendingCount; } - - mbus::Result send(std::unique_ptr message); - + uint32_t pending() override { return pendingCount; } + mbus::Result send(std::unique_ptr message) override; void waitForMessages(unsigned int msgCount); - vespalib::Monitor& getMonitor() { return _waitMonitor; } }; @@ -56,24 +52,18 @@ struct TestVisitorMessageSessionFactory : public VisitorMessageSessionFactory : _createAutoReplyVisitorSessions(false), _priConverter(configId) {} - VisitorMessageSession::UP createSession(Visitor& v, VisitorThread& vt) { + VisitorMessageSession::UP createSession(Visitor& v, VisitorThread& vt) override { vespalib::LockGuard lock(_accessLock); - TestVisitorMessageSession::UP session( - new TestVisitorMessageSession( - vt, - v, - _autoReplyError, - _createAutoReplyVisitorSessions)); + TestVisitorMessageSession::UP session(new TestVisitorMessageSession(vt, v, _autoReplyError, + _createAutoReplyVisitorSessions)); _visitorSessions.push_back(session.get()); return VisitorMessageSession::UP(std::move(session)); } - documentapi::Priority::Value toDocumentPriority(uint8_t storagePriority) const - { + documentapi::Priority::Value toDocumentPriority(uint8_t storagePriority) const override { return _priConverter.toDocumentPriority(storagePriority); } }; } // storage - diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp index be189a0bfa9..db4cfcc7ecb 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp @@ -5,20 +5,13 @@ #include "minimumusedbitstracker.h" #include "lockablemap.hpp" #include -#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include #include diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index da8dcf1c1cd..7b8a5857924 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -12,22 +12,17 @@ #pragma once -#include -#include -#include -#include -#include +#include "config-stor-bucketdb.h" +#include "storbucketdb.h" +#include "bucketmanagermetrics.h" #include #include -#include #include -#include -#include #include +#include #include -#include #include - +#include namespace storage { diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h index 3c40c214136..27945f99568 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.h +++ b/storage/src/vespa/storage/bucketdb/lockablemap.h @@ -113,6 +113,7 @@ public: }; LockableMap(); + ~LockableMap(); bool operator==(const LockableMap& other) const; bool operator!=(const LockableMap& other) const { return ! (*this == other); diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.hpp b/storage/src/vespa/storage/bucketdb/lockablemap.hpp index 7510b5d1a87..7d6af079d38 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.hpp +++ b/storage/src/vespa/storage/bucketdb/lockablemap.hpp @@ -70,7 +70,11 @@ LockableMap::LockableMap() : _map(), _lock(), _lockedKeys(), - _lockWaiters() {} + _lockWaiters() +{} + +template +LockableMap::~LockableMap() {} template bool diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp index 10a6bb6bd24..5fc4ece8191 100644 --- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp +++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp @@ -1,5 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include + +#include "mapbucketdatabase.h" #include namespace storage { @@ -10,9 +11,9 @@ MapBucketDatabase::MapBucketDatabase() allocate(); } -MapBucketDatabase::E::~E() -{ -} +MapBucketDatabase::~MapBucketDatabase() {} + +MapBucketDatabase::E::~E() { } uint32_t MapBucketDatabase::allocate() @@ -41,10 +42,8 @@ MapBucketDatabase::allocateValue(const document::BucketId& bid) } BucketDatabase::Entry* -MapBucketDatabase::find(int index, - uint8_t bitCount, - const document::BucketId& bid, - bool create) +MapBucketDatabase::find(int index, uint8_t bitCount, + const document::BucketId& bid, bool create) { if (index == -1) { return NULL; diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.h b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.h index b1d571824c2..c6b969c08e7 100644 --- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.h +++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "bucketdatabase.h" #include namespace storage { @@ -10,33 +10,23 @@ class MapBucketDatabase : public BucketDatabase { public: MapBucketDatabase(); - - virtual Entry get(const document::BucketId& bucket) const; - virtual void remove(const document::BucketId& bucket); - virtual void getParents(const document::BucketId& childBucket, - std::vector& entries) const; - virtual void getAll(const document::BucketId& bucket, - std::vector& entries) const; - virtual void update(const Entry& newEntry); - virtual void forEach( - EntryProcessor&, - const document::BucketId& after = document::BucketId()) const; - virtual void forEach( - MutableEntryProcessor&, - const document::BucketId& after = document::BucketId()); - uint64_t size() const { return _values.size() - _freeValues.size(); }; - void clear(); + ~MapBucketDatabase(); + + Entry get(const document::BucketId& bucket) const override; + void remove(const document::BucketId& bucket) override; + void getParents(const document::BucketId& childBucket, std::vector& entries) const override; + void getAll(const document::BucketId& bucket, std::vector& entries) const override; + void update(const Entry& newEntry) override; + void forEach(EntryProcessor&, const document::BucketId& after = document::BucketId()) const override; + void forEach(MutableEntryProcessor&, const document::BucketId& after = document::BucketId()) override; + uint64_t size() const override { return _values.size() - _freeValues.size(); }; + void clear() override; uint32_t childCount(const document::BucketId&) const override; - Entry upperBound(const document::BucketId& value) const override; - document::BucketId getAppropriateBucket( - uint16_t minBits, - const document::BucketId& bid); - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + document::BucketId getAppropriateBucket(uint16_t minBits, const document::BucketId& bid) override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: struct E { @@ -52,46 +42,19 @@ private: int e_1; }; - BucketDatabase::Entry* find(int idx, - uint8_t bitCount, - const document::BucketId& bid, - bool create); - - bool remove(int index, - uint8_t bitCount, - const document::BucketId& bId); - + BucketDatabase::Entry* find(int idx, uint8_t bitCount, const document::BucketId& bid, bool create); + bool remove(int index, uint8_t bitCount, const document::BucketId& bId); int findFirstInOrderNodeInclusive(int index) const; - - int upperBoundImpl(int index, - uint8_t depth, - const document::BucketId& value) const; + int upperBoundImpl(int index, uint8_t depth, const document::BucketId& value) const; template - bool forEach(int index, - EntryProcessorType& processor, - uint8_t bitCount, - const document::BucketId& lowerBound, - bool& process); - - void findParents(int index, - uint8_t bitCount, - const document::BucketId& bid, - std::vector& entries) const; - - void findAll(int index, - uint8_t bitCount, - const document::BucketId& bid, - std::vector& entries) const; - - uint8_t getHighestSplitBit(int index, - uint8_t bitCount, - const document::BucketId& bid, - uint8_t minCount); - - uint32_t childCountImpl(int index, - uint8_t bitCount, - const document::BucketId& b) const; + bool forEach(int index, EntryProcessorType& processor, uint8_t bitCount, + const document::BucketId& lowerBound, bool& process); + + void findParents(int index, uint8_t bitCount, const document::BucketId& bid, std::vector& entries) const; + void findAll(int index, uint8_t bitCount, const document::BucketId& bid, std::vector& entries) const; + uint8_t getHighestSplitBit(int index, uint8_t bitCount, const document::BucketId& bid, uint8_t minCount); + uint32_t childCountImpl(int index, uint8_t bitCount, const document::BucketId& b) const; uint32_t allocate(); uint32_t allocateValue(const document::BucketId& bid); @@ -104,4 +67,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/common/distributorcomponent.h b/storage/src/vespa/storage/common/distributorcomponent.h index 8b257d82222..191b30542fb 100644 --- a/storage/src/vespa/storage/common/distributorcomponent.h +++ b/storage/src/vespa/storage/common/distributorcomponent.h @@ -25,12 +25,12 @@ #pragma once -#include -#include +#include "storagecomponent.h" #include #include #include #include +#include namespace storage { @@ -72,19 +72,20 @@ class DistributorComponent : public StorageComponent, VisitorConfig _visitorConfig; DistributorConfiguration _totalConfig; - // DistributorManagedComponent implementation - virtual void setTimeCalculator(UniqueTimeCalculator& utc) - { _timeCalculator = &utc; } - virtual void setDistributorConfig(const DistributorConfig& c) - { _distributorConfig = c; _totalConfig.configure(c); } - virtual void setVisitorConfig(const VisitorConfig& c) - { _visitorConfig = c; _totalConfig.configure(c); } + void setTimeCalculator(UniqueTimeCalculator& utc) override { _timeCalculator = &utc; } + void setDistributorConfig(const DistributorConfig& c) override { + _distributorConfig = c; + _totalConfig.configure(c); + } + void setVisitorConfig(const VisitorConfig& c) override { + _visitorConfig = c; + _totalConfig.configure(c); + } public: typedef std::unique_ptr UP; - DistributorComponent(DistributorComponentRegister& compReg, - vespalib::stringref name); + DistributorComponent(DistributorComponentRegister& compReg, vespalib::stringref name); ~DistributorComponent(); api::Timestamp getUniqueTimestamp() const { @@ -103,4 +104,3 @@ public: }; } // storage - diff --git a/storage/src/vespa/storage/common/storagecomponent.h b/storage/src/vespa/storage/common/storagecomponent.h index 6b561619542..60ed25b0c40 100644 --- a/storage/src/vespa/storage/common/storagecomponent.h +++ b/storage/src/vespa/storage/common/storagecomponent.h @@ -31,9 +31,9 @@ #pragma once -#include #include #include +#include #include #include @@ -122,4 +122,3 @@ struct StorageComponentRegister : public virtual framework::ComponentRegister }; } // storage - diff --git a/storage/src/vespa/storage/common/storagelink.h b/storage/src/vespa/storage/common/storagelink.h index a9af5fa5622..dcc0093b5bd 100644 --- a/storage/src/vespa/storage/common/storagelink.h +++ b/storage/src/vespa/storage/common/storagelink.h @@ -20,10 +20,9 @@ #pragma once #include "messagesender.h" -#include "storagecomponent.h" #include #include -#include +#include namespace storage { diff --git a/storage/src/vespa/storage/distributor/blockingoperationstarter.cpp b/storage/src/vespa/storage/distributor/blockingoperationstarter.cpp index 3be6c73704c..85b02810b3c 100644 --- a/storage/src/vespa/storage/distributor/blockingoperationstarter.cpp +++ b/storage/src/vespa/storage/distributor/blockingoperationstarter.cpp @@ -1,14 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "blockingoperationstarter.h" -namespace storage { -namespace distributor { +namespace storage::distributor { bool -BlockingOperationStarter::start(const std::shared_ptr& operation, - Priority priority) +BlockingOperationStarter::start(const std::shared_ptr& operation, Priority priority) { if (operation->isBlocked(_messageTracker)) { return true; @@ -17,4 +14,3 @@ BlockingOperationStarter::start(const std::shared_ptr& operation, } } -} diff --git a/storage/src/vespa/storage/distributor/blockingoperationstarter.h b/storage/src/vespa/storage/distributor/blockingoperationstarter.h index ffd94c7d743..35c9b739539 100644 --- a/storage/src/vespa/storage/distributor/blockingoperationstarter.h +++ b/storage/src/vespa/storage/distributor/blockingoperationstarter.h @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "operationstarter.h" #include -namespace storage { -namespace distributor { +namespace storage::distributor { class PendingMessageTracker; @@ -17,18 +16,13 @@ public: : _messageTracker(messageTracker), _starterImpl(starterImpl) {} + BlockingOperationStarter(const BlockingOperationStarter&) = delete; + BlockingOperationStarter& operator=(const BlockingOperationStarter&) = delete; - virtual bool start(const std::shared_ptr& operation, - Priority priority); - + bool start(const std::shared_ptr& operation, Priority priority) override; private: - BlockingOperationStarter(const BlockingOperationStarter&); - BlockingOperationStarter& operator=(const BlockingOperationStarter&); - PendingMessageTracker& _messageTracker; OperationStarter& _starterImpl; }; } -} - diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index 38011f7b86f..068f42f8b31 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -1,31 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include -#include -#include +#include "bucketdbupdater.h" +#include "distributor.h" +#include "simpleclusterinformation.h" +#include #include #include #include -#include -#include -#include -#include +#include LOG_SETUP(".distributor.bucketdb.updater"); using storage::lib::Node; using storage::lib::NodeType; -namespace storage { -namespace distributor { +namespace storage::distributor { -BucketDBUpdater::BucketDBUpdater(Distributor& owner, - ManagedBucketSpace& bucketSpace, - DistributorMessageSender& sender, - DistributorComponentRegister& compReg) +BucketDBUpdater::BucketDBUpdater(Distributor& owner, ManagedBucketSpace& bucketSpace, + DistributorMessageSender& sender, DistributorComponentRegister& compReg) : framework::StatusReporter("bucketdb", "Bucket DB Updater"), _bucketSpaceComponent(owner, bucketSpace, compReg, "Bucket DB Updater"), _sender(sender), @@ -33,9 +25,7 @@ BucketDBUpdater::BucketDBUpdater(Distributor& owner, { } -BucketDBUpdater::~BucketDBUpdater() -{ -} +BucketDBUpdater::~BucketDBUpdater() {} void BucketDBUpdater::flush() @@ -774,4 +764,3 @@ BucketDBUpdater::NodeRemover::~NodeRemover() } } // distributor -} // storage diff --git a/storage/src/vespa/storage/distributor/distributormessagesender.h b/storage/src/vespa/storage/distributor/distributormessagesender.h index 5e916f9b650..7e68ed96027 100644 --- a/storage/src/vespa/storage/distributor/distributormessagesender.h +++ b/storage/src/vespa/storage/distributor/distributormessagesender.h @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include #include +#include namespace storage { diff --git a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h index f3b64a7ce41..0386b0ade0e 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h +++ b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "bucketprioritydatabase.h" #include #include -#include namespace storage { namespace distributor { @@ -14,11 +14,9 @@ public: virtual ~SimpleBucketPriorityDatabase(); typedef PrioritizedBucket::Priority Priority; - virtual void setPriority(const PrioritizedBucket&); - - virtual const_iterator begin() const; - - virtual const_iterator end() const; + virtual void setPriority(const PrioritizedBucket&) override; + virtual const_iterator begin() const override; + virtual const_iterator end() const override; std::string toString() const; @@ -42,10 +40,9 @@ private: initializeBucketIterToFirstAvailableEntry(); } } + SimpleConstIteratorImpl(const SimpleConstIteratorImpl&) = delete; + SimpleConstIteratorImpl& operator=(const SimpleConstIteratorImpl&) = delete; private: - SimpleConstIteratorImpl(const SimpleConstIteratorImpl&); - SimpleConstIteratorImpl& operator=(const SimpleConstIteratorImpl&); - void initializeBucketIterToFirstAvailableEntry(); bool atEnd() const; @@ -54,11 +51,9 @@ private: void stepToNextPriority(); void step(); - virtual void increment(); - - virtual bool equal(const ConstIteratorImpl& other) const; - - virtual PrioritizedBucket dereference() const; + void increment() override; + bool equal(const ConstIteratorImpl& other) const override; + PrioritizedBucket dereference() const override; }; void clearAllEntriesForBucket(const document::BucketId& bucketId); @@ -68,4 +63,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.cpp b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.cpp index de510755e97..12ba7ca2166 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.cpp +++ b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.cpp @@ -1,10 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include +#include "simplemaintenancescanner.h" -namespace storage { -namespace distributor { +namespace storage::distributor { + +SimpleMaintenanceScanner::~SimpleMaintenanceScanner() {} + +SimpleMaintenanceScanner::PendingMaintenanceStats::PendingMaintenanceStats() {} +SimpleMaintenanceScanner::PendingMaintenanceStats::~PendingMaintenanceStats() {} +SimpleMaintenanceScanner::PendingMaintenanceStats::PendingMaintenanceStats(const PendingMaintenanceStats &) = default; +SimpleMaintenanceScanner::PendingMaintenanceStats & +SimpleMaintenanceScanner::PendingMaintenanceStats::operator = (const PendingMaintenanceStats &) = default; MaintenanceScanner::ScanResult SimpleMaintenanceScanner::scanNext() @@ -28,9 +33,7 @@ SimpleMaintenanceScanner::reset() void SimpleMaintenanceScanner::prioritizeBucket(const document::BucketId& id) { - MaintenancePriorityAndType pri( - _priorityGenerator.prioritize( - id, _pendingMaintenance.perNodeStats)); + MaintenancePriorityAndType pri(_priorityGenerator.prioritize(id, _pendingMaintenance.perNodeStats)); if (pri.requiresMaintenance()) { _bucketPriorityDb.setPriority(PrioritizedBucket(id, pri.getPriority().getPriority())); assert(pri.getType() != MaintenanceOperation::OPERATION_COUNT); @@ -53,4 +56,3 @@ operator<<(std::ostream& os, } } -} diff --git a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h index b62ecffa0fd..a3e439cb8ba 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h +++ b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include -#include -#include +#include "maintenancescanner.h" +#include "bucketprioritydatabase.h" +#include "maintenanceprioritygenerator.h" +#include "node_maintenance_stats_tracker.h" #include namespace storage { @@ -20,10 +18,13 @@ public: GlobalMaintenanceStats() : pending(MaintenanceOperation::OPERATION_COUNT) - { - } + { } }; struct PendingMaintenanceStats { + PendingMaintenanceStats(); + PendingMaintenanceStats(const PendingMaintenanceStats &); + PendingMaintenanceStats &operator = (const PendingMaintenanceStats &); + ~PendingMaintenanceStats(); GlobalMaintenanceStats global; NodeMaintenanceStatsTracker perNodeStats; }; @@ -42,10 +43,12 @@ public: _bucketDb(bucketDb), _bucketCursor() {} + SimpleMaintenanceScanner(const SimpleMaintenanceScanner&) = delete; + SimpleMaintenanceScanner& operator=(const SimpleMaintenanceScanner&) = delete; + ~SimpleMaintenanceScanner(); - ScanResult scanNext(); - - void reset(); + ScanResult scanNext() override; + void reset() override; // TODO: move out into own interface! void prioritizeBucket(const document::BucketId& id); @@ -53,15 +56,10 @@ public: const PendingMaintenanceStats& getPendingMaintenanceStats() const { return _pendingMaintenance; } -private: - SimpleMaintenanceScanner(const SimpleMaintenanceScanner&); - SimpleMaintenanceScanner& operator=(const SimpleMaintenanceScanner&); }; std::ostream& -operator<<(std::ostream&, - const SimpleMaintenanceScanner::GlobalMaintenanceStats&); +operator<<(std::ostream&, const SimpleMaintenanceScanner::GlobalMaintenanceStats&); } } - diff --git a/storage/src/vespa/storage/distributor/messagetracker.cpp b/storage/src/vespa/storage/distributor/messagetracker.cpp index 15b428f3393..aeca85e821d 100644 --- a/storage/src/vespa/storage/distributor/messagetracker.cpp +++ b/storage/src/vespa/storage/distributor/messagetracker.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include +#include "messagetracker.h" + +#include LOG_SETUP(".messagetracker"); namespace storage { @@ -14,6 +13,8 @@ MessageTracker::MessageTracker(const std::string& clusterName) : _clusterName(clusterName) {} +MessageTracker::~MessageTracker() {} + void MessageTracker::flushQueue(MessageSender& sender) { diff --git a/storage/src/vespa/storage/distributor/messagetracker.h b/storage/src/vespa/storage/distributor/messagetracker.h index 991169b7ae6..73a864fdb3e 100644 --- a/storage/src/vespa/storage/distributor/messagetracker.h +++ b/storage/src/vespa/storage/distributor/messagetracker.h @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "distributormetricsset.h" +#include #include #include -#include -#include - -namespace storage { -namespace distributor { +namespace storage::distributor { class MessageTracker { public: @@ -22,6 +20,9 @@ public: }; MessageTracker(const std::string& clusterName); + MessageTracker(MessageTracker &&) = default; + MessageTracker & operator = (MessageTracker &&) = default; + ~MessageTracker(); void queueCommand(std::shared_ptr msg, uint16_t target) { _commandQueue.push_back(ToSend(msg, target)); @@ -48,6 +49,3 @@ protected: }; } - -} - diff --git a/storage/src/vespa/storage/distributor/operationowner.cpp b/storage/src/vespa/storage/distributor/operationowner.cpp index 98b1944f9e5..4ec21742cbf 100644 --- a/storage/src/vespa/storage/distributor/operationowner.cpp +++ b/storage/src/vespa/storage/distributor/operationowner.cpp @@ -1,17 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include + +#include "operationowner.h" #include -#include -#include #include #include +#include LOG_SETUP(".operationowner"); -namespace storage { - -namespace distributor { +namespace storage::distributor { OperationOwner::~OperationOwner() { @@ -82,7 +79,4 @@ OperationOwner::erase(api::StorageMessage::Id msgId) _sentMessageMap.pop(msgId); } - -} // distributor - -} // storage +} diff --git a/storage/src/vespa/storage/distributor/operationowner.h b/storage/src/vespa/storage/distributor/operationowner.h index e72d6738513..e0ad0f60ca0 100644 --- a/storage/src/vespa/storage/distributor/operationowner.h +++ b/storage/src/vespa/storage/distributor/operationowner.h @@ -1,15 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include +#include "sentmessagemap.h" +#include "distributormessagesender.h" +#include "operationstarter.h" #include -#include -#include +#include -namespace storage { +namespace storage::framework { class Clock; } -namespace distributor { +namespace storage::distributor { class Operation; @@ -29,29 +29,22 @@ public: _cb(cb) {} - /** - Sends a message. - */ - void sendCommand(const std::shared_ptr &); - - /** - Send a reply. - */ - void sendReply(const std::shared_ptr & msg); + void sendCommand(const std::shared_ptr &) override; + void sendReply(const std::shared_ptr & msg) override; OperationOwner& getOwner() { return _owner; } - virtual int getDistributorIndex() const { + int getDistributorIndex() const override { return _sender.getDistributorIndex(); } - virtual const std::string& getClusterName() const { + const std::string& getClusterName() const override { return _sender.getClusterName(); } - virtual const PendingMessageTracker& getPendingMessageTracker() const { + const PendingMessageTracker& getPendingMessageTracker() const override { return _sender.getPendingMessageTracker(); } @@ -81,8 +74,7 @@ public: return _sentMessageMap; }; - virtual bool start(const std::shared_ptr& operation, - Priority priority); + bool start(const std::shared_ptr& operation, Priority priority) override; /** If the given message exists, create a reply and pass it to the @@ -91,11 +83,7 @@ public: void erase(api::StorageMessage::Id msgId); void onClose(); - - uint32_t size() const { - return _sentMessageMap.size(); - } - + uint32_t size() const { return _sentMessageMap.size(); } std::string toString() const; private: @@ -105,6 +93,3 @@ private: }; } - -} - diff --git a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp index 9d056eb0fd0..4044cdff184 100644 --- a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp @@ -1,20 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include -#include -#include -#include + +#include "multioperationoperation.h" +#include "putoperation.h" #include #include -#include +#include LOG_SETUP(".distributor.callback.doc.multioperation"); - -using namespace storage::distributor; -using namespace storage; +namespace storage::distributor { MultiOperationOperation::MultiOperationOperation( DistributorComponent& manager, @@ -28,7 +22,9 @@ MultiOperationOperation::MultiOperationOperation( _manager(manager), _minUseBits(manager.getDistributor().getConfig().getMinimalBucketSplit()) { -}; +} + +MultiOperationOperation::~MultiOperationOperation() {} bool MultiOperationOperation::sendToBucket( @@ -230,7 +226,7 @@ MultiOperationOperation::onStart(DistributorMessageSender& sender) _msg = std::shared_ptr(); _reply->setHighestModificationTimestamp(highestTimestamp); -}; +} void MultiOperationOperation::onReceive(DistributorMessageSender& sender, const std::shared_ptr & msg) @@ -243,3 +239,5 @@ MultiOperationOperation::onClose(DistributorMessageSender& sender) { _tracker.fail(sender, api::ReturnCode(api::ReturnCode::ABORTED, "Process is shutting down")); } + +} diff --git a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h index 20d64e95fae..a3bde027b6c 100644 --- a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h @@ -2,19 +2,17 @@ #pragma once #include +#include #include #include -#include -namespace document { -class Document; -} +namespace document { class Document; } namespace storage { namespace api { -class CreateBucketReply; -class MultiOperationCommand; + class CreateBucketReply; + class MultiOperationCommand; } namespace distributor { @@ -25,26 +23,19 @@ public: MultiOperationOperation(DistributorComponent& manager, const std::shared_ptr & msg, PersistenceOperationMetricSet& metric); + ~MultiOperationOperation(); - void onStart(DistributorMessageSender& sender); - - const char* getName() const { return "multioperation"; }; - - std::string getStatus() const { return ""; }; - - void onReceive(DistributorMessageSender& sender, const std::shared_ptr &); - - void onClose(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; + const char* getName() const override { return "multioperation"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; + void onClose(DistributorMessageSender& sender) override; private: std::shared_ptr _reply; - PersistenceMessageTrackerImpl _trackerInstance; PersistenceMessageTracker& _tracker; - std::shared_ptr _msg; - DistributorComponent& _manager; - uint32_t _minUseBits; uint32_t getMinimumUsedBits(const vdslib::DocumentList& opList) const; @@ -55,7 +46,4 @@ private: } - } - - diff --git a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp index 9726200b588..6d37d6c67ba 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.cpp @@ -1,14 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include + +#include "removelocationoperation.h" +#include #include #include #include #include -#include -#include -#include -#include +#include LOG_SETUP(".distributor.callback.doc.removelocation"); @@ -27,8 +26,9 @@ RemoveLocationOperation::RemoveLocationOperation( _tracker(_trackerInstance), _msg(msg), _manager(manager) -{ -} +{} + +RemoveLocationOperation::~RemoveLocationOperation() {} int RemoveLocationOperation::getBucketId( diff --git a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h index 9c0c8e21e91..1900be88ee3 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/removelocationoperation.h @@ -6,9 +6,7 @@ namespace storage { -namespace api { -class RemoveLocationCommand; -} +namespace api { class RemoveLocationCommand; } namespace distributor { @@ -18,21 +16,17 @@ public: RemoveLocationOperation(DistributorComponent& manager, const std::shared_ptr & msg, PersistenceOperationMetricSet& metric); + ~RemoveLocationOperation(); - void onStart(DistributorMessageSender& sender); static int getBucketId(DistributorComponent& manager, const api::RemoveLocationCommand& cmd, document::BucketId& id); - - const char* getName() const { return "removelocation"; }; - - std::string getStatus() const { return ""; }; - - void onReceive(DistributorMessageSender& sender, const std::shared_ptr &); - - void onClose(DistributorMessageSender& sender); - + void onStart(DistributorMessageSender& sender) override; + const char* getName() const override { return "removelocation"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; + void onClose(DistributorMessageSender& sender) override; private: PersistenceMessageTrackerImpl _trackerInstance; PersistenceMessageTracker& _tracker; @@ -45,4 +39,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp index a8641e52acf..dc0c3673025 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include +#include "removeoperation.h" #include -#include -#include +#include LOG_SETUP(".distributor.operation.external.remove"); @@ -26,12 +23,12 @@ RemoveOperation::RemoveOperation(DistributorComponent& manager, { } +RemoveOperation::~RemoveOperation() {} + void RemoveOperation::onStart(DistributorMessageSender& sender) { - LOG(spam, - "Started remove on document %s", - _msg->getDocumentId().toString().c_str()); + LOG(spam, "Started remove on document %s", _msg->getDocumentId().toString().c_str()); document::BucketId bucketId( _manager.getBucketIdFactory().getBucketId( @@ -87,7 +84,6 @@ RemoveOperation::onReceive(DistributorMessageSender& sender, const std::shared_p api::RemoveReply& replyToSend = static_cast(*_tracker.getReply()); - if (reply.getOldTimestamp() > replyToSend.getOldTimestamp()) { replyToSend.setOldTimestamp(reply.getOldTimestamp()); } diff --git a/storage/src/vespa/storage/distributor/operations/external/removeoperation.h b/storage/src/vespa/storage/distributor/operations/external/removeoperation.h index 1e5b1ca4c8f..f83bfb085da 100644 --- a/storage/src/vespa/storage/distributor/operations/external/removeoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/removeoperation.h @@ -6,9 +6,7 @@ namespace storage { -namespace api { -class RemoveCommand; -} +namespace api { class RemoveCommand; } namespace distributor { @@ -19,16 +17,14 @@ public: const std::shared_ptr & msg, PersistenceOperationMetricSet& metric, SequencingHandle sequencingHandle = SequencingHandle()); + ~RemoveOperation(); - void onStart(DistributorMessageSender& sender); - - const char* getName() const { return "remove"; }; - - std::string getStatus() const { return ""; }; + void onStart(DistributorMessageSender& sender) override; + const char* getName() const override { return "remove"; }; + std::string getStatus() const override { return ""; }; - void onReceive(DistributorMessageSender& sender, const std::shared_ptr &); - - void onClose(DistributorMessageSender& sender); + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; + void onClose(DistributorMessageSender& sender) override; private: PersistenceMessageTrackerImpl _trackerInstance; @@ -42,4 +38,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp index c54598b7a76..b99c1c178c3 100644 --- a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include -#include +#include "statbucketoperation.h" #include -#include +#include #include +#include LOG_SETUP(".distributor.callback.statbucket"); namespace storage { @@ -22,6 +19,8 @@ StatBucketOperation::StatBucketOperation( { } +StatBucketOperation::~StatBucketOperation() {} + void StatBucketOperation::onClose(DistributorMessageSender& sender) { diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.h b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.h index 23cb629f89f..78b27d2703f 100644 --- a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.h @@ -8,13 +8,10 @@ #pragma once #include -#include namespace storage { -namespace api { -class StatBucketCommand; -} +namespace api { class StatBucketCommand; } namespace distributor { @@ -25,16 +22,13 @@ class StatBucketOperation : public Operation public: StatBucketOperation(DistributorComponent& manager, const std::shared_ptr & cmd); - virtual ~StatBucketOperation() {}; - - virtual const char* getName() const { return "statBucket"; } - virtual std::string getStatus() const { return ""; } - - void onClose(DistributorMessageSender& sender); - - virtual void onStart(DistributorMessageSender& sender); - virtual void onReceive(DistributorMessageSender& sender, const std::shared_ptr & msg); + ~StatBucketOperation(); + const char* getName() const override { return "statBucket"; } + std::string getStatus() const override { return ""; } + void onClose(DistributorMessageSender& sender) override; + void onStart(DistributorMessageSender& sender) override; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr & msg) override; private: DistributorComponent& _manager; diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp index 295512d579c..0cd8cda501c 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp @@ -1,25 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include "visitoroperation.h" #include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include -#include - -namespace storage { - -namespace distributor { +#include +#include +#include LOG_SETUP(".visitoroperation"); +namespace storage::distributor { + void VisitorOperation::BucketInfo::print(vespalib::asciistream & out) const { @@ -1014,5 +1012,3 @@ VisitorOperation::onClose(DistributorMessageSender& sender) } } - -} diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h index 6fd18d8d01e..18ac302c019 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.h @@ -1,16 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include -#include -#include #include #include +#include +#include +#include -namespace document { -class Document; -} + +namespace document { class Document; } namespace storage { @@ -43,16 +42,13 @@ public: ~VisitorOperation(); - void onClose(DistributorMessageSender& sender); - - void onStart(DistributorMessageSender& sender); - + void onClose(DistributorMessageSender& sender) override; + void onStart(DistributorMessageSender& sender) override; void onReceive(DistributorMessageSender& sender, - const std::shared_ptr & msg); + const std::shared_ptr & msg) override; - const char* getName() const { return "visit"; } - - std::string getStatus() const { return ""; } + const char* getName() const override { return "visit"; } + std::string getStatus() const override { return ""; } private: struct BucketInfo { @@ -61,10 +57,7 @@ private: uint16_t failedCount; std::vector triedNodes; - BucketInfo() - : done(false), activeNode(-1), failedCount(0), triedNodes() - { - } + BucketInfo() : done(false), activeNode(-1), failedCount(0), triedNodes() { } void print(vespalib::asciistream & out) const; vespalib::string toString() const; diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.cpp index e3430f9fa0e..7f133019d19 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.cpp @@ -1,12 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include + +#include "garbagecollectionoperation.h" #include #include -#include -#include #include #include @@ -15,6 +11,13 @@ LOG_SETUP(".distributor.operation.idealstate.remove"); using namespace storage::distributor; +GarbageCollectionOperation::GarbageCollectionOperation(const std::string& clusterName, const BucketAndNodes& nodes) + : IdealStateOperation(nodes), + _tracker(clusterName) +{} + +GarbageCollectionOperation::~GarbageCollectionOperation() { } + void GarbageCollectionOperation::onStart(DistributorMessageSender& sender) { @@ -76,4 +79,3 @@ GarbageCollectionOperation::shouldBlockThisOperation(uint32_t, uint8_t) const { return true; } - diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.h index 33ccf3c2abe..10df19386ca 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/garbagecollectionoperation.h @@ -1,43 +1,27 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "idealstateoperation.h" #include -namespace storage -{ - -namespace distributor -{ +namespace storage::distributor { class PendingMessageTracker; class GarbageCollectionOperation : public IdealStateOperation { public: - GarbageCollectionOperation( - const std::string& clusterName, - const BucketAndNodes& nodes) - : IdealStateOperation(nodes), _tracker(clusterName) {}; - - /** - Sends messages, calls done() if we are done (sent nothing). - */ - void onStart(DistributorMessageSender& sender); - - void onReceive(DistributorMessageSender& sender, const std::shared_ptr &); + GarbageCollectionOperation(const std::string& clusterName, const BucketAndNodes& nodes); + ~GarbageCollectionOperation(); - const char* getName() const { return "garbagecollection"; }; - - Type getType() const { return GARBAGE_COLLECTION; } - - bool shouldBlockThisOperation(uint32_t, uint8_t) const; + void onStart(DistributorMessageSender& sender) override; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; + const char* getName() const override { return "garbagecollection"; }; + Type getType() const override { return GARBAGE_COLLECTION; } + bool shouldBlockThisOperation(uint32_t, uint8_t) const override; protected: MessageTracker _tracker; }; } - -} - diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.h index cf820dd3381..52c6c2a07d2 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.h @@ -8,11 +8,7 @@ #include #include -namespace storage -{ - -namespace distributor -{ +namespace storage::distributor { class PendingMessageTracker; class IdealStateManager; @@ -116,7 +112,7 @@ public: virtual ~IdealStateOperation(); - void onClose(DistributorMessageSender&) {} + void onClose(DistributorMessageSender&) override {} /** Returns true if the operation was performed successfully. @@ -184,7 +180,7 @@ public: * Returns true if we are blocked to start this operation given * the pending messages. */ - virtual bool isBlocked(const PendingMessageTracker& pendingMessages) const; + bool isBlocked(const PendingMessageTracker& pendingMessages) const override; /** Returns the priority we should send messages with. @@ -198,7 +194,7 @@ public: _detailedReason = std::move(detailedReason); } - const std::string& getDetailedReason() const { + const std::string& getDetailedReason() const override { return _detailedReason; } @@ -212,7 +208,7 @@ public: std::string toXML(framework::Clock& clock) const; - std::string toString() const; + std::string toString() const override; /** * Should return true if the given message type should block this operation. @@ -237,17 +233,9 @@ protected: * operations to other nodes for this bucket, these will not be part of * the set of messages checked. */ - bool checkBlock(const document::BucketId& bId, - const PendingMessageTracker& tracker) const; - - bool checkBlockForAllNodes(const document::BucketId& bId, - const PendingMessageTracker& tracker) const; + bool checkBlock(const document::BucketId& bId, const PendingMessageTracker& tracker) const; + bool checkBlockForAllNodes(const document::BucketId& bId, const PendingMessageTracker& tracker) const; }; } - - -} - - diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp index 76fdaded452..75c58ca4f87 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.cpp @@ -1,21 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include +#include "mergeoperation.h" #include -#include #include - LOG_SETUP(".distributor.operation.idealstate.merge"); -namespace storage { -namespace distributor { +namespace storage::distributor { -MergeOperation::~MergeOperation() -{ -} +MergeOperation::~MergeOperation() {} std::string MergeOperation::getStatus() const @@ -149,9 +141,7 @@ MergeOperation::onStart(DistributorMessageSender& sender) { BucketDatabase::Entry entry = _manager->getDistributorComponent().getBucketDatabase().get(getBucketId()); if (!entry.valid()) { - LOGBP(debug, - "Unable to merge nonexisting bucket %s", - getBucketId().toString().c_str()); + LOGBP(debug, "Unable to merge nonexisting bucket %s", getBucketId().toString().c_str()); _ok = false; done(); return; @@ -164,8 +154,7 @@ MergeOperation::onStart(DistributorMessageSender& sender) for (uint32_t i = 0; i < getNodes().size(); ++i) { const BucketCopy* copy = entry->getNode(getNodes()[i]); if (copy == 0) { // New copies? - newCopies.push_back(std::unique_ptr( - new BucketCopy(0, getNodes()[i], api::BucketInfo()))); + newCopies.push_back(std::unique_ptr(new BucketCopy(0, getNodes()[i], api::BucketInfo()))); copy = newCopies.back().get(); } nodes.push_back(MergeMetaData(getNodes()[i], *copy)); @@ -211,10 +200,8 @@ MergeOperation::onStart(DistributorMessageSender& sender) _sentMessageTime = _manager->getDistributorComponent().getClock().getTimeInSeconds(); } else { LOGBP(debug, - "Unable to merge bucket %s, since only one copy is available. " - "System state %s", - getBucketId().toString().c_str(), - clusterState.toString().c_str()); + "Unable to merge bucket %s, since only one copy is available. System state %s", + getBucketId().toString().c_str(), clusterState.toString().c_str()); _ok = false; done(); } @@ -388,5 +375,4 @@ MergeOperation::shouldBlockThisOperation(uint32_t messageType, uint8_t pri) cons return IdealStateOperation::shouldBlockThisOperation(messageType, pri); } -} // distributor -} // storage +} diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.h index b99a302a9d3..8fdf22c88f5 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/mergeoperation.h @@ -2,18 +2,15 @@ #pragma once +#include "idealstateoperation.h" +#include "mergelimiter.h" +#include "mergemetadata.h" +#include "removebucketoperation.h" #include -#include -#include -#include -#include #include -namespace storage { -namespace lib { - class Distribution; -} -namespace distributor { +namespace storage::lib { class Distribution; } +namespace storage::distributor { class MergeOperation : public IdealStateOperation { @@ -29,8 +26,7 @@ protected: public: static const int LOAD = 10; - MergeOperation(const BucketAndNodes& nodes, - uint16_t maxNodes = 16) + MergeOperation(const BucketAndNodes& nodes, uint16_t maxNodes = 16) : IdealStateOperation(nodes), _sentMessageTime(0), _limiter(maxNodes) @@ -38,16 +34,11 @@ public: ~MergeOperation(); - void onStart(DistributorMessageSender& sender); - - void onReceive(DistributorMessageSender& sender, - const api::StorageReply::SP&); - - const char* getName() const { return "merge"; }; - - std::string getStatus() const; - - Type getType() const { return MERGE_BUCKET; } + void onStart(DistributorMessageSender& sender) override; + void onReceive(DistributorMessageSender& sender, const api::StorageReply::SP&) override; + const char* getName() const override { return "merge"; }; + std::string getStatus() const override; + Type getType() const override { return MERGE_BUCKET; } /** Generates ordered list of nodes that should be included in the merge */ static void generateSortedNodeList( @@ -55,7 +46,7 @@ public: const document::BucketId&, MergeLimiter&, std::vector&); - bool shouldBlockThisOperation(uint32_t messageType, uint8_t pri) const; + bool shouldBlockThisOperation(uint32_t messageType, uint8_t pri) const override ; private: static void addIdealNodes( const lib::Distribution&, @@ -80,5 +71,4 @@ private: DistributorMessageSender& sender); }; -} // distributor -} // storage +} diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp index 3d0a27f5215..f9e0837952c 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.cpp @@ -1,12 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include + +#include "removebucketoperation.h" #include #include -#include -#include #include diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.h index 25eea35267b..b307673eef8 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/removebucketoperation.h @@ -1,24 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "idealstateoperation.h" #include -namespace storage -{ - -namespace distributor -{ +namespace storage::distributor { class PendingMessageTracker; class RemoveBucketOperation : public IdealStateOperation { public: - RemoveBucketOperation( - const std::string& clusterName, - const BucketAndNodes& nodes) - : IdealStateOperation(nodes), _tracker(clusterName) {}; + RemoveBucketOperation(const std::string& clusterName, const BucketAndNodes& nodes) + : IdealStateOperation(nodes), _tracker(clusterName) + {} /** Sends messages, returns true if we are done (sent nothing). @@ -28,23 +23,16 @@ public: /** Sends messages, calls done() if we are done (sent nothing). */ - void onStart(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; bool onReceiveInternal(const std::shared_ptr &); - void onReceive(DistributorMessageSender& sender, const std::shared_ptr &); - - const char* getName() const { return "remove"; }; - - Type getType() const { return DELETE_BUCKET; } - - bool shouldBlockThisOperation(uint32_t, uint8_t) const; - + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; + const char* getName() const override { return "remove"; }; + Type getType() const override { return DELETE_BUCKET; } + bool shouldBlockThisOperation(uint32_t, uint8_t) const override; protected: MessageTracker _tracker; }; } - -} - diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.cpp index 9dc0947b219..3fb305439ac 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.cpp @@ -1,16 +1,22 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include + +#include "setbucketstateoperation.h" #include -#include -#include #include - LOG_SETUP(".distributor.operation.idealstate.setactive"); -namespace storage { +namespace storage::distributor { + +SetBucketStateOperation::SetBucketStateOperation(const std::string& clusterName, + const BucketAndNodes& nodes, + const std::vector& wantedActiveNodes) + : IdealStateOperation(nodes), + _tracker(clusterName), + _wantedActiveNodes(wantedActiveNodes) +{ } -namespace distributor { +SetBucketStateOperation::~SetBucketStateOperation() {} void SetBucketStateOperation::enqueueSetBucketStateCommand(uint16_t node, bool active) { @@ -120,6 +126,4 @@ SetBucketStateOperation::onReceive(DistributorMessageSender& sender, } } -} // namespace distributor - -} // namespace storage +} diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h index 32a5fcaf381..067b780d5ab 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/setbucketstateoperation.h @@ -1,35 +1,23 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "idealstateoperation.h" #include -namespace storage -{ - -namespace distributor -{ +namespace storage::distributor { class SetBucketStateOperation : public IdealStateOperation { public: SetBucketStateOperation(const std::string& clusterName, const BucketAndNodes& nodes, - const std::vector& wantedActiveNodes) - : IdealStateOperation(nodes), - _tracker(clusterName), - _wantedActiveNodes(wantedActiveNodes) - { - } - - void onStart(DistributorMessageSender&); - - void onReceive(DistributorMessageSender&, const std::shared_ptr&); - - const char* getName() const { return "setbucketstate"; } - - virtual Type getType() const { return SET_BUCKET_STATE; } + const std::vector& wantedActiveNodes); + ~SetBucketStateOperation(); + void onStart(DistributorMessageSender&) override; + void onReceive(DistributorMessageSender&, const std::shared_ptr&) override; + const char* getName() const override { return "setbucketstate"; } + Type getType() const override { return SET_BUCKET_STATE; } protected: MessageTracker _tracker; std::vector _wantedActiveNodes; @@ -41,7 +29,4 @@ private: bool shouldBeActive(uint16_t node) const; }; -} // namespace distributor - -} // namespace storage - +} diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp index 0a37a1d1e37..7601d7faa6d 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp @@ -1,13 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include -#include + +#include "splitoperation.h" #include #include -#include -#include +#include #include @@ -15,6 +11,16 @@ LOG_SETUP(".distributor.operation.idealstate.split"); using namespace storage::distributor; +SplitOperation::SplitOperation(const std::string& clusterName, const BucketAndNodes& nodes, + uint32_t maxBits, uint32_t splitCount, uint32_t splitSize) + : IdealStateOperation(nodes), + _tracker(clusterName), + _maxBits(maxBits), + _splitCount(splitCount), + _splitSize(splitSize) +{} +SplitOperation::~SplitOperation() {} + void SplitOperation::onStart(DistributorMessageSender& sender) { diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.h b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.h index e9e44f81930..89667392555 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.h +++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.h @@ -1,45 +1,27 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "idealstateoperation.h" #include -namespace storage -{ - -namespace distributor -{ +namespace storage::distributor { class SplitOperation : public IdealStateOperation { public: - SplitOperation(const std::string& clusterName, - const BucketAndNodes& nodes, - uint32_t maxBits, - uint32_t splitCount, - uint32_t splitSize) - : IdealStateOperation(nodes), - _tracker(clusterName), - _maxBits(maxBits), - _splitCount(splitCount), - _splitSize(splitSize) - {} + SplitOperation(const std::string& clusterName, const BucketAndNodes& nodes, + uint32_t maxBits, uint32_t splitCount, uint32_t splitSize); + SplitOperation(const SplitOperation &) = delete; + SplitOperation & operator = (const SplitOperation &) = delete; + ~SplitOperation(); void onStart(DistributorMessageSender& sender) override; - - void onReceive(DistributorMessageSender& sender, - const std::shared_ptr &) override; - + void onReceive(DistributorMessageSender& sender, const std::shared_ptr &) override; const char* getName() const override { return "split"; }; - Type getType() const override { return SPLIT_BUCKET; } - uint32_t getMaxSplitBits() const { return _maxBits; } - bool isBlocked(const PendingMessageTracker&) const override; - bool shouldBlockThisOperation(uint32_t, uint8_t) const override; - protected: MessageTracker _tracker; @@ -50,6 +32,3 @@ protected: }; } - -} - diff --git a/storage/src/vespa/storage/distributor/operationstarter.h b/storage/src/vespa/storage/distributor/operationstarter.h index bc556128247..b8757034290 100644 --- a/storage/src/vespa/storage/distributor/operationstarter.h +++ b/storage/src/vespa/storage/distributor/operationstarter.h @@ -1,23 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include -namespace storage { -namespace distributor { +namespace storage::distributor { class Operation; class OperationStarter { public: - typedef uint8_t Priority; - + using Priority = uint8_t; virtual ~OperationStarter() {} - - virtual bool start(const std::shared_ptr& operation, - Priority priority) = 0; + virtual bool start(const std::shared_ptr& operation, Priority priority) = 0; }; } -} - diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index 27b3198606c..9497bf05f17 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include + +#include "pendingclusterstate.h" +#include "bucketdbupdater.h" #include #include #include @@ -10,9 +9,7 @@ #include LOG_SETUP(".pendingclusterstate"); -namespace storage { - -namespace distributor { +namespace storage::distributor { using lib::Node; using lib::NodeType; @@ -26,10 +23,8 @@ PendingClusterState::PendingClusterState( const std::unordered_set& outdatedNodes, api::Timestamp creationTimestamp) : _cmd(newStateCmd), - _requestedNodes( - newStateCmd->getSystemState().getNodeCount(lib::NodeType::STORAGE)), - _outdatedNodes( - newStateCmd->getSystemState().getNodeCount(lib::NodeType::STORAGE)), + _requestedNodes(newStateCmd->getSystemState().getNodeCount(lib::NodeType::STORAGE)), + _outdatedNodes(newStateCmd->getSystemState().getNodeCount(lib::NodeType::STORAGE)), _iter(0), _prevClusterState(clusterInfo->getClusterState()), _newClusterState(newStateCmd->getSystemState()), @@ -37,8 +32,7 @@ PendingClusterState::PendingClusterState( _clusterInfo(clusterInfo), _creationTimestamp(creationTimestamp), _sender(sender), - _bucketOwnershipTransfer(distributorChanged( - _prevClusterState, _newClusterState)) + _bucketOwnershipTransfer(distributorChanged(_prevClusterState, _newClusterState)) { logConstructionInformation(); if (hasBucketOwnershipTransfer()) { @@ -75,6 +69,8 @@ PendingClusterState::PendingClusterState( } } +PendingClusterState::~PendingClusterState() {} + void PendingClusterState::logConstructionInformation() const { @@ -332,9 +328,21 @@ PendingClusterState::requestNode(uint16_t node) _sender.sendToNode(NodeType::STORAGE, node, cmd); } + +PendingClusterState::Summary::Summary(const std::string& prevClusterState, + const std::string& newClusterState, + uint32_t processingTime) + : _prevClusterState(prevClusterState), + _newClusterState(newClusterState), + _processingTime(processingTime) +{} + +PendingClusterState::Summary::Summary(const Summary &) = default; +PendingClusterState::Summary & PendingClusterState::Summary::operator = (const Summary &) = default; +PendingClusterState::Summary::~Summary() { } + bool -PendingClusterState::onRequestBucketInfoReply( - const std::shared_ptr& reply) +PendingClusterState::onRequestBucketInfoReply(const std::shared_ptr& reply) { auto iter = _sentMessages.find(reply->getMsgId()); @@ -610,5 +618,3 @@ PendingClusterState::getSummary() const } } - -} diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.h b/storage/src/vespa/storage/distributor/pendingclusterstate.h index a741d5cec51..fdd05ba6f84 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.h +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.h @@ -1,19 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "clusterinformation.h" +#include #include #include #include +#include #include #include -#include -#include #include #include -namespace storage { - -namespace distributor { +namespace storage::distributor { class DistributorMessageSender; @@ -28,7 +27,8 @@ public: Entry(const document::BucketId& bid, const BucketCopy& copy_) : bucketId(bid), - copy(copy_) {}; + copy(copy_) + {} document::BucketId bucketId; BucketCopy copy; @@ -39,12 +39,12 @@ public: }; struct Summary { - Summary(const std::string& prevClusterState, - const std::string& newClusterState, - uint32_t processingTime) - : _prevClusterState(prevClusterState), - _newClusterState(newClusterState), - _processingTime(processingTime) {}; + Summary(const std::string& prevClusterState, const std::string& newClusterState, uint32_t processingTime); + Summary(const Summary &); + Summary & operator = (const Summary &); + Summary(Summary &&) = default; + Summary & operator = (Summary &&) = default; + ~Summary(); std::string _prevClusterState; std::string _newClusterState; @@ -78,16 +78,18 @@ public: api::Timestamp creationTimestamp) { return std::unique_ptr( - new PendingClusterState(clock, clusterInfo, sender, - creationTimestamp)); + new PendingClusterState(clock, clusterInfo, sender, creationTimestamp)); } + PendingClusterState(const PendingClusterState &) = delete; + PendingClusterState & operator = (const PendingClusterState &) = delete; + ~PendingClusterState(); + /** * Adds the info from the reply to our list of information. * Returns true if the reply was accepted by this object, false if not. */ - bool onRequestBucketInfoReply( - const std::shared_ptr& reply); + bool onRequestBucketInfoReply(const std::shared_ptr& reply); /** * Tags the given node as having replied to the @@ -100,8 +102,7 @@ public: /** * Adds info from a node to our list of information. */ - void addNodeInfo(const document::BucketId& id, - const BucketCopy& copy); + void addNodeInfo(const document::BucketId& id, const BucketCopy& copy); /** Called to resend delayed resends due to failures. */ void resendDelayedMessages(); @@ -145,9 +146,7 @@ public: * Merges all the results with the given bucket database. */ void mergeInto(BucketDatabase& db); - - bool process(BucketDatabase::Entry& e); - + bool process(BucketDatabase::Entry& e) override; const EntryList& results() const { return _entries; } /** @@ -155,9 +154,7 @@ public: * change rather than an actual state change. */ bool distributionChange() const { return _distributionChange; } - - virtual void printXml(vespalib::XmlOutputStream&) const; - + void printXml(vespalib::XmlOutputStream&) const override; Summary getSummary() const; private: @@ -184,41 +181,26 @@ private: api::Timestamp creationTimestamp); void logConstructionInformation() const; - void requestNode(uint16_t node); - - bool distributorChanged(const lib::ClusterState& oldState, - const lib::ClusterState& newState); - + bool distributorChanged(const lib::ClusterState& oldState, const lib::ClusterState& newState); bool storageNodeMayHaveLostData(uint16_t index); bool storageNodeChanged(uint16_t index); - void markAllAvailableNodesAsRequiringRequest(); - - void addAdditionalNodesToOutdatedSet( - const std::unordered_set& nodes); - + void addAdditionalNodesToOutdatedSet(const std::unordered_set& nodes); void updateSetOfNodesThatAreOutdated(); - void requestNodes(); - void requestBucketInfoFromStorageNodesWithChangedState(); /** * Number of nodes with node type 'storage' in _newClusterState. */ uint16_t newStateStorageNodeCount() const; - bool shouldRequestBucketInfo() const; bool clusterIsDown() const; bool iAmDown() const; - bool nodeInSameGroupAsSelf(uint16_t index) const; - bool nodeNeedsOwnershipTransferFromGroupDown( - uint16_t nodeIndex, - const lib::ClusterState& state) const; - bool nodeWasUpButNowIsDown(const lib::State& old, - const lib::State& nw) const; + bool nodeNeedsOwnershipTransferFromGroupDown(uint16_t nodeIndex, const lib::ClusterState& state) const; + bool nodeWasUpButNowIsDown(const lib::State& old, const lib::State& nw) const; typedef std::pair Range; @@ -232,23 +214,17 @@ private: void insertInfo(BucketDatabase::Entry& info, const Range& range); void addToBucketDB(BucketDatabase& db, const Range& range); - std::vector getCopiesThatAreNewOrAltered( - BucketDatabase::Entry& info, - const Range& range); + std::vector getCopiesThatAreNewOrAltered(BucketDatabase::Entry& info, const Range& range); std::string requestNodesToString(); // Returns whether at least one replica was removed from the entry. // Does NOT implicitly update trusted status on remaining replicas; caller must do // this explicitly. - bool removeCopiesFromNodesThatWereRequested( - BucketDatabase::Entry& e, - const document::BucketId& bucketId); + bool removeCopiesFromNodesThatWereRequested(BucketDatabase::Entry& e, const document::BucketId& bucketId); - bool databaseIteratorHasPassedBucketInfoIterator( - const document::BucketId& bucketId) const; - bool bucketInfoIteratorPointsToBucket( - const document::BucketId& bucketId) const; + bool databaseIteratorHasPassedBucketInfoIterator(const document::BucketId& bucketId) const; + bool bucketInfoIteratorPointsToBucket(const document::BucketId& bucketId) const; bool nodeIsOutdated(uint16_t node) const { return (_outdatedNodes.find(node) != _outdatedNodes.end()); @@ -289,7 +265,3 @@ private: }; } - -} - - diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp index a34adb2336c..0c1d4abf0d8 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "pendingmessagetracker.h" #include #include -#include - #include +#include LOG_SETUP(".pendingmessages"); namespace storage { diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.h b/storage/src/vespa/storage/distributor/pendingmessagetracker.h index 40415a80e53..a234ab683b3 100644 --- a/storage/src/vespa/storage/distributor/pendingmessagetracker.h +++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.h @@ -1,11 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include +#include "nodeinfo.h" +#include "latency_statistics_provider.h" #include #include +#include +#include +#include +#include #include #include #include @@ -13,10 +16,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -62,14 +61,10 @@ public: ~PendingMessageTracker(); void insert(const std::shared_ptr&); - document::BucketId reply(const api::StorageReply& reply); + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const; - - void print(std::ostream& out, - bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const; /** * Goes through each pending message for the given node+bucket pair, @@ -241,14 +236,10 @@ private: void getStatusStartPage(std::ostream& out) const; - void getStatusPerNode(std::ostream& out) const; - void getStatusPerBucket(std::ostream& out) const; - TimePoint currentTime() const; }; } } - diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp index 4ea765a2d4a..90dd838f9eb 100644 --- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp +++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp @@ -1,16 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include + +#include "persistencemessagetracker.h" #include #include +#include -LOG_SETUP(".persistencemessagetracker"); +#include -namespace storage { +LOG_SETUP(".persistencemessagetracker"); -namespace distributor { +namespace storage::distributor { PersistenceMessageTrackerImpl::PersistenceMessageTrackerImpl( PersistenceOperationMetricSet& metric, @@ -28,6 +27,8 @@ PersistenceMessageTrackerImpl::PersistenceMessageTrackerImpl( { } +PersistenceMessageTrackerImpl::~PersistenceMessageTrackerImpl() {} + void PersistenceMessageTrackerImpl::updateDB() { @@ -353,5 +354,3 @@ PersistenceMessageTrackerImpl::updateFromReply( } } - -} diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.h b/storage/src/vespa/storage/distributor/persistencemessagetracker.h index 06c8bd1135c..f174ecc65b8 100644 --- a/storage/src/vespa/storage/distributor/persistencemessagetracker.h +++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.h @@ -1,16 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include +#include "distributormetricsset.h" +#include "distributorcomponent.h" +#include "messagetracker.h" #include #include -namespace storage { - -namespace distributor { +namespace storage::distributor { struct PersistenceMessageTracker { virtual ~PersistenceMessageTracker() { } @@ -20,9 +18,7 @@ struct PersistenceMessageTracker { virtual void queueMessageBatch(const std::vector&) = 0; virtual uint16_t receiveReply(MessageSender&, api::BucketInfoReply&) = 0; virtual std::shared_ptr& getReply() = 0; - virtual void updateFromReply(MessageSender&, api::BucketInfoReply&, - uint16_t node) = 0; - + virtual void updateFromReply(MessageSender&, api::BucketInfoReply&, uint16_t node) = 0; virtual void queueCommand(api::BucketCommand::SP, uint16_t target) = 0; virtual void flushQueue(MessageSender&) = 0; virtual uint16_t handleReply(api::BucketReply& reply) = 0; @@ -41,23 +37,19 @@ public: std::shared_ptr reply, DistributorComponent&, api::Timestamp revertTimestamp = 0); + ~PersistenceMessageTrackerImpl(); void updateDB(); - void updateMetrics(); - bool success() const { return _success; } - - void fail(MessageSender& sender, const api::ReturnCode& result); + void fail(MessageSender& sender, const api::ReturnCode& result) override; /** Returns the node the reply was from. */ - uint16_t receiveReply(MessageSender& sender, api::BucketInfoReply& reply); - - void updateFromReply(MessageSender& sender, api::BucketInfoReply& reply, uint16_t node); - - std::shared_ptr& getReply() { return _reply; } + uint16_t receiveReply(MessageSender& sender, api::BucketInfoReply& reply) override; + void updateFromReply(MessageSender& sender, api::BucketInfoReply& reply, uint16_t node) override; + std::shared_ptr& getReply() override { return _reply; } typedef std::pair BucketNodePair; @@ -69,7 +61,7 @@ public: have at most (messages.size() - initial redundancy) messages left in the queue and have it's first message be done. */ - void queueMessageBatch(const std::vector& messages); + void queueMessageBatch(const std::vector& messages) override; private: typedef std::vector MessageBatch; @@ -86,33 +78,21 @@ private: bool _success; bool canSendReplyEarly() const; - void addBucketInfoFromReply(uint16_t node, - const api::BucketInfoReply& reply); - void logSuccessfulReply(uint16_t node, - const api::BucketInfoReply& reply) const; - bool hasSentReply() const { - return _reply.get() == 0; - } + void addBucketInfoFromReply(uint16_t node, const api::BucketInfoReply& reply); + void logSuccessfulReply(uint16_t node, const api::BucketInfoReply& reply) const; + bool hasSentReply() const { return _reply.get() == 0; } bool shouldRevert() const; void sendReply(MessageSender& sender); void checkCopiesDeleted(); void updateFailureResult(const api::BucketInfoReply& reply); - void handleCreateBucketReply( - api::BucketInfoReply& reply, - uint16_t node); - void handlePersistenceReply( - api::BucketInfoReply& reply, - uint16_t node); - - virtual void queueCommand(std::shared_ptr msg, - uint16_t target) - { MessageTracker::queueCommand(msg, target); } - virtual void flushQueue(MessageSender& s) { MessageTracker::flushQueue(s); } - virtual uint16_t handleReply(api::BucketReply& r) - { return MessageTracker::handleReply(r); } -}; + void handleCreateBucketReply(api::BucketInfoReply& reply, uint16_t node); + void handlePersistenceReply(api::BucketInfoReply& reply, uint16_t node); -} + void queueCommand(std::shared_ptr msg, uint16_t target) override { + MessageTracker::queueCommand(msg, target); + } + void flushQueue(MessageSender& s) override { MessageTracker::flushQueue(s); } + uint16_t handleReply(api::BucketReply& r) override { return MessageTracker::handleReply(r); } +}; } - diff --git a/storage/src/vespa/storage/distributor/simpleclusterinformation.h b/storage/src/vespa/storage/distributor/simpleclusterinformation.h index 8d68417ea2d..d53285671ce 100644 --- a/storage/src/vespa/storage/distributor/simpleclusterinformation.h +++ b/storage/src/vespa/storage/distributor/simpleclusterinformation.h @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "clusterinformation.h" #include #include -namespace storage { -namespace distributor { +namespace storage::distributor { class SimpleClusterInformation : public ClusterInformation { @@ -21,19 +20,19 @@ public: _storageUpStates(storageUpStates) {} - uint16_t getDistributorIndex() const { + uint16_t getDistributorIndex() const override { return _myIndex; } - const lib::Distribution& getDistribution() const { + const lib::Distribution& getDistribution() const override { return _distribution; } - const lib::ClusterState& getClusterState() const { + const lib::ClusterState& getClusterState() const override { return _clusterState; } - const char* getStorageUpStates() const { + const char* getStorageUpStates() const override { return _storageUpStates; } @@ -45,5 +44,3 @@ private: }; } -} - diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index d257663e261..9c7f5b5d1b5 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -1,16 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -#include -#include - -#include +#include "statechecker.h" +#include "distributorcomponent.h" +#include LOG_SETUP(".distributor.statechecker"); -namespace storage { - -namespace distributor { +namespace storage::distributor { namespace { @@ -83,6 +78,8 @@ StateChecker::Context::Context(const DistributorComponent& c, unorderedIdealState.insert(idealState.begin(), idealState.end()); } +StateChecker::Context::~Context() {} + std::string StateChecker::Context::toString() const { @@ -109,5 +106,3 @@ StateChecker::~StateChecker() } } - -} diff --git a/storage/src/vespa/storage/distributor/statechecker.h b/storage/src/vespa/storage/distributor/statechecker.h index 9a40b6bbdcd..4e1cbf2a258 100644 --- a/storage/src/vespa/storage/distributor/statechecker.h +++ b/storage/src/vespa/storage/distributor/statechecker.h @@ -1,14 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "bucketgctimecalculator.h" +#include "maintenancebucket.h" #include +#include +#include #include #include -#include -#include -#include - #include #include #include @@ -48,6 +47,10 @@ public: Context(const DistributorComponent&, NodeMaintenanceStatsTracker&, const document::BucketId& bid); + ~Context(); + Context(const Context &) = delete; + Context & operator =(const Context &) = delete; + // Per bucket document::BucketId bucketId; @@ -86,11 +89,8 @@ public: { public: virtual ~ResultImpl() {} - virtual IdealStateOperation::UP createOperation() = 0; - virtual MaintenancePriority getPriority() const = 0; - virtual MaintenanceOperation::Type getType() const = 0; }; diff --git a/storage/src/vespa/storage/distributor/throttlingoperationstarter.cpp b/storage/src/vespa/storage/distributor/throttlingoperationstarter.cpp index b7fcd6ffc9d..54f9bc71bef 100644 --- a/storage/src/vespa/storage/distributor/throttlingoperationstarter.cpp +++ b/storage/src/vespa/storage/distributor/throttlingoperationstarter.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "throttlingoperationstarter.h" -namespace storage { -namespace distributor { +namespace storage::distributor { ThrottlingOperationStarter::ThrottlingOperation::~ThrottlingOperation() { @@ -42,4 +40,3 @@ ThrottlingOperationStarter::signalOperationFinished(const Operation& op) } } -} diff --git a/storage/src/vespa/storage/distributor/throttlingoperationstarter.h b/storage/src/vespa/storage/distributor/throttlingoperationstarter.h index 711534d64dd..51c6450247c 100644 --- a/storage/src/vespa/storage/distributor/throttlingoperationstarter.h +++ b/storage/src/vespa/storage/distributor/throttlingoperationstarter.h @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include +#include "operationstarter.h" #include -namespace storage { -namespace distributor { +namespace storage::distributor { class ThrottlingOperationStarter : public OperationStarter { @@ -26,39 +25,34 @@ class ThrottlingOperationStarter : public OperationStarter ThrottlingOperation(const ThrottlingOperation&); ThrottlingOperation& operator=(const ThrottlingOperation&); - virtual void onClose(DistributorMessageSender& sender) { + void onClose(DistributorMessageSender& sender) override { _operation->onClose(sender); } - virtual const char* getName() const { + const char* getName() const override { return _operation->getName(); } - virtual std::string getStatus() const { + std::string getStatus() const override { return _operation->getStatus(); } - virtual std::string toString() const { + std::string toString() const override { return _operation->toString(); } - virtual void start(DistributorMessageSender& sender, - framework::MilliSecTime startTime) - { + void start(DistributorMessageSender& sender, framework::MilliSecTime startTime) override { _operation->start(sender, startTime); } - virtual void receive(DistributorMessageSender& sender, - const std::shared_ptr & msg) - { + void receive(DistributorMessageSender& sender, const std::shared_ptr & msg) override { _operation->receive(sender, msg); } framework::MilliSecTime getStartTime() const { return _operation->getStartTime(); } - virtual void onStart(DistributorMessageSender&) { + void onStart(DistributorMessageSender&) override { // Should never be called directly on the throttled operation // instance, but rather on its wrapped implementation. assert(false); } - virtual void onReceive(DistributorMessageSender&, - const std::shared_ptr&) - { + void onReceive(DistributorMessageSender&, + const std::shared_ptr&) override { assert(false); } }; @@ -72,11 +66,9 @@ public: _pendingCount(0) {} - virtual bool start(const std::shared_ptr& operation, - Priority priority); + bool start(const std::shared_ptr& operation, Priority priority) override; - bool canStart(uint32_t currentOperationCount, - Priority priority) const; + bool canStart(uint32_t currentOperationCount, Priority priority) const; void setMaxPendingRange(uint32_t minPending, uint32_t maxPending) { _minPending = minPending; @@ -96,5 +88,3 @@ private: }; } -} - diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp b/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp index 5fe9c528709..96811477fce 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.cpp @@ -13,8 +13,9 @@ MergeStatus::MergeStatus(framework::Clock& clock, const metrics::LoadType& lt, : reply(), nodeList(), maxTimestamp(0), diff(), pendingId(0), pendingGetDiff(), pendingApplyDiff(), timeout(0), startTime(clock), context(lt, priority, traceLevel) -{ -} +{} + +MergeStatus::~MergeStatus() {} bool MergeStatus::removeFromDiff( diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h index e094393569b..c5d2dcae65c 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h @@ -29,6 +29,7 @@ public: spi::Context context; MergeStatus(framework::Clock&, const metrics::LoadType&, api::StorageMessage::Priority, uint32_t traceLevel); + ~MergeStatus(); /** * @return true if any entries were removed from the internal diff diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h index b4cf14413f4..5ead1ec8472 100644 --- a/storage/src/vespa/storage/persistence/messages.h +++ b/storage/src/vespa/storage/persistence/messages.h @@ -1,15 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include +#include #include #include #include #include #include +#include + namespace storage { diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index 369f2d1cf84..c2b9a438967 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -2,6 +2,7 @@ #include "communicationmanager.h" #include "fnetlistener.h" #include "rpcrequestwrapper.h" +#include #include #include #include diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 3cae63d3586..ab7ffcf936c 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -10,25 +10,19 @@ #pragma once -#include #include "communicationmanagermetrics.h" #include "messageallocationtypes.h" #include "documentapiconverter.h" #include +#include #include #include -#include -#include -#include #include #include #include -#include #include #include -#include #include -#include #include namespace storage { diff --git a/storage/src/vespa/storage/storageserver/documentapiconverter.h b/storage/src/vespa/storage/storageserver/documentapiconverter.h index 96d10c8bbad..bd620f58dc0 100644 --- a/storage/src/vespa/storage/storageserver/documentapiconverter.h +++ b/storage/src/vespa/storage/storageserver/documentapiconverter.h @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include -#include +#include "priorityconverter.h" #include #include +#include +#include +#include namespace storage { diff --git a/storage/src/vespa/storage/storageserver/fnetlistener.cpp b/storage/src/vespa/storage/storageserver/fnetlistener.cpp index df227ce5292..2c557ba8614 100644 --- a/storage/src/vespa/storage/storageserver/fnetlistener.cpp +++ b/storage/src/vespa/storage/storageserver/fnetlistener.cpp @@ -12,9 +12,7 @@ LOG_SETUP(".rpc.listener"); namespace storage { - -FNetListener::FNetListener( - CommunicationManager& comManager, const config::ConfigUri & configUri, uint32_t port) +FNetListener::FNetListener(CommunicationManager& comManager, const config::ConfigUri & configUri, uint32_t port) : _comManager(comManager), _orb(), _closed(false), @@ -176,6 +174,4 @@ FNetListener::RPC_setSystemState2(FRT_RPCRequest *req) _comManager.enqueue(cmd); } - - } diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.h b/storage/src/vespa/storage/storageserver/mergethrottler.h index 74ffe095d7c..03662cfadee 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.h +++ b/storage/src/vespa/storage/storageserver/mergethrottler.h @@ -7,14 +7,14 @@ */ #pragma once -#include #include #include +#include #include #include #include -#include #include +#include #include #include #include diff --git a/storage/src/vespa/storage/storageserver/messagesink.cpp b/storage/src/vespa/storage/storageserver/messagesink.cpp index 617b81102c4..0df24ef3536 100644 --- a/storage/src/vespa/storage/storageserver/messagesink.cpp +++ b/storage/src/vespa/storage/storageserver/messagesink.cpp @@ -1,12 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include - +#include "messagesink.h" #include -#include - -LOG_SETUP(".message.sink"); using std::shared_ptr; diff --git a/storage/src/vespa/storage/storageserver/messagesink.h b/storage/src/vespa/storage/storageserver/messagesink.h index 80a39e19538..85e8a253942 100644 --- a/storage/src/vespa/storage/storageserver/messagesink.h +++ b/storage/src/vespa/storage/storageserver/messagesink.h @@ -10,22 +10,18 @@ #pragma once -#include #include namespace storage { class MessageSink : public StorageLink { -private: - MessageSink(const MessageSink &); - MessageSink& operator=(const MessageSink &); - public: explicit MessageSink(); + MessageSink(const MessageSink &) = delete; + MessageSink& operator=(const MessageSink &) = delete; ~MessageSink(); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: DEF_MSG_COMMAND_H(Get); @@ -35,4 +31,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/storageserver/opslogger.h b/storage/src/vespa/storage/storageserver/opslogger.h index 905c0fd4e85..7a3689c896b 100644 --- a/storage/src/vespa/storage/storageserver/opslogger.h +++ b/storage/src/vespa/storage/storageserver/opslogger.h @@ -9,8 +9,7 @@ #pragma once #include -#include - +#include #include #include #include diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.h b/storage/src/vespa/storage/storageserver/priorityconverter.h index 62e476606bc..c0aaf3aceea 100644 --- a/storage/src/vespa/storage/storageserver/priorityconverter.h +++ b/storage/src/vespa/storage/storageserver/priorityconverter.h @@ -4,9 +4,9 @@ #include #include +#include #include #include -#include namespace storage { diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h index 974b8ca2393..bfe0418c929 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.h +++ b/storage/src/vespa/storage/storageserver/statemanager.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/storage/src/vespa/storage/storageutil/graph.cpp b/storage/src/vespa/storage/storageutil/graph.cpp index b1b748ffd84..b4d4bc81b71 100644 --- a/storage/src/vespa/storage/storageutil/graph.cpp +++ b/storage/src/vespa/storage/storageutil/graph.cpp @@ -1,14 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include - -#include -#include +#include "graph.h" #include +#include namespace storage { +Graph::Entry::Entry(const std::vector& v, const std::string& name, int32_t col) + : points(v), + _name(name), + _color(col) +{} + + Graph::Entry::~Entry() {} void Graph::printHtmlHeadAdditions(std::ostream& out, const std::string& indent) @@ -26,8 +30,9 @@ Graph::Graph(const std::string& name, ColorScheme cs) _rightPad(0), _topPad(0), _bottomPad(0) -{ -} +{} + +Graph::~Graph() {} void Graph::add(const std::vector& values, const std::string& name) diff --git a/storage/src/vespa/storage/storageutil/graph.h b/storage/src/vespa/storage/storageutil/graph.h index 2892f36031a..31036772326 100644 --- a/storage/src/vespa/storage/storageutil/graph.h +++ b/storage/src/vespa/storage/storageutil/graph.h @@ -41,8 +41,10 @@ public: std::string _name; int32_t _color; - Entry(const std::vector& v, const std::string& name, int32_t col) - : points(v), _name(name), _color(col) {} + Entry(const std::vector& v, const std::string& name, int32_t col); + Entry(Entry &&) = default; + Entry & operator = (Entry &&) = default; + ~Entry(); }; struct Axis { double value; @@ -69,6 +71,7 @@ private: public: Graph(const std::string&, ColorScheme = SCHEME_BLUE); + ~Graph(); void add(const std::vector&, const std::string& name); void add(const std::vector&, const std::string& name, Color c); diff --git a/storage/src/vespa/storage/storageutil/piechart.cpp b/storage/src/vespa/storage/storageutil/piechart.cpp index 63fe69bf944..bbda6cfc7f7 100644 --- a/storage/src/vespa/storage/storageutil/piechart.cpp +++ b/storage/src/vespa/storage/storageutil/piechart.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include +#include "piechart.h" #include -#include #include namespace storage { @@ -30,8 +28,9 @@ PieChart::PieChart(const std::string& name, ColorScheme cs) _values(), _colors(cs), _printLabels(true) -{ -} +{} + +PieChart::~PieChart() {} void PieChart::add(double value, const std::string& name) diff --git a/storage/src/vespa/storage/storageutil/piechart.h b/storage/src/vespa/storage/storageutil/piechart.h index 3f0e61a0966..de53cb22f26 100644 --- a/storage/src/vespa/storage/storageutil/piechart.h +++ b/storage/src/vespa/storage/storageutil/piechart.h @@ -50,6 +50,7 @@ private: public: PieChart(const std::string&, ColorScheme = SCHEME_BLUE); + ~PieChart(); void printLabels(bool doprint) { _printLabels = doprint; } diff --git a/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h b/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h index 4cd6b25b1fb..939135e4ea9 100644 --- a/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h +++ b/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h @@ -6,10 +6,10 @@ */ #pragma once +#include "visitormessagesession.h" +#include "visitorthread.h" +#include "visitor.h" #include -#include -#include -#include namespace documentapi { class DocumentMessage; @@ -33,19 +33,16 @@ public: _sourceSession = std::move(sourceSession); } - virtual mbus::Result send(std::unique_ptr msg) { + mbus::Result send(std::unique_ptr msg) override { msg->setRetryEnabled(false); return _sourceSession->send(std::move(msg)); } - /** - @return Returns the number of pending messages this session has. - */ - virtual uint32_t pending() { + uint32_t pending() override { return _sourceSession->getPendingCount(); } - virtual void handleReply(mbus::Reply::UP reply) { + void handleReply(mbus::Reply::UP reply) override { _visitorThread.handleMessageBusReply(std::move(reply), _visitor); } @@ -56,4 +53,3 @@ private: }; } // storage - -- cgit v1.2.3