diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-05 20:59:01 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-23 13:31:24 +0200 |
commit | 40bddbaac34ece542a057aa97eb63db6f1c5775e (patch) | |
tree | 5de3547eee329ed1b064722a697d2cda9eb53476 | |
parent | b57308e4a134fb6139d2cb52a031d3e7185f16cf (diff) |
Including storage now builds fine with override enforcement.
192 files changed, 940 insertions, 1881 deletions
diff --git a/config/src/vespa/config/helper/ifetchercallback.h b/config/src/vespa/config/helper/ifetchercallback.h index 9bc6e848827..50c26f2d3fc 100644 --- a/config/src/vespa/config/helper/ifetchercallback.h +++ b/config/src/vespa/config/helper/ifetchercallback.h @@ -26,14 +26,11 @@ public: template <typename ConfigType> class IFetcherCallback : public ICallback { -public: - virtual ~IFetcherCallback() { } protected: - virtual void configure(std::unique_ptr<const ConfigInstance> config) override { + void configure(std::unique_ptr<const ConfigInstance> config) override { configure(std::unique_ptr<ConfigType>(static_cast<const ConfigType *>(config.release()))); } virtual void configure(std::unique_ptr<ConfigType> config) = 0; }; } // namespace config - diff --git a/documentapi/src/tests/loadtypes/testrunner.cpp b/documentapi/src/tests/loadtypes/testrunner.cpp index 71200f84224..bdcdcdab944 100644 --- a/documentapi/src/tests/loadtypes/testrunner.cpp +++ b/documentapi/src/tests/loadtypes/testrunner.cpp @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storagecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/documentapi/src/tests/policies/testframe.cpp b/documentapi/src/tests/policies/testframe.cpp index 8d5b6585529..db8a1b48924 100644 --- a/documentapi/src/tests/policies/testframe.cpp +++ b/documentapi/src/tests/policies/testframe.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".testframe"); #include "testframe.h" #include <vespa/messagebus/emptyreply.h> @@ -11,6 +8,9 @@ LOG_SETUP(".testframe"); #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/testlib/simplereply.h> +#include <vespa/log/log.h> +LOG_SETUP(".testframe"); + using document::DocumentTypeRepo; using namespace documentapi; diff --git a/documentapi/src/tests/policies/testframe.h b/documentapi/src/tests/policies/testframe.h index e0780733331..f0e37d979f3 100644 --- a/documentapi/src/tests/policies/testframe.h +++ b/documentapi/src/tests/policies/testframe.h @@ -197,8 +197,6 @@ public: * @return Handle to the system state. */ documentapi::SystemStateHandle getSystemState(); - - // Implements IReplyHandler. void handleReply(mbus::Reply::UP reply) override; }; diff --git a/documentapi/src/tests/replymerger/replymerger_test.cpp b/documentapi/src/tests/replymerger/replymerger_test.cpp index 8803994b0cf..b26290e0bcd 100644 --- a/documentapi/src/tests/replymerger/replymerger_test.cpp +++ b/documentapi/src/tests/replymerger/replymerger_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("replymerger_test"); -#include <vespa/fastos/fastos.h> #include <iostream> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/documentapi/messagebus/replymerger.h> diff --git a/documentapi/src/tests/routablefactory/routablefactory.cpp b/documentapi/src/tests/routablefactory/routablefactory.cpp index 620142e803b..b4449891af2 100644 --- a/documentapi/src/tests/routablefactory/routablefactory.cpp +++ b/documentapi/src/tests/routablefactory/routablefactory.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/routablefactories51.h> diff --git a/documentapi/src/tests/systemstate/systemstate.cpp b/documentapi/src/tests/systemstate/systemstate.cpp index a797f55c625..e3163937a3f 100644 --- a/documentapi/src/tests/systemstate/systemstate.cpp +++ b/documentapi/src/tests/systemstate/systemstate.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("systemstate_test"); #include <vespa/documentapi/messagebus/systemstate/systemstate.h> #include <vespa/documentapi/messagebus/systemstate/systemstatehandle.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("systemstate_test"); + using namespace documentapi; class Test : public vespalib::TestApp { diff --git a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h index b35cce81b40..e1c2b7f4f35 100644 --- a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h +++ b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h @@ -303,17 +303,9 @@ public: * @return The system state. */ SystemState &getSystemState() { return *_systemState; } - - // Implements IProtocol. const mbus::string &getName() const override { return NAME; } - - // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string &name, const mbus::string ¶m) const override; - - // Implements IProtocol. mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const override; - - // Implements IProtocol. mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef data) const override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h index b4adf41ca79..2887c8435e1 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h @@ -82,7 +82,6 @@ public: _approxSize = approxSize; } - // Implements mbus::Message. const mbus::string& getProtocol() const override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h index 2850c412807..69563bcc63b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h @@ -32,7 +32,7 @@ public: /** * Virtual destructor required for inheritance. */ - virtual ~DocumentReply() { } + ~DocumentReply() { } /** * Returns the priority tag for this message. This is an optional tag added for VDS that is not interpreted by the @@ -41,7 +41,6 @@ public: * @return The priority. */ Priority::Value getPriority() const { return _priority; } - uint8_t priority() const override { return (uint8_t)_priority; } /** @@ -50,13 +49,8 @@ public: * @param priority The priority to set. */ void setPriority(Priority::Value p) { _priority = p; } - - // Implements mbus::Reply. const mbus::string& getProtocol() const override; - - // Implements mbus::Reply. uint32_t getType() const override { return _type; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h index ac5e141da23..0c9c8b09a0c 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h @@ -1,8 +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 "visitor.h" #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> namespace documentapi { @@ -30,15 +30,9 @@ public: * @param summary The document summary to contain. */ DocumentSummaryMessage(const vdslib::DocumentSummary &summary); - - // Overrides VisitorMessage. uint32_t getApproxSize() const override; - - // Implements VisitorMessage. uint32_t getType() const override; - string toString() const override { return "documentsummarymessage"; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h index 54ce4e8de4c..bd1805a4a17 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h @@ -1,8 +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 "visitor.h" #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> namespace documentapi { @@ -21,18 +21,14 @@ protected: public: EmptyBucketsMessage(); // must be serialized into - EmptyBucketsMessage(const std::vector<document::BucketId> &bucketIds); std::vector<document::BucketId> &getBucketIds() { return _bucketIds; } const std::vector<document::BucketId> &getBucketIds() const { return _bucketIds; } void setBucketIds(const std::vector<document::BucketId> &bucketIds); - void resize(uint32_t size); - uint32_t getType() const override; - string toString() const override { return "emptybucketsmessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h index c08e36aa3fd..2e1e92652d9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h @@ -40,18 +40,10 @@ public: * @param id The bucket id to set. */ void setBucketId(const document::BucketId& id) { _bucketId = id; } - - // Overrides DocumentMessage. bool hasSequenceId() const override; - - // Overrides DocumentMessage. uint64_t getSequenceId() const override; - - // Implements DocumentMessage. uint32_t getType() const override; - string toString() const override { return "getbucketlistmessage"; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h index a207ef206e4..0b7df089bce 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.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 <vespa/documentapi/messagebus/messages/documentreply.h> +#include "documentreply.h" #include <vespa/document/bucket/bucketid.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h index ed27ed11212..62129a79003 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h @@ -1,8 +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 "documentmessage.h" #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/documentmessage.h> namespace documentapi { @@ -40,16 +40,9 @@ public: * @param bucket The bucket id to set. */ void setBucketId(document::BucketId bucket) { _bucket = bucket; } - - // Overrides DocumentMessage. bool hasSequenceId() const override; - - // Overrides DocumentMessage. uint64_t getSequenceId() const override; - - // Implements DocumentMessage. uint32_t getType() const override; - string toString() const override { return "getbucketstatemessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h index ac78aea6251..4c6f8bf9de7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.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 "visitor.h" +#include "documentreply.h" #include <vespa/vdslib/container/parameters.h> #include <vespa/vdslib/container/documentlist.h> #include <vespa/vdslib/container/operationlist.h> #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/documentprotocol.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h index 46af0dfb7a4..4537da0fb6e 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h @@ -1,8 +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 "testandsetmessage.h" #include <vespa/document/fieldvalue/document.h> -#include <vespa/documentapi/messagebus/messages/testandsetmessage.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h index 3904cf0f243..a47e35f3098 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h @@ -1,8 +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 "testandsetmessage.h" #include <vespa/document/base/documentid.h> -#include <vespa/documentapi/messagebus/messages/testandsetmessage.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h index acaf3357d4d..ce15fe4eda0 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.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 <vespa/documentapi/messagebus/messages/documentmessage.h> +#include "documentmessage.h" #include <vespa/document/bucket/bucketid.h> #include <vespa/document/bucket/bucketselector.h> #include <vespa/document/select/parser.h> @@ -17,13 +17,9 @@ public: RemoveLocationMessage(const document::BucketIdFactory& factory, document::select::Parser& parser, const string& documentSelection); const string& getDocumentSelection() const { return _documentSelection; } - - uint32_t getType() const override; - const document::BucketId& getBucketId() const { return _bucketId; }; - + uint32_t getType() const override; string toString() const override { return "removelocationmessage"; } - protected: DocumentReply::UP doCreateReply() const override; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h index 43045fd44c6..ce30be3ecc2 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h @@ -1,20 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @file persistence.h - * - * Persistence related commands, like put, get & remove - */ + #pragma once +#include "writedocumentreply.h" +#include "documentmessage.h" +#include "documentreply.h" #include <vespa/vdslib/container/parameters.h> #include <vespa/vdslib/container/documentlist.h> #include <vespa/vdslib/container/visitorstatistics.h> #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/documentmessage.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/document/select/orderingspecification.h> -#include <vespa/documentapi/messagebus/messages/writedocumentreply.h> namespace documentapi { @@ -139,14 +135,12 @@ public: typedef std::unique_ptr<DestroyVisitorMessage> UP; DestroyVisitorMessage(); // must be deserialized into - DestroyVisitorMessage(const string &instanceId); const string& getInstanceId() const { return _instanceId; } void setInstanceId(const string& id) { _instanceId = id; } uint32_t getType() const override; - string toString() const override { return "destroyvisitormessage"; } }; @@ -214,7 +208,6 @@ public: void setErrorMessage(const string& errorMessage) { _errorMessage = errorMessage; }; uint32_t getType() const override; - string toString() const override { return "visitorinfomessage"; } }; @@ -241,7 +234,6 @@ public: uint32_t getApproxSize() const override; uint32_t getType() const override; - string toString() const override { return "mapvisitormessage"; } }; @@ -256,12 +248,9 @@ public: class Entry { public: Entry(); - Entry(int64_t timestamp, - document::Document::SP doc, - bool removeEntry); + Entry(int64_t timestamp, document::Document::SP doc, bool removeEntry); Entry(const Entry& other); - Entry(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buf); + Entry(const document::DocumentTypeRepo &repo, document::ByteBuffer& buf); int64_t getTimestamp() { return _timestamp; } const document::Document::SP& getDocument() { return _document; } @@ -293,7 +282,6 @@ public: const std::vector<Entry>& getDocuments() const { return _documents; }; uint32_t getType() const override; - string toString() const override { return "documentlistmessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h index 0edba2c0872..a5dc1872e44 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vector> #include <vespa/messagebus/routing/hop.h> #include <vespa/messagebus/routing/iroutingpolicy.h> #include <vespa/documentapi/common.h> @@ -26,19 +25,9 @@ public: * @param param A string of recipients to select unless recipients have been configured. */ ANDPolicy(const string& param); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~ANDPolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~ANDPolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; private: ANDPolicy(const ANDPolicy &); // hide diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h index 2f901ebad2d..bf17a77ca6a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h @@ -10,7 +10,7 @@ class ContentPolicy : public StoragePolicy public: ContentPolicy(const string& param); private: - virtual string createConfigId(const string & clusterName) const override; + string createConfigId(const string & clusterName) const override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h index 678210b1416..362185576ff 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h @@ -1,11 +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 "config-documentrouteselectorpolicy.h" #include <vespa/document/select/node.h> #include <map> #include <vespa/messagebus/routing/iroutingpolicy.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/documentapi/messagebus/policies/config-documentrouteselectorpolicy.h> #include <vespa/documentapi/common.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> @@ -64,14 +64,8 @@ public: * @return The error string, or null if no error. */ const string &getError() const; - - // Implements Subscriber. void configure(std::unique_ptr<messagebus::protocol::DocumentrouteselectorpolicyConfig> cfg) override; - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h index 790e0ab923c..fddccb1e3d9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h @@ -22,11 +22,7 @@ public: * @param msg The message of the error to assign. */ ErrorPolicy(const string &msg); - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h index d1e01cdbe59..9dd400f69c3 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h @@ -51,13 +51,7 @@ public: * @param param The address to use for this, if empty this will resolve to hostname. */ ExternPolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~ExternPolicy(); + ~ExternPolicy(); /** * This is a safety mechanism to allow the constructor to fail and signal that it can not be used. @@ -74,11 +68,7 @@ public: * @return The mirror pointer. */ slobrok::api::IMirrorAPI &getMirror() { return *_mirror; } - - // Overrides IRoutingPolicy. void select(mbus::RoutingContext &ctx) override; - - // Overrides IRoutingPolicy. void merge(mbus::RoutingContext &ctx) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h index 6a2a673807f..825c4a85d35 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.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 <vespa/documentapi/messagebus/policies/asyncinitializationpolicy.h> +#include "asyncinitializationpolicy.h" #include <vespa/config-slobroks.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/slobrok/imirrorapi.h> @@ -29,20 +29,15 @@ protected: public: ExternSlobrokPolicy(const std::map<string, string>& params); - virtual ~ExternSlobrokPolicy(); + ~ExternSlobrokPolicy(); /** * @return a pointer to the slobrok mirror owned by this policy, if any. * If the policy uses the default mirror API, NULL is returned. */ const slobrok::api::IMirrorAPI* getMirror() const { return _mirror.get(); } - slobrok::api::IMirrorAPI::SpecList lookup(mbus::RoutingContext &context, const string& pattern); - - /** - * Initializes the policy - */ - virtual string init() override; + string init() override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h index 0541b784b1f..7b0e7e1f110 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h @@ -1,8 +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 <vespa/documentapi/messagebus/policies/loadbalancer.h> -#include <vespa/documentapi/messagebus/policies/externslobrokpolicy.h> +#include "loadbalancer.h" +#include "externslobrokpolicy.h" namespace documentapi { @@ -10,8 +10,7 @@ class LoadBalancerPolicy : public ExternSlobrokPolicy { public: LoadBalancerPolicy(const string& param); - - virtual void doSelect(mbus::RoutingContext &context) override; + void doSelect(mbus::RoutingContext &context) override; /** Finds the TCP address of the target docproc. @@ -22,7 +21,7 @@ public: return _loadBalancer->getRecipient(lookup(context, _pattern)); } - virtual void merge(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; private: string _pattern; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h index af63403a8b1..d471e3051c8 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h @@ -74,19 +74,9 @@ public: * @param param The address to use for this, if empty this will resolve to hostname. */ LocalServicePolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~LocalServicePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~LocalServicePolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp index f55967b1c09..4d260a8e81f 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp @@ -18,6 +18,8 @@ MessageTypePolicy::MessageTypePolicy(const config::ConfigUri & configUri) : _fetcher.start(); } +MessageTypePolicy::~MessageTypePolicy() {} + void MessageTypePolicy::configure(std::unique_ptr<MessagetyperouteselectorpolicyConfig> cfg) { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h index d29439db50c..d9a324a79c5 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h @@ -43,16 +43,10 @@ public: * @param configUri The configuration uri to subscribe with. */ MessageTypePolicy(const config::ConfigUri & configUri); - - // Implements Subscriber. + ~MessageTypePolicy(); void configure(std::unique_ptr<vespa::config::content::MessagetyperouteselectorpolicyConfig> cfg) override; - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h index 3a3a22090f9..a14c2afdbc7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h @@ -61,19 +61,9 @@ public: * in slobrok. */ RoundRobinPolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~RoundRobinPolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~RoundRobinPolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h index ef6478e368a..c73c4c8560d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h @@ -39,13 +39,9 @@ private: public: StoragePolicy(const string& param); - virtual ~StoragePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void doSelect(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~StoragePolicy(); + void doSelect(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; void updateStateFromReply(WrongDistributionReply& reply); @@ -56,7 +52,6 @@ public: const storage::lib::ClusterState* getSystemState() const { return _state.get(); } virtual void configure(std::unique_ptr<storage::lib::Distribution::DistributionConfig> config); - string init() override; private: diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h index 49724785361..4d6dadb7156 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h @@ -65,20 +65,9 @@ public: * @param param The number of services to include in the set. */ SubsetServicePolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~SubsetServicePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~SubsetServicePolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h index aed43b8b2e5..c715792f263 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h @@ -99,11 +99,7 @@ public: */ typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -143,10 +139,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -180,8 +173,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - BatchDocumentUpdateMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + BatchDocumentUpdateMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class BatchDocumentUpdateReplyFactory : public DocumentReplyFactory { protected: @@ -194,8 +186,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class CreateVisitorReplyFactory : public DocumentReplyFactory { protected: @@ -285,8 +276,7 @@ public: DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentReply &msg, vespalib::GrowableByteBuffer &buf) const override; public: - GetDocumentReplyFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + GetDocumentReplyFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class MapVisitorMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; @@ -294,8 +284,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - MapVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + MapVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class MapVisitorReplyFactory : public DocumentReplyFactory { protected: @@ -308,8 +297,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - MultiOperationMessageFactory(const document::DocumentTypeRepo::SP &r) - : _repo(r) {} + MultiOperationMessageFactory(const document::DocumentTypeRepo::SP &r) : _repo(r) {} }; class MultiOperationReplyFactory : public DocumentReplyFactory { protected: @@ -326,8 +314,7 @@ public: bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(PutDocumentMessage & msg, document::ByteBuffer & buf) const; - PutDocumentMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + PutDocumentMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class PutDocumentReplyFactory : public DocumentReplyFactory { protected: @@ -354,8 +341,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - RemoveLocationMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + RemoveLocationMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class RemoveLocationReplyFactory : public DocumentReplyFactory { protected: @@ -402,8 +388,7 @@ public: bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(UpdateDocumentMessage & msg, document::ByteBuffer & buf) const; - UpdateDocumentMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + UpdateDocumentMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class UpdateDocumentReplyFactory : public DocumentReplyFactory { protected: diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h index bfa25c21d84..429c86e5049 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h @@ -58,10 +58,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -101,10 +98,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -145,8 +139,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class GetDocumentMessageFactory : public DocumentMessageFactory { diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h index 906fc508bd7..a41ae155170 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h @@ -36,9 +36,7 @@ public: const document::DocumentTypeRepo &_repo; string _configId; public: - DocumentRouteSelectorPolicyFactory( - const document::DocumentTypeRepo &repo, - const string &configId); + DocumentRouteSelectorPolicyFactory(const document::DocumentTypeRepo &repo, const string &configId); mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class ExternPolicyFactory : public IRoutingPolicyFactory { @@ -68,4 +66,3 @@ public: }; } - diff --git a/messagebus/src/tests/context/context.cpp b/messagebus/src/tests/context/context.cpp index 5ad36df7c72..3ba19e8f858 100644 --- a/messagebus/src/tests/context/context.cpp +++ b/messagebus/src/tests/context/context.cpp @@ -27,7 +27,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/loadbalance/loadbalance.cpp b/messagebus/src/tests/loadbalance/loadbalance.cpp index 83ff4c042da..9e2a6e48d24 100644 --- a/messagebus/src/tests/loadbalance/loadbalance.cpp +++ b/messagebus/src/tests/loadbalance/loadbalance.cpp @@ -28,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { ++cnt; session->acknowledge(std::move(msg)); } diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index e80505b2e89..df6ca38dd0d 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -46,8 +46,8 @@ public: _destinationSession(0), _messageCounter(0) {} - virtual void handleMessage(Message::UP msg) override - { + void handleMessage(Message::UP msg) override + { SimpleMessage& simpleMsg(dynamic_cast<SimpleMessage&>(*msg)); LOG(spam, "Attempting to acquire lock for %s", simpleMsg.getValue().c_str()); diff --git a/messagebus/src/tests/messenger/messenger.cpp b/messagebus/src/tests/messenger/messenger.cpp index 5cf3625523f..7b2b75212ee 100644 --- a/messagebus/src/tests/messenger/messenger.cpp +++ b/messagebus/src/tests/messenger/messenger.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("messagebus_test"); #include <vespa/messagebus/messenger.h> #include <vespa/vespalib/util/barrier.h> diff --git a/messagebus/src/tests/oos/oos.cpp b/messagebus/src/tests/oos/oos.cpp index b19de4a94f8..dc224a1519c 100644 --- a/messagebus/src/tests/oos/oos.cpp +++ b/messagebus/src/tests/oos/oos.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("oos_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/errorcode.h> @@ -31,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/protocolrepository/protocolrepository.cpp b/messagebus/src/tests/protocolrepository/protocolrepository.cpp index cf1d77bdc7e..f9c971336c5 100644 --- a/messagebus/src/tests/protocolrepository/protocolrepository.cpp +++ b/messagebus/src/tests/protocolrepository/protocolrepository.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("protocolrepository_test"); #include <vespa/messagebus/protocolrepository.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/messagebus/src/tests/replygate/replygate.cpp b/messagebus/src/tests/replygate/replygate.cpp index d190f278be4..8f784495866 100644 --- a/messagebus/src/tests/replygate/replygate.cpp +++ b/messagebus/src/tests/replygate/replygate.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("replygate_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/imessagehandler.h> @@ -44,7 +41,7 @@ struct MySender : public IMessageHandler { // giving a sync reply here is against the API contract, but it is // ok for testing. - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { Reply::UP reply(new MyReply()); msg->swapState(*reply); IReplyHandler &handler = reply->getCallStack().pop(*reply); diff --git a/messagebus/src/tests/resender/resender.cpp b/messagebus/src/tests/resender/resender.cpp index dad8ef73e68..701ce20737c 100644 --- a/messagebus/src/tests/resender/resender.cpp +++ b/messagebus/src/tests/resender/resender.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("routing_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/result/result.cpp b/messagebus/src/tests/result/result.cpp index a404135d64c..963e44d1dda 100644 --- a/messagebus/src/tests/result/result.cpp +++ b/messagebus/src/tests/result/result.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("result_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/result.h> #include <vespa/messagebus/error.h> diff --git a/messagebus/src/tests/routablequeue/routablequeue.cpp b/messagebus/src/tests/routablequeue/routablequeue.cpp index a6bd66bd5df..3f014236440 100644 --- a/messagebus/src/tests/routablequeue/routablequeue.cpp +++ b/messagebus/src/tests/routablequeue/routablequeue.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("routablequeue_test"); #include <vespa/messagebus/routablequeue.h> #include <vespa/messagebus/testlib/simplemessage.h> @@ -16,8 +13,8 @@ private: static uint32_t _cnt; public: TestMessage(uint32_t id) : SimpleMessage(""), _id(id) { ++_cnt; } - virtual ~TestMessage() { --_cnt; } - virtual uint32_t getType() const override { return _id; } + ~TestMessage() { --_cnt; } + uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestMessage::_cnt = 0; @@ -28,8 +25,8 @@ private: static uint32_t _cnt; public: TestReply(uint32_t id) : SimpleReply(""), _id(id) { ++_cnt; } - virtual ~TestReply() { --_cnt; } - virtual uint32_t getType() const override { return _id; } + ~TestReply() { --_cnt; } + uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestReply::_cnt = 0; diff --git a/messagebus/src/tests/routeparser/routeparser.cpp b/messagebus/src/tests/routeparser/routeparser.cpp index a00cea825ba..fc000fe571b 100644 --- a/messagebus/src/tests/routeparser/routeparser.cpp +++ b/messagebus/src/tests/routeparser/routeparser.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("routeparser_test"); #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/routing/errordirective.h> @@ -16,6 +13,9 @@ LOG_SETUP("routeparser_test"); #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("routeparser_test"); + using namespace mbus; class Test : public vespalib::TestApp { diff --git a/messagebus/src/tests/routing/routing.cpp b/messagebus/src/tests/routing/routing.cpp index 506d003a8b7..8fd2c3951e4 100644 --- a/messagebus/src/tests/routing/routing.cpp +++ b/messagebus/src/tests/routing/routing.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/messagebus.h> @@ -15,8 +14,8 @@ #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/component/vtag.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP("routing_test"); using namespace mbus; @@ -414,12 +413,9 @@ private: public: MyPolicy(const MyPolicyFactory &parent) : _parent(parent) - { - // empty - } + {} - virtual void - select(RoutingContext &ctx) override + void select(RoutingContext &ctx) override { if (!_parent._selectRoute.empty()) { ctx.addChild(Route::parse(_parent._selectRoute)); @@ -433,9 +429,8 @@ public: throw TestException(); } } - - virtual void - merge(RoutingContext &ctx) override + + void merge(RoutingContext &ctx) override { if (_parent._mergeError != ErrorCode::NONE) { Reply::UP reply(new EmptyReply()); diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp index 6ee62b4d697..281cf782a6b 100644 --- a/messagebus/src/tests/routingcontext/routingcontext.cpp +++ b/messagebus/src/tests/routingcontext/routingcontext.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("routingcontext_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index bcac60d800a..5ab1e57f0d4 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("sendadapter_test"); #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/testlib/receptor.h> @@ -12,6 +9,9 @@ LOG_SETUP("sendadapter_test"); #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("sendadapter_test"); + using namespace mbus; //////////////////////////////////////////////////////////////////////////////// diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp index ec2d1374e9b..ea6261f0169 100644 --- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp +++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp @@ -1,10 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("serviceaddress_test"); #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/vstringfmt.h> +#include <vespa/messagebus/testlib/slobrok.h> +#include <vespa/messagebus/testlib/testserver.h> +#include <vespa/messagebus/testlib/receptor.h> +#include <vespa/messagebus/testlib/simplemessage.h> +#include <vespa/messagebus/testlib/simplereply.h> +#include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/sourcesession.h> #include <vespa/messagebus/intermediatesession.h> @@ -15,12 +17,7 @@ LOG_SETUP("serviceaddress_test"); #include <vespa/messagebus/routing/routingspec.h> #include <vespa/messagebus/network/rpcservice.h> #include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/messagebus/testlib/testserver.h> -#include <vespa/messagebus/testlib/receptor.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> +#include <vespa/vespalib/util/vstringfmt.h> using namespace mbus; diff --git a/messagebus/src/tests/servicepool/servicepool.cpp b/messagebus/src/tests/servicepool/servicepool.cpp index 8601cfa8fee..76c366930d9 100644 --- a/messagebus/src/tests/servicepool/servicepool.cpp +++ b/messagebus/src/tests/servicepool/servicepool.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("servicepool_test"); #include <vespa/messagebus/network/rpcnetwork.h> #include <vespa/messagebus/testlib/slobrok.h> diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp index 5f5fe847f57..1f6944adb9e 100644 --- a/messagebus/src/tests/shutdown/shutdown.cpp +++ b/messagebus/src/tests/shutdown/shutdown.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("shutdown_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sourcesession/sourcesession.cpp b/messagebus/src/tests/sourcesession/sourcesession.cpp index 24d99f5d44f..a7fde7f28e0 100644 --- a/messagebus/src/tests/sourcesession/sourcesession.cpp +++ b/messagebus/src/tests/sourcesession/sourcesession.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("sourcesession_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/error.h> @@ -34,7 +31,7 @@ struct DelayedHandler : public IMessageHandler ~DelayedHandler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { // this will block the transport thread in the server messagebus, // but that should be ok, as we only want to test the timing in the // client messagebus... diff --git a/messagebus/src/tests/targetpool/targetpool.cpp b/messagebus/src/tests/targetpool/targetpool.cpp index 30744e74202..dda44765ba6 100644 --- a/messagebus/src/tests/targetpool/targetpool.cpp +++ b/messagebus/src/tests/targetpool/targetpool.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/messagebus/network/rpctargetpool.h> #include <vespa/messagebus/testlib/slobrok.h> #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP("targetpool_test"); using namespace mbus; diff --git a/messagebus/src/tests/throttling/throttling.cpp b/messagebus/src/tests/throttling/throttling.cpp index acc5b2ddc4d..a1065c44487 100644 --- a/messagebus/src/tests/throttling/throttling.cpp +++ b/messagebus/src/tests/throttling/throttling.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("throttling_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/destinationsession.h> diff --git a/messagebus/src/tests/timeout/timeout.cpp b/messagebus/src/tests/timeout/timeout.cpp index d51ee34a08b..a14176cb1ef 100644 --- a/messagebus/src/tests/timeout/timeout.cpp +++ b/messagebus/src/tests/timeout/timeout.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("timeout_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/emptyreply.h> diff --git a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp index 5a9324257b5..effe461c5a8 100644 --- a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp +++ b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("simple-roundtrip_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/messagebus.h> diff --git a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp index a381efc2238..81a764d02d9 100644 --- a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp +++ b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("dumpcodes"); + #include <vespa/messagebus/errorcode.h> -#include <string> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp b/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp index 6e9eaae7c09..79a2d2001b6 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "multistringattribute.h" +#include <vespa/searchlib/query/queryterm.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h index efbe44b605e..acc28217d09 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h @@ -119,19 +119,8 @@ public: FakeMemTreeOccFactory(const Schema &schema); ~FakeMemTreeOccFactory(); -<<<<<<< HEAD - virtual - ~FakeMemTreeOccFactory(void); - - virtual FakePosting::SP - make(const FakeWord &fw) override; - - virtual void - setup(const std::vector<const FakeWord *> &fws) override; -======= FakePosting::SP make(const FakeWord &fw) override; void setup(const std::vector<const FakeWord *> &fws) override; ->>>>>>> Use override }; class FakeMemTreeOcc2Factory : public FakeMemTreeOccFactory @@ -144,7 +133,6 @@ public: void setup(const std::vector<const FakeWord *> &fws) override; }; - /* * Updateable memory tree format. */ diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp index 316b80f9596..ee9bed6ba02 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp @@ -1373,24 +1373,10 @@ class FakeEGCompr64PosOcc : public FakeZcFilterOcc public: FakeEGCompr64PosOcc(const FakeWord &fw); ~FakeEGCompr64PosOcc(); - -<<<<<<< HEAD - ~FakeEGCompr64PosOcc(void); - - void setup(const FakeWord &fw); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; -======= void setup(const FakeWord &fw); size_t bitSize() const override; bool hasWordPositions() const override; SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; ->>>>>>> Use override }; @@ -1514,23 +1500,10 @@ class FakeEG2Compr64PosOcc : public FakeZcFilterOcc public: FakeEG2Compr64PosOcc(const FakeWord &fw); ~FakeEG2Compr64PosOcc(); - void setup(const FakeWord &fw); - -<<<<<<< HEAD - void setup(const FakeWord &fw); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; -======= size_t bitSize() const override; bool hasWordPositions() const override; SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; ->>>>>>> Use override }; @@ -1653,23 +1626,11 @@ class FakeZcSkipPosOcc : public FakeZcFilterOcc search::index::PostingListCounts _counts; public: FakeZcSkipPosOcc(const FakeWord &fw); - -<<<<<<< HEAD - ~FakeZcSkipPosOcc(void); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; -======= ~FakeZcSkipPosOcc(); size_t bitSize() const override; bool hasWordPositions() const override; SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; ->>>>>>> Use override }; @@ -1726,21 +1687,9 @@ class FakeZc2SkipPosOcc : public FakeZcFilterOcc public: FakeZc2SkipPosOcc(const FakeWord &fw); ~FakeZc2SkipPosOcc(); - -<<<<<<< HEAD - ~FakeZc2SkipPosOcc(void); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; -======= size_t bitSize() const override; bool hasWordPositions() const override; SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; ->>>>>>> Use override }; diff --git a/storage/src/tests/bucketdb/initializertest.cpp b/storage/src/tests/bucketdb/initializertest.cpp index 9aa7da92e36..47e80f0c202 100644 --- a/storage/src/tests/bucketdb/initializertest.cpp +++ b/storage/src/tests/bucketdb/initializertest.cpp @@ -423,7 +423,8 @@ struct FakePersistenceLayer : public StorageLink { } return 0; } - virtual bool onDown(const api::StorageMessage::SP& msg) override { + + bool onDown(const api::StorageMessage::SP& msg) override { fatalError = ""; if (messageCallback) { messageCallback->onMessage(*msg); diff --git a/storage/src/tests/bucketmover/bucketmovertest.cpp b/storage/src/tests/bucketmover/bucketmovertest.cpp index 3a844b6d1d8..c233765ad27 100644 --- a/storage/src/tests/bucketmover/bucketmovertest.cpp +++ b/storage/src/tests/bucketmover/bucketmovertest.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/bucketmover/bucketmover.h> diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index 8dea2fad94f..15f0373e680 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -67,10 +67,8 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const override - { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const override - { return _clock.getTimeInMillis().getTime(); } + time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } + time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/distributor/blockingoperationstartertest.cpp b/storage/src/tests/distributor/blockingoperationstartertest.cpp index 2ae8a819d7e..64f3dae8fbe 100644 --- a/storage/src/tests/distributor/blockingoperationstartertest.cpp +++ b/storage/src/tests/distributor/blockingoperationstartertest.cpp @@ -1,9 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <string> -#include <sstream> -#include <memory> #include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/distributor/blockingoperationstarter.h> #include <vespa/storage/distributor/pendingmessagetracker.h> diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index 13a8aff239c..5d1bb17a1c6 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <tests/distributor/bucketdatabasetest.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> -#include <iostream> -#include <fstream> #include <iomanip> namespace storage { diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index 7ad083dc5a1..e35f147d0c8 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -13,7 +13,6 @@ #include <iostream> #include <fstream> -#include <string> using namespace storage::api; using namespace storage::lib; diff --git a/storage/src/tests/distributor/bucketstateoperationtest.cpp b/storage/src/tests/distributor/bucketstateoperationtest.cpp index 74a31de1541..58061def8ab 100644 --- a/storage/src/tests/distributor/bucketstateoperationtest.cpp +++ b/storage/src/tests/distributor/bucketstateoperationtest.cpp @@ -28,13 +28,10 @@ private: void testBucketDbNotUpdatedOnFailure(); public: - void setUp() override - { + void setUp() override { createLinks(); } - - void tearDown() override - { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp index e7078f08d0a..3e4e1d6da88 100644 --- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp +++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp @@ -6,7 +6,6 @@ #include <vespa/storage/distributor/min_replica_provider.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/io/fileutil.h> -#include <vespa/vespalib/util/jsonstream.h> #include <vespa/vespalib/testkit/test_kit.h> #include <tests/common/hostreporter/util.h> #include <vespa/vespalib/stllike/asciistream.h> diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp index fc09dc17c1f..10b0d035770 100644 --- a/storage/src/tests/distributor/distributortest.cpp +++ b/storage/src/tests/distributor/distributortest.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iomanip> -#include <iostream> -#include <memory> #include <boost/assign/std/vector.hpp> // for 'operator+=()' #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storage/distributor/idealstatemetricsset.h> diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp index 2b861d23c5e..e4fce6b9d6e 100644 --- a/storage/src/tests/distributor/idealstatemanagertest.cpp +++ b/storage/src/tests/distributor/idealstatemanagertest.cpp @@ -11,7 +11,6 @@ #include <tests/distributor/distributortestutil.h> - namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/mapbucketdatabasetest.cpp b/storage/src/tests/distributor/mapbucketdatabasetest.cpp index 6892f522bba..8af2a86e4c5 100644 --- a/storage/src/tests/distributor/mapbucketdatabasetest.cpp +++ b/storage/src/tests/distributor/mapbucketdatabasetest.cpp @@ -1,10 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/util/document_runnable.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <cppunit/extensions/HelperMacros.h> #include <vespa/storage/bucketdb/mapbucketdatabase.h> -#include <vespa/storage/storageutil/utils.h> #include <tests/distributor/bucketdatabasetest.h> namespace storage { @@ -12,8 +8,7 @@ namespace distributor { struct MapBucketDatabaseTest : public BucketDatabaseTest { MapBucketDatabase _db; - - virtual BucketDatabase& db() override { return _db; } + BucketDatabase& db() override { return _db; }; CPPUNIT_TEST_SUITE(MapBucketDatabaseTest); SETUP_DATABASE_TESTS(); diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index 875d16a42ed..1e317e20b74 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <boost/lexical_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <iomanip> diff --git a/storage/src/tests/distributor/messagesenderstub.h b/storage/src/tests/distributor/messagesenderstub.h index 7b552ec6883..629c1c6e346 100644 --- a/storage/src/tests/distributor/messagesenderstub.h +++ b/storage/src/tests/distributor/messagesenderstub.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/storage/distributor/distributormessagesender.h> +#include <cassert> namespace storage { @@ -20,13 +21,11 @@ struct MessageSenderStub : distributor::DistributorMessageSender replies.clear(); } - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) - { + virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) { commands.push_back(cmd); } - virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) - { + virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) { replies.push_back(reply); } @@ -67,4 +66,3 @@ private: }; } - diff --git a/storage/src/tests/distributor/operationtargetresolvertest.cpp b/storage/src/tests/distributor/operationtargetresolvertest.cpp index 26144ac950e..d0dc8cedaf3 100644 --- a/storage/src/tests/distributor/operationtargetresolvertest.cpp +++ b/storage/src/tests/distributor/operationtargetresolvertest.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iomanip> -#include <iostream> #include <vespa/config/helper/configgetter.h> #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp index 6f4539d426e..618d7980c5b 100644 --- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp +++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/base/testdocman.h> #include <vespa/storage/distributor/pendingmessagetracker.h> @@ -10,13 +9,6 @@ #include <tests/common/dummystoragelink.h> #include <vespa/vdslib/state/random.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <fstream> -#include <sstream> -#include <iomanip> -#include <iostream> -#include <memory> -#include <string> -#include <iterator> namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp index 100d5582006..342d346b398 100644 --- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp +++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp @@ -1,18 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storage/distributor/maintenance/simplemaintenancescanner.h> #include <vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h> #include <vespa/storage/bucketdb/mapbucketdatabase.h> #include <tests/distributor/maintenancemocks.h> -#include <string> -#include <sstream> -#include <memory> -#include <algorithm> -#include <iterator> - namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/statusreporterdelegatetest.cpp b/storage/src/tests/distributor/statusreporterdelegatetest.cpp index f136b00244a..d9f647a52a5 100644 --- a/storage/src/tests/distributor/statusreporterdelegatetest.cpp +++ b/storage/src/tests/distributor/statusreporterdelegatetest.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 <vespa/fastos/fastos.h> + #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/common/testhelper.h> #include <tests/distributor/distributortestutil.h> diff --git a/storage/src/tests/distributor/throttlingoperationstartertest.cpp b/storage/src/tests/distributor/throttlingoperationstartertest.cpp index 8e7d98005c1..0414ad11da4 100644 --- a/storage/src/tests/distributor/throttlingoperationstartertest.cpp +++ b/storage/src/tests/distributor/throttlingoperationstartertest.cpp @@ -1,9 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <string> -#include <sstream> -#include <memory> #include <vespa/storage/distributor/throttlingoperationstarter.h> #include <tests/distributor/maintenancemocks.h> diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index 567f9192d34..43d13acb28b 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.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 <vespa/fastos/fastos.h> -#include <vespa/document/util/stringutil.h> -#include <vespa/log/log.h> -#include <sstream> #include <vespa/storageframework/defaultimplementation/component/componentregisterimpl.h> #include <vespa/storage/frameworkimpl/status/statuswebserver.h> #include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h> #include <tests/common/teststorageapp.h> #include <vespa/vdstestlib/cppunit/macros.h> - -LOG_SETUP(".test.status"); +#include <vespa/document/util/stringutil.h> +#include <sstream> namespace storage { @@ -47,18 +43,13 @@ namespace { : framework::HtmlStatusReporter(id, name), _headerAddition(headerAddition), _content(content) - { - } + {} - virtual void reportHtmlHeaderAdditions( - std::ostream& out, const framework::HttpUrlPath&) const override - { + void reportHtmlHeaderAdditions(std::ostream& out, const framework::HttpUrlPath&) const override { out << _headerAddition; } - virtual void reportHtmlStatus( - std::ostream& out, const framework::HttpUrlPath&) const override - { + void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override { out << _content; } }; @@ -66,9 +57,9 @@ namespace { struct XmlStatusReporter : public framework::XmlStatusReporter { XmlStatusReporter(const std::string& id, const std::string& name) : framework::XmlStatusReporter(id, name) {} - virtual vespalib::string reportXmlStatus( - vespalib::xml::XmlOutputStream& xos, - const framework::HttpUrlPath&) const override + + vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream& xos, + const framework::HttpUrlPath&) const override { xos << vespalib::xml::XmlTag("mytag") << vespalib::xml::XmlAttribute("foo", "bar") diff --git a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp index 8553795db71..5f675c1d551 100644 --- a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp +++ b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/distributor/messagesenderstub.h> #include <tests/common/teststorageapp.h> diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index e21d367370b..e2f41aa5b3e 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -9,7 +9,6 @@ #include <vespa/document/select/parser.h> #include <vespa/vdslib/state/random.h> #include <vespa/vdslib/container/mutabledocumentlist.h> -#include <vespa/vdslib/container/operationlist.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/storageapi/message/bucket.h> @@ -18,25 +17,17 @@ #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/removelocation.h> #include <vespa/storage/bucketdb/bucketmanager.h> -#include <vespa/storage/bucketdb/storbucketdb.h> -#include <vespa/storage/common/bucketmessages.h> -#include <vespa/storageframework/storageframework.h> #include <vespa/storage/persistence/persistencethread.h> -#include <vespa/storage/persistence/messages.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> #include <tests/common/teststorageapp.h> -#include <tests/common/dummystoragelink.h> #include <tests/persistence/filestorage/forwardingmessagesender.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <vespa/storageapi/message/batch.h> #include <vespa/storage/storageserver/statemanager.h> #include <vespa/fastos/file.h> -#include <fstream> -#include <memory> -#include <atomic> #include <vespa/log/log.h> LOG_SETUP(".filestormanagertest"); @@ -2364,10 +2355,8 @@ namespace { closeNextLink(); } - virtual void print(std::ostream& out, bool, const std::string&) const override - { out << "MidLink"; } - - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { + void print(std::ostream& out, bool, const std::string&) const override { out << "MidLink"; } + bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { if (!StorageLinkTest::callOnUp(_up, msg)) _up.sendUp(msg); return true; } @@ -2395,10 +2384,9 @@ namespace { _leftAddr(leftAddr), _rightAddr(rightAddr) {} - virtual void print(std::ostream& out, bool, const std::string&) const override - { out << "BinaryStorageLink"; } + void print(std::ostream& out, bool, const std::string&) const override { out << "BinaryStorageLink"; } - virtual bool onDown(const std::shared_ptr<api::StorageMessage> & msg) override { + bool onDown(const std::shared_ptr<api::StorageMessage> & msg) override { // LOG(debug, "onDown Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); @@ -2432,7 +2420,7 @@ namespace { return true; } - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { + bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { // LOG(debug, "onUp Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); diff --git a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp index d608bef3307..1409445b96b 100644 --- a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <memory> + #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> diff --git a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp index 2dc60594c45..58b4ae4d475 100644 --- a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp +++ b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.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 <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> #include <tests/common/teststorageapp.h> -#include <tests/common/dummystoragelink.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> -#include <vespa/storage/persistence/messages.h> namespace storage { diff --git a/storage/src/tests/persistence/legacyoperationhandlertest.cpp b/storage/src/tests/persistence/legacyoperationhandlertest.cpp index df262501299..353a8d24ec5 100644 --- a/storage/src/tests/persistence/legacyoperationhandlertest.cpp +++ b/storage/src/tests/persistence/legacyoperationhandlertest.cpp @@ -1,15 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/base/testdocrepo.h> -#include <vespa/document/repo/documenttyperepo.h> #include <vespa/documentapi/loadtypes/loadtype.h> #include <vespa/storage/persistence/messages.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storageapi/message/multioperation.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <tests/persistence/persistencetestutils.h> -#include <vespa/storage/persistence/types.h> using document::DocumentTypeRepo; using document::TestDocRepo; diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp index 8147992a516..3f0623fbef0 100644 --- a/storage/src/tests/persistence/mergehandlertest.cpp +++ b/storage/src/tests/persistence/mergehandlertest.cpp @@ -3,15 +3,13 @@ #include <vespa/document/base/testdocman.h> #include <vespa/storage/persistence/mergehandler.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/storageapi/message/bucket.h> -#include <vespa/log/log.h> #include <tests/persistence/persistencetestutils.h> #include <tests/persistence/common/persistenceproviderwrapper.h> #include <tests/distributor/messagesenderstub.h> -#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> #include <vespa/vespalib/objects/nbostream.h> #include <cmath> +#include <vespa/log/log.h> LOG_SETUP(".test.persistence.handler.merge"); namespace storage { diff --git a/storage/src/tests/persistence/providershutdownwrappertest.cpp b/storage/src/tests/persistence/providershutdownwrappertest.cpp index 8b1ef88aa2c..c7f60a39cc8 100644 --- a/storage/src/tests/persistence/providershutdownwrappertest.cpp +++ b/storage/src/tests/persistence/providershutdownwrappertest.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 <vespa/fastos/fastos.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/persistence/persistencetestutils.h> #include <tests/persistence/common/persistenceproviderwrapper.h> -#include <vespa/storage/persistence/providershutdownwrapper.h> namespace storage { diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index e5b9a3e6092..751d6b535a3 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -1,10 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <boost/pointer_cast.hpp> #include <cppunit/extensions/HelperMacros.h> -#include <iostream> -#include <string> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/storageapi/message/stat.h> diff --git a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp index d9a175f3b04..f4eedc64971 100644 --- a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp +++ b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp @@ -1,18 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <boost/lexical_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <vespa/log/log.h> #include <vespa/storage/bucketdb/bucketmanager.h> -#include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/storageserver/bucketintegritychecker.h> -#include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/persistence.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> -#include <tests/common/dummystoragelink.h> #include <vespa/vespalib/io/fileutil.h> #include <tests/common/teststorageapp.h> diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp index 8eb6b74a840..89eaff0ab6e 100644 --- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp +++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/base/testdocman.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storage/bucketdb/storbucketdb.h> @@ -15,7 +14,6 @@ #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <vespa/storage/storageserver/changedbucketownershiphandler.h> -#include <memory> namespace storage { diff --git a/storage/src/tests/storageserver/priorityconvertertest.cpp b/storage/src/tests/storageserver/priorityconvertertest.cpp index ecbbd25b8b1..ab6c27f48d6 100644 --- a/storage/src/tests/storageserver/priorityconvertertest.cpp +++ b/storage/src/tests/storageserver/priorityconvertertest.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/documentapi/documentapi.h> #include <vespa/storage/storageserver/priorityconverter.h> #include <tests/common/testhelper.h> diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp index 4244ce0c4ce..f9c5c97e6bc 100644 --- a/storage/src/tests/storageserver/statemanagertest.cpp +++ b/storage/src/tests/storageserver/statemanagertest.cpp @@ -1,19 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <boost/pointer_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <vespa/metrics/metricmanager.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> -#include <vespa/vdslib/state/nodestate.h> #include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/storageserver/statemanager.h> -#include <vespa/storage/common/hostreporter/hostinfo.h> #include <tests/common/teststorageapp.h> #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <vespa/vespalib/data/slime/slime.h> -#include <iostream> using storage::lib::NodeState; using storage::lib::NodeType; @@ -138,8 +134,7 @@ namespace { MyStateListener(const NodeStateUpdater& upd) : updater(upd), current(*updater.getReportedNodeState()) {} - void handleNewState() override - { + void handleNewState() override { ost << current << " -> "; current = *updater.getReportedNodeState(); ost << current << "\n"; @@ -259,4 +254,3 @@ StateManagerTest::testClusterStateVersion() } } // storage - diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index 265b9e95d83..8a164361c88 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -18,8 +18,8 @@ namespace storage { class DummyApplicationGenerationFether : public ApplicationGenerationFetcher { public: - virtual int64_t getGeneration() const override { return 1; } - virtual std::string getComponentName() const override { return "component"; } + int64_t getGeneration() const override { return 1; } + std::string getComponentName() const override { return "component"; } }; struct StateReporterTest : public CppUnit::TestFixture { @@ -58,10 +58,8 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const override - { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const override - { return _clock.getTimeInMillis().getTime(); } + time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } + time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/storageutil/charttest.cpp b/storage/src/tests/storageutil/charttest.cpp index 4f83a9f26f4..c7c1c43b000 100644 --- a/storage/src/tests/storageutil/charttest.cpp +++ b/storage/src/tests/storageutil/charttest.cpp @@ -1,18 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/storageutil/piechart.h> - -#include <fstream> #include <vespa/vdstestlib/cppunit/macros.h> +#include <fstream> namespace storage { struct PieChartTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testWriteHtmlFile(); CPPUNIT_TEST_SUITE(PieChartTest); diff --git a/storage/src/tests/storageutil/palettetest.cpp b/storage/src/tests/storageutil/palettetest.cpp index e5a4e73d58a..24eaee18996 100644 --- a/storage/src/tests/storageutil/palettetest.cpp +++ b/storage/src/tests/storageutil/palettetest.cpp @@ -1,15 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/storageutil/palette.h> #include <vespa/vdstestlib/cppunit/macros.h> namespace storage { struct PaletteTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testNormalUsage(); CPPUNIT_TEST_SUITE(PaletteTest); diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index 8aa57b982db..1824b976aea 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -1,15 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/datatype/datatype.h> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/document/fieldvalue/rawfieldvalue.h> -#include <vespa/log/log.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/persistence.h> -#include <vespa/storageapi/message/visitor.h> -#include <vector> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/visiting/visitormanager.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> @@ -17,16 +13,11 @@ #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <tests/storageserver/testvisitormessagesession.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vdslib/container/visitorordering.h> #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/vespalib/util/exceptions.h> - -LOG_SETUP(".visitormanagertest"); - namespace storage { namespace { typedef std::vector<api::StorageMessage::SP> msg_ptr_vector; @@ -113,7 +104,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(VisitorManagerTest); void VisitorManagerTest::initializeTest() { - LOG(debug, "Initializing test"); vdstestlib::DirConfig config(getStandardConfig(true)); config.getConfig("stor-visitor").set("visitorthreads", "1"); @@ -221,7 +211,6 @@ VisitorManagerTest::initializeTest() CPPUNIT_ASSERT_EQUAL(api::ReturnCode(api::ReturnCode::OK), reply->getResult()); } - LOG(debug, "Done initializing test"); } void diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index e6a3542cbf2..84f1297b05f 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -6,25 +6,17 @@ #include <vespa/document/fieldvalue/rawfieldvalue.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/persistence.h> -#include <vespa/storageapi/message/visitor.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/visiting/visitormanager.h> #include <tests/common/testhelper.h> #include <tests/common/teststorageapp.h> #include <tests/common/dummystoragelink.h> #include <tests/storageserver/testvisitormessagesession.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vdslib/container/visitorordering.h> #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/vespalib/util/exceptions.h> -#include <vector> #include <thread> -#include <chrono> - -#include <vespa/log/log.h> -LOG_SETUP(".visitortest"); using namespace std::chrono_literals; @@ -185,7 +177,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(VisitorTest); void VisitorTest::initializeTest(const TestParams& params) { - LOG(debug, "Initializing test"); vdstestlib::DirConfig config(getStandardConfig(true, "visitortest")); config.getConfig("stor-visitor").set("visitorthreads", "1"); config.getConfig("stor-visitor").set( @@ -273,7 +264,6 @@ VisitorTest::initializeTest(const TestParams& params) _documents.back()->setValue(type.getField("headerval"), document::IntFieldValue(i % 4)); } - LOG(debug, "Done initializing test"); } void diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index 64498386466..da8dcf1c1cd 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -102,8 +102,7 @@ public: ~BucketManager(); void startWorkerThread(); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Dump the whole database to the given output. Use for debugging. */ void dump(std::ostream& out) const; @@ -120,11 +119,11 @@ private: vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; - /** Event saying node is up and running. We can start to build cache. */ - virtual void onOpen() override; - virtual void onDoneInit() override { _doneInitialized = true; } - virtual void onClose() override; - virtual void onFlush(bool downwards) override; + /** Event saying node is up and running. We can start to build cache. */ + void onOpen() override; + void onDoneInit() override { _doneInitialized = true; } + void onClose() override; + void onFlush(bool downwards) override; void updateMetrics(bool updateDocCount); void updateMetrics(const MetricLockGuard &) override { updateMetrics(true); } diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h index b5d8a50cb16..e28d89967b2 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.h +++ b/storage/src/vespa/storage/bucketdb/judyarray.h @@ -83,7 +83,7 @@ public: data_type& operator[](key_type key); size_type getMemoryUsage() const; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; class ConstIterator : public vespalib::Printable { @@ -101,8 +101,7 @@ public: key_type key() const { return _key; } data_type value() const { return *_data; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; protected: // For creating end() iterator ConstIterator(const JudyArray&); @@ -227,4 +226,3 @@ JudyArray::ConstIterator::operator==(const JudyArray::ConstIterator &cp) const } } // storage - diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h index 93dfb23c4db..3c40c214136 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.h +++ b/storage/src/vespa/storage/bucketdb/lockablemap.h @@ -168,7 +168,7 @@ public: const char* clientId, uint32_t chunkSize = DEFAULT_CHUNK_SIZE); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * Returns all buckets in the bucket database that can contain the given diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp index a271803714a..10a6bb6bd24 100644 --- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp +++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/bucketdb/mapbucketdatabase.h> #include <vespa/storage/common/bucketoperationlogger.h> @@ -465,7 +464,7 @@ namespace { struct Writer : public BucketDatabase::EntryProcessor { std::ostream& _ost; Writer(std::ostream& ost) : _ost(ost) {} - virtual bool process(const BucketDatabase::Entry& e) override { + bool process(const BucketDatabase::Entry& e) override { _ost << e.toString() << "\n"; return true; } diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h index 6e9bef38672..4c87c39fdd2 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h @@ -138,12 +138,12 @@ public: ServiceLayerComponentRegister&); ~StorageBucketDBInitializer(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void onOpen() override; - virtual void onClose() override; + void onOpen() override; + void onClose() override; - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; bool onDown(const std::shared_ptr<api::StorageMessage>&) override; bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; @@ -215,4 +215,3 @@ public: }; } // storage - diff --git a/storage/src/vespa/storage/bucketmover/run.h b/storage/src/vespa/storage/bucketmover/run.h index a626960eec7..d05020e6ba5 100644 --- a/storage/src/vespa/storage/bucketmover/run.h +++ b/storage/src/vespa/storage/bucketmover/run.h @@ -15,12 +15,13 @@ #pragma once -#include <list> -#include <map> + #include <vespa/storage/bucketmover/move.h> #include <vespa/storage/bucketmover/runstatistics.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/nodestate.h> +#include <list> +#include <map> namespace storage { @@ -91,8 +92,7 @@ public: RunStatistics& getStatistics() { return _statistics; } const RunStatistics& getStatistics() const { return _statistics; } - - virtual void print(std::ostream&, bool verbose, const std::string& indent) const override; + void print(std::ostream&, bool verbose, const std::string& indent) const override; private: void removePending(Move&); void finalize(); @@ -100,4 +100,3 @@ private: } // bucketmover } // storage - diff --git a/storage/src/vespa/storage/common/messagesender.h b/storage/src/vespa/storage/common/messagesender.h index 025695dff29..332103e12db 100644 --- a/storage/src/vespa/storage/common/messagesender.h +++ b/storage/src/vespa/storage/common/messagesender.h @@ -16,6 +16,7 @@ #pragma once +#include <memory> namespace storage { namespace api { diff --git a/storage/src/vespa/storage/common/servicelayercomponent.h b/storage/src/vespa/storage/common/servicelayercomponent.h index e54421b1ce3..5b9db275b27 100644 --- a/storage/src/vespa/storage/common/servicelayercomponent.h +++ b/storage/src/vespa/storage/common/servicelayercomponent.h @@ -25,7 +25,7 @@ #pragma once -#include <vespa/storage/common/storagecomponent.h> +#include "storagecomponent.h" namespace storage { @@ -54,12 +54,10 @@ class ServiceLayerComponent : public StorageComponent, StorBucketDatabase* _bucketDatabase; MinimumUsedBitsTracker* _minUsedBitsTracker; - // ServiceLayerManagedComponent implementation - virtual void setDiskCount(uint16_t count) override { _diskCount = count; } - virtual void setBucketDatabase(StorBucketDatabase& db) override { - _bucketDatabase = &db; - } - virtual void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) override { + // ServiceLayerManagedComponent implementation + void setDiskCount(uint16_t count) override { _diskCount = count; } + void setBucketDatabase(StorBucketDatabase& db) override { _bucketDatabase = &db; } + void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) override { _minUsedBitsTracker = &tracker; } public: @@ -91,4 +89,3 @@ public: }; } // storage - diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.h b/storage/src/vespa/storage/common/statusmetricconsumer.h index 0027cef9cd0..6a2c18f78bd 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.h +++ b/storage/src/vespa/storage/common/statusmetricconsumer.h @@ -9,11 +9,11 @@ #pragma once +#include "storagecomponent.h" #include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> #include <map> #include <vespa/metrics/metrics.h> -#include <vespa/storage/common/storagecomponent.h> #include <vespa/storageframework/storageframework.h> namespace vespalib { diff --git a/storage/src/vespa/storage/common/storagelink.h b/storage/src/vespa/storage/common/storagelink.h index e9ea8403321..a9af5fa5622 100644 --- a/storage/src/vespa/storage/common/storagelink.h +++ b/storage/src/vespa/storage/common/storagelink.h @@ -19,13 +19,11 @@ #pragma once -#include <vespa/vespalib/util/printable.h> -#include <memory> +#include "messagesender.h" +#include "storagecomponent.h" #include <vespa/storageapi/messageapi/messagehandler.h> #include <vespa/storageapi/messageapi/storagemessage.h> -#include <string> -#include <vespa/storage/common/messagesender.h> -#include <vespa/storage/common/storagecomponent.h> +#include <vespa/vespalib/util/printable.h> namespace storage { @@ -84,10 +82,10 @@ public: void flush(); /** Send message down the storage chain. */ - virtual void sendDown(const api::StorageMessage::SP&); + void sendDown(const api::StorageMessage::SP&) override; /** Send message up the storage chain. */ - virtual void sendUp(const api::StorageMessage::SP&); + void sendUp(const api::StorageMessage::SP&) override; void printChain(std::ostream&, std::string indent = "") const; @@ -126,8 +124,7 @@ public: */ virtual bool onUp(const api::StorageMessage::SP&); - virtual void print(std::ostream& out, bool, - const std::string&) const { + void print(std::ostream& out, bool, const std::string&) const override { out << getName(); } @@ -188,4 +185,3 @@ private: std::ostream& operator<<(std::ostream& out, StorageLink& link); } - diff --git a/storage/src/vespa/storage/common/storagelinkqueued.h b/storage/src/vespa/storage/common/storagelinkqueued.h index cd7b91a7a68..c894b6196e8 100644 --- a/storage/src/vespa/storage/common/storagelinkqueued.h +++ b/storage/src/vespa/storage/common/storagelinkqueued.h @@ -14,11 +14,11 @@ #pragma once +#include "storagelink.h" +#include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/document_runnable.h> #include <deque> #include <limits> -#include <vespa/storageframework/storageframework.h> -#include <vespa/storage/common/storagelink.h> namespace storage { @@ -40,13 +40,13 @@ public: void dispatchUp(const std::shared_ptr<api::StorageMessage>&); /** Remember to call this method if you override it. */ - virtual void onClose() override { + void onClose() override { _commandDispatcher.flush(); _closeState |= 1; } /** Remember to call this method if you override it. */ - virtual void onFlush(bool downwards) override { + void onFlush(bool downwards) override { if (downwards) { _commandDispatcher.flush(); _closeState |= 2; @@ -79,7 +79,7 @@ private: public: Dispatcher(StorageLinkQueued& parent, unsigned int maxQueueSize, bool replyDispatcher); - virtual ~Dispatcher(); + ~Dispatcher(); void start(); void run(framework::ThreadHandle&) override; @@ -106,7 +106,7 @@ private: void send(const std::shared_ptr<api::StorageMessage> & reply) override { _parent.sendUp(reply); } - virtual ~ReplyDispatcher() { terminate(); } + ~ReplyDispatcher() { terminate(); } }; class CommandDispatcher : public Dispatcher<api::StorageMessage> @@ -117,7 +117,7 @@ private: parent, std::numeric_limits<unsigned int>::max(), false) { } - virtual ~CommandDispatcher() { terminate(); } + ~CommandDispatcher() { terminate(); } void send(const std::shared_ptr<api::StorageMessage> & command) override { _parent.sendDown(command); } @@ -132,7 +132,6 @@ private: protected: ReplyDispatcher& getReplyDispatcher() { return _replyDispatcher; } - }; } diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index b87f0e5f898..a8f76c2c7a0 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -49,23 +49,14 @@ public: const std::shared_ptr<api::RequestBucketInfoReply> & repl) override; bool onMergeBucketReply(const std::shared_ptr<api::MergeBucketReply>& reply) override; - bool onNotifyBucketChange(const std::shared_ptr<api::NotifyBucketChangeCommand>&) override; - void resendDelayedMessages(); - void storageDistributionChanged(const lib::Distribution&); - vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, - const framework::HttpUrlPath&) const; - - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const framework::HttpUrlPath&) const; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; - - 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; DistributorComponent& getDistributorComponent() { return _bucketSpaceComponent; } /** @@ -240,12 +231,8 @@ private: _upStates(upStates) {} ~NodeRemover(); - - virtual bool process(BucketDatabase::Entry& e) override; - - void logRemove(const document::BucketId& bucketId, - const char* msg) const; - + bool process(BucketDatabase::Entry& e) override; + void logRemove(const document::BucketId& bucketId, const char* msg) const; bool distributorOwnsBucket(const document::BucketId&) const; const std::vector<document::BucketId>& getBucketsToRemove() const { @@ -266,8 +253,7 @@ private: const char* _upStates; }; - std::deque<std::pair<framework::MilliSecTime, - BucketRequest> > _delayedRequests; + std::deque<std::pair<framework::MilliSecTime, BucketRequest> > _delayedRequests; std::map<uint64_t, BucketRequest> _sentMessages; std::unique_ptr<PendingClusterState> _pendingClusterState; std::list<PendingClusterState::Summary> _history; @@ -280,4 +266,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index 40d6ee76e07..182988104a9 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -2,7 +2,6 @@ #pragma once - #include "idealstatemanager.h" #include "bucketdbupdater.h" #include "pendingmessagetracker.h" @@ -22,7 +21,6 @@ #include <vespa/storageframework/generic/thread/tickingthread.h> #include <vespa/config/config.h> #include <vespa/vespalib/util/sync.h> - #include <unordered_map> namespace storage { @@ -57,16 +55,12 @@ public: ~Distributor(); void onOpen() override; - void onClose() override; - bool onDown(const std::shared_ptr<api::StorageMessage>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void sendDown(const std::shared_ptr<api::StorageMessage>&) override; - virtual ChainedMessageSender& getMessageSender() override { + ChainedMessageSender& getMessageSender() override { return (_messageSender == 0 ? *this : *_messageSender); } @@ -99,8 +93,7 @@ public: bool handleReply(const std::shared_ptr<api::StorageReply>& reply) override; // StatusReporter implementation - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; bool handleStatusRequest(const DelegatedStatusRequest& request) const override; @@ -117,8 +110,7 @@ public: * Checks whether a bucket needs to be split, and sends a split * if so. */ - void checkBucketForSplit(const BucketDatabase::Entry& e, - uint8_t priority) override; + void checkBucketForSplit(const BucketDatabase::Entry& e, uint8_t priority) override; const lib::Distribution& getDistribution() const override; @@ -130,8 +122,9 @@ public: * @return Returns the states in which the distributors consider * storage nodes to be up. */ - const char* getStorageNodeUpStates() const override - { return _initializingIsUp ? "uri" : "ur"; } + const char* getStorageNodeUpStates() const override { + return _initializingIsUp ? "uri" : "ur"; + } /** * Called by bucket db updater after a merge has finished, and all the @@ -154,13 +147,10 @@ public: } int getDistributorIndex() const override; - const std::string& getClusterName() const override; - const PendingMessageTracker& getPendingMessageTracker() const override; - - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; - virtual void sendReply(const std::shared_ptr<api::StorageReply>&) override; + void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; + void sendReply(const std::shared_ptr<api::StorageReply>&) override; const BucketGcTimeCalculator::BucketIdHasher& getBucketIdHasher() const override { diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.h b/storage/src/vespa/storage/distributor/operations/external/getoperation.h index ecdfb1e677a..57a7c55fb81 100644 --- a/storage/src/vespa/storage/distributor/operations/external/getoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.h @@ -6,15 +6,11 @@ #include <vespa/storage/bucketdb/bucketcopy.h> #include <vespa/storageapi/messageapi/storagemessage.h> -namespace document { -class Document; -} +namespace document { class Document; } namespace storage { -namespace api { -class GetCommand; -} +namespace api { class GetCommand; } class PersistenceOperationMetricSet; @@ -30,13 +26,9 @@ public: PersistenceOperationMetricSet& metric); void onClose(DistributorMessageSender& sender) override; - void onStart(DistributorMessageSender& sender) override; - void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override; - const char* getName() const override { return "get"; } - std::string getStatus() const override { return ""; } bool hasConsistentCopies() const; @@ -48,13 +40,9 @@ private: GroupId(const document::BucketId& id, uint32_t checksum, int node); bool operator<(const GroupId& other) const; - bool operator==(const GroupId& other) const; - const document::BucketId& getBucketId() const { return _id; } - int getNode() const { return _node; } - private: document::BucketId _id; uint32_t _checksum; @@ -65,7 +53,8 @@ private: public: BucketChecksumGroup(const BucketCopy& c) : copy(c), - sent(0), received(false), returnCode(api::ReturnCode::OK) {}; + sent(0), received(false), returnCode(api::ReturnCode::OK) + {} BucketCopy copy; api::StorageMessage::Id sent; @@ -105,8 +94,4 @@ private: }; } - - } - - diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.h b/storage/src/vespa/storage/distributor/operations/external/putoperation.h index 5043fed307f..6ba9e9c3dbf 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.h @@ -28,14 +28,9 @@ public: PersistenceOperationMetricSet& metric); void onStart(DistributorMessageSender& sender) override; - - const char* getName() const override { return "put"; } - - std::string getStatus() const override { return ""; } - - void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> &) override; - + const char* getName() const override { return "put"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> &) override; void onClose(DistributorMessageSender& sender) override; /** @@ -71,11 +66,9 @@ private: const uint16_t node, std::vector<PersistenceMessageTracker::ToSend>& putBatch); - bool shouldImplicitlyActivateReplica( - const OperationTargetList& targets) const; + bool shouldImplicitlyActivateReplica(const OperationTargetList& targets) const; std::shared_ptr<api::PutCommand> _msg; - DistributorComponent& _manager; }; diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h index 25cc0825b7d..dce744b6648 100644 --- a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h @@ -7,9 +7,7 @@ namespace storage { -namespace api { -class GetBucketListCommand; -} +namespace api { class GetBucketListCommand; } namespace distributor { @@ -23,22 +21,21 @@ public: const MaintenanceOperationGenerator& generator, uint16_t distributorIndex, const std::shared_ptr<api::GetBucketListCommand>& cmd); - virtual ~StatBucketListOperation() {} + ~StatBucketListOperation() {} - virtual const char* getName() const override { return "statBucketList"; } - virtual std::string getStatus() const override { return ""; } + const char* getName() const override { return "statBucketList"; } + std::string getStatus() const override { return ""; } - virtual void onStart(DistributorMessageSender& sender) override; - virtual void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override { + void onStart(DistributorMessageSender& sender) override; + void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override + { // Never called. assert(false); } - void onClose(DistributorMessageSender&) override { - } + void onClose(DistributorMessageSender&) override {} private: - void getBucketStatus(const BucketDatabase::Entry& entry, - std::ostream& os) const; + void getBucketStatus(const BucketDatabase::Entry& entry, std::ostream& os) const; const BucketDatabase& _bucketDb; const MaintenanceOperationGenerator& _generator; @@ -48,4 +45,3 @@ private: } // distributor } // storage - diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp index 15f8d06965a..7b1ff03b8af 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp @@ -52,24 +52,24 @@ struct IntermediateMessageSender : DistributorMessageSender { DistributorMessageSender & fwd); ~IntermediateMessageSender(); - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override { + void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override { msgMap.insert(cmd->getMsgId(), callback); forward.sendCommand(cmd); }; - virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) override { + void sendReply(const std::shared_ptr<api::StorageReply>& reply) override { _reply = reply; } - virtual int getDistributorIndex() const override { + int getDistributorIndex() const override { return forward.getDistributorIndex(); } - virtual const std::string& getClusterName() const override { + const std::string& getClusterName() const override { return forward.getClusterName(); } - virtual const PendingMessageTracker& getPendingMessageTracker() const override { + const PendingMessageTracker& getPendingMessageTracker() const override { return forward.getPendingMessageTracker(); } }; diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h index 0a2a9e564a0..fef9c01efa9 100644 --- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h @@ -25,14 +25,9 @@ public: PersistenceOperationMetricSet& metric); void onStart(DistributorMessageSender& sender) override; - - const char* getName() const override { return "update"; } - - std::string getStatus() const override { return ""; } - - void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> & msg) override; - + const char* getName() const override { return "update"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override; void onClose(DistributorMessageSender& sender) override; std::pair<document::BucketId, uint16_t> getNewestTimestampLocation() const { @@ -65,4 +60,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h index 802bb0f4bac..fd133674bd1 100644 --- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h +++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h @@ -2,8 +2,8 @@ #pragma once +#include "operationtargetresolver.h" #include <vespa/storage/bucketdb/bucketdatabase.h> -#include <vespa/storage/distributor/operationtargetresolver.h> #include <vespa/vdslib/distribution/idealnodecalculator.h> namespace storage { @@ -91,23 +91,20 @@ public: _idealNodeCalculator(idealNodeCalc), _minUsedBucketBits(minUsedBucketBits), _redundancy(redundancy) - { - } + {} BucketInstanceList getAllInstances(OperationType type, const document::BucketId& id); - BucketInstanceList getInstances(OperationType type, const document::BucketId& id) - { + BucketInstanceList getInstances(OperationType type, const document::BucketId& id) { BucketInstanceList result(getAllInstances(type, id)); result.limitToRedundancyCopies(_redundancy); return result; } - virtual OperationTargetList getTargets(OperationType type, - const document::BucketId& id) override - { return getInstances(type, id).createTargets(); } + OperationTargetList getTargets(OperationType type, const document::BucketId& id) override { + return getInstances(type, id).createTargets(); + } }; } // distributor } // storage - diff --git a/storage/src/vespa/storage/distributor/statecheckers.h b/storage/src/vespa/storage/distributor/statecheckers.h index 0113749f2fd..dbd9503f9f2 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.h +++ b/storage/src/vespa/storage/distributor/statecheckers.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 <vespa/storage/distributor/idealstatemanager.h> +#include "idealstatemanager.h" namespace storage { @@ -11,9 +11,7 @@ class SynchronizeAndMoveStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Synchronization and moving"; } - Result check(Context& c) override; - const char* getName() const override { return "SynchronizeAndMove"; } }; @@ -21,9 +19,7 @@ class DeleteExtraCopiesStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Delete extra copies"; } - Result check(Context& c) override; - const char* getName() const override { return "DeleteExtraCopies"; } private: @@ -49,9 +45,7 @@ class JoinBucketsStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Join buckets"; } - Result check(Context& c) override; - const char* getName() const override { return "JoinBuckets"; } private: uint64_t getTotalUsedFileSize(const Context& c) const; @@ -69,13 +63,9 @@ class SplitBucketStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Split buckets"; } - Result check(Context& c) override; - const char* getName() const override { return "SplitBucket"; } - private: - Result generateMinimumBucketSplitOperation(Context& c); Result generateMaxSizeExceededSplitOperation(Context& c); @@ -86,11 +76,8 @@ private: class SplitInconsistentStateChecker : public StateChecker { public: - std::string getStatusText() const override - { return "Fix inconsistently split buckets"; } - + std::string getStatusText() const override { return "Fix inconsistently split buckets"; } Result check(Context& c) override; - const char* getName() const override { return "SplitInconsistentBuckets"; } private: @@ -115,9 +102,7 @@ class BucketStateStateChecker : public StateChecker const StateChecker::Context& c) const; public: std::string getStatusText() const override { return "Set bucket copy state"; } - Result check(Context& c) override; - const char* getName() const override { return "SetBucketState"; } }; @@ -125,15 +110,11 @@ class GarbageCollectionStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Garbage collection"; } - bool needsGarbageCollection(const Context& c) const; - Result check(Context& c) override; - const char* getName() const override { return "GarbageCollection"; } }; } } - diff --git a/storage/src/vespa/storage/distributor/statusreporterdelegate.h b/storage/src/vespa/storage/distributor/statusreporterdelegate.h index 0c836910765..93a1fe1cd48 100644 --- a/storage/src/vespa/storage/distributor/statusreporterdelegate.h +++ b/storage/src/vespa/storage/distributor/statusreporterdelegate.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 "delegatedstatusrequest.h" +#include "statusdelegator.h" #include <vespa/storageframework/storageframework.h> -#include <vespa/storage/distributor/delegatedstatusrequest.h> -#include <vespa/storage/distributor/statusdelegator.h> namespace storage { namespace distributor { @@ -20,9 +20,7 @@ public: const framework::StatusReporter& target); void registerStatusPage(); - - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h index 2cf0255bf9f..90ddb71d678 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h @@ -7,10 +7,10 @@ */ #pragma once +#include "storagecomponentregisterimpl.h" #include <vespa/storage/bucketdb/mapbucketdatabase.h> #include <vespa/storage/common/distributorcomponent.h> #include <vespa/storage/common/nodestateupdater.h> -#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> namespace storage { namespace lib { @@ -36,18 +36,13 @@ public: DistributorComponentRegisterImpl(); ~DistributorComponentRegisterImpl(); - virtual void registerDistributorComponent(DistributorManagedComponent&) override; - + void registerDistributorComponent(DistributorManagedComponent&) override; void setTimeCalculator(UniqueTimeCalculator& calc); void setDistributorConfig(const DistributorConfig&); void setVisitorConfig(const VisitorConfig&); - private: - virtual void handleNewState() override; - - virtual void setNodeStateUpdater(NodeStateUpdater& updater) override; + void handleNewState() override; + void setNodeStateUpdater(NodeStateUpdater& updater) override; }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h index 7d322f027d5..d071ba8ba3e 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h @@ -7,10 +7,10 @@ */ #pragma once +#include "storagecomponentregisterimpl.h" #include <vespa/storage/bucketdb/minimumusedbitstracker.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/common/servicelayercomponent.h> -#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> namespace storage { @@ -35,11 +35,8 @@ public: return _minUsedBitsTracker; } - virtual void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; - + void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; void setDiskCount(uint16_t count); }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp index 51a30d26def..4f2ed2bfc25 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp @@ -14,9 +14,9 @@ StorageComponentRegisterImpl::StorageComponentRegisterImpl() _index(0xffff), _loadTypes(new documentapi::LoadTypeSet), _nodeStateUpdater(0) -{ +{ } -} +StorageComponentRegisterImpl::~StorageComponentRegisterImpl() { } void StorageComponentRegisterImpl::registerStorageComponent(StorageComponent& smc) diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index cf9abbb6864..38773be167f 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -40,6 +40,7 @@ public: typedef std::unique_ptr<StorageComponentRegisterImpl> UP; StorageComponentRegisterImpl(); + ~StorageComponentRegisterImpl(); const vespalib::string& getClusterName() const { return _clusterName; } const lib::NodeType& getNodeType() const @@ -47,13 +48,12 @@ public: uint16_t getIndex() const { return _index; } document::DocumentTypeRepo::SP getTypeRepo() { return _docTypeRepo; } documentapi::LoadTypeSet::SP getLoadTypes() { return _loadTypes; } - const document::BucketIdFactory& getBucketIdFactory() - { return _bucketIdFactory; } + const document::BucketIdFactory& getBucketIdFactory() { return _bucketIdFactory; } lib::Distribution::SP getDistribution() { return _distribution; } NodeStateUpdater& getNodeStateUpdater() { assert(_nodeStateUpdater != 0); return *_nodeStateUpdater; } - virtual void registerStorageComponent(StorageComponent&) override; + void registerStorageComponent(StorageComponent&) override; void setNodeInfo(vespalib::stringref clusterName, const lib::NodeType& nodeType, @@ -68,5 +68,3 @@ public: }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index 12e2c31068a..18e0f2280f8 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -236,7 +236,7 @@ StatusWebServer::WebServer::onGetRequest(const string & tmpurl, const string &se namespace { class IndexPageReporter : public framework::HtmlStatusReporter { std::ostringstream ost; - virtual void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override { + void reportHtmlStatus(std::ostream& out,const framework::HttpUrlPath&) const override{ out << ost.str(); } diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index c89c286387b..d1a0a33da95 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -10,13 +10,12 @@ #pragma once -#include <vespa/vespalib/stllike/string.h> -#include <vespa/fastlib/net/httpserver.h> -#include <list> #include <vespa/storage/config/config-stor-status.h> #include <vespa/storageframework/storageframework.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> +#include <vespa/fastlib/net/httpserver.h> +#include <list> namespace storage { @@ -30,7 +29,7 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: public: WebServer(StatusWebServer&, uint16_t port); - virtual void onGetRequest(const string & url, + void onGetRequest(const string & url, const string & serverSpec, Fast_HTTPConnection& conn) override; const vespalib::string &getServerSpec() const { @@ -69,16 +68,12 @@ public: virtual ~StatusWebServer(); void handlePage(const framework::HttpUrlPath&, std::ostream& out); - static vespalib::string getServerSpec(const vespalib::string &requestSpec, const vespalib::string &serverSpec); - private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config) override; void getPage(const char* url, Fast_HTTPConnection& conn); - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; }; } - diff --git a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h index b785c98e505..437927ccaf1 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h @@ -22,7 +22,7 @@ struct AppKiller { }; struct RealAppKiller : public AppKiller { - virtual void kill(); + void kill() override; }; } // storage diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp index 5d58a092053..2861ab904ff 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp @@ -2,8 +2,6 @@ #include "deadlockdetector.h" #include <vespa/storage/bucketdb/storbucketdb.h> -#include <vespa/storageframework/storageframework.h> -#include <vespa/vdslib/state/nodetype.h> #include <vespa/storage/bucketmover/htmltable.h> #include <vespa/vespalib/stllike/asciistream.h> @@ -146,10 +144,10 @@ namespace { ThreadChecker(DeadLockDetector& d, const framework::MilliSecTime& time) : _detector(d), _currentTime(time) {} - virtual void visitThread(const vespalib::string& id, - const framework::ThreadProperties& tp, - const framework::ThreadTickData& tick, - DeadLockDetector::State& state) override + void visitThread(const vespalib::string& id, + const framework::ThreadProperties& tp, + const framework::ThreadTickData& tick, + DeadLockDetector::State& state) override { // In case we just got a new tick, ignore the thread if (tick._lastTickMs > _currentTime.getTime()) return; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h index 146d0ccb751..c8cb3f35ddf 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h @@ -12,9 +12,9 @@ #pragma once +#include "appkiller.h" #include <vespa/storage/common/distributorcomponent.h> #include <vespa/storage/common/servicelayercomponent.h> -#include <vespa/storage/frameworkimpl/thread/appkiller.h> #include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/sync.h> #include <map> @@ -88,13 +88,9 @@ private: StorageComponent* _component; framework::Thread::UP _thread; - virtual void run(framework::ThreadHandle&) override; - - // Status implementation - virtual void reportHtmlStatus(std::ostream& out, - const framework::HttpUrlPath&) const override; + void run(framework::ThreadHandle&) override; + void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override; vespalib::string getBucketLockInfo() const; }; } - diff --git a/storage/src/vespa/storage/persistence/diskthread.h b/storage/src/vespa/storage/persistence/diskthread.h index 3626bbb2c70..a1af83a65ef 100644 --- a/storage/src/vespa/storage/persistence/diskthread.h +++ b/storage/src/vespa/storage/persistence/diskthread.h @@ -60,7 +60,7 @@ public: bool operator==(const OperationCount& c) const { return (count == c.count && pending == c.pending); } - void print(std::ostream& out, bool, const std::string&) const + void print(std::ostream& out, bool, const std::string&) const override { out << "OperationCount(" << count << (pending ? ", pending" : "") << ")"; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h index e658599a3dc..b549aca35b6 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h @@ -13,9 +13,9 @@ #pragma once +#include "mergestatus.h" #include <vespa/document/bucket/bucketid.h> #include <ostream> -#include <vespa/storage/persistence/filestorage/mergestatus.h> #include <vespa/storage/storageutil/resumeguard.h> #include <vespa/storage/common/messagesender.h> diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h index a6942102c42..39d9a60a950 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h @@ -8,6 +8,8 @@ #pragma once +#include "filestorhandler.h" +#include "filestormetrics.h" #include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> #include <vespa/document/bucket/bucketid.h> @@ -20,8 +22,7 @@ #include <vespa/storage/common/storagelinkqueued.h> #include <vespa/config-stor-filestor.h> #include <vespa/storage/persistence/diskthread.h> -#include <vespa/storage/persistence/filestorage/filestorhandler.h> -#include <vespa/storage/persistence/filestorage/filestormetrics.h> + #include <vespa/storage/persistence/providershutdownwrapper.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storage/common/nodestateupdater.h> @@ -104,7 +105,7 @@ public: ServiceLayerComponentRegister&); ~FileStorManager(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; // Return true if we are currently merging the given bucket. bool isMerging(const document::BucketId& bucket) const; @@ -122,8 +123,7 @@ public: private: void configure(std::unique_ptr<vespa::config::content::StorFilestorConfig> config) override; - void replyWithBucketNotFound(api::StorageMessage&, - const document::BucketId&); + void replyWithBucketNotFound(api::StorageMessage&, const document::BucketId&); void replyDroppedOperation(api::StorageMessage& msg, const document::BucketId& bucket, @@ -135,17 +135,12 @@ private: api::StorageMessage& msg, const char* callerId); - bool validateApplyDiffCommandBucket(api::StorageMessage& msg, - const StorBucketDatabase::WrappedEntry&); - bool validateDiffReplyBucket(const StorBucketDatabase::WrappedEntry&, - const document::BucketId&); + bool validateApplyDiffCommandBucket(api::StorageMessage& msg, const StorBucketDatabase::WrappedEntry&); + bool validateDiffReplyBucket(const StorBucketDatabase::WrappedEntry&, const document::BucketId&); - StorBucketDatabase::WrappedEntry mapOperationToDisk( - api::StorageMessage&, const document::BucketId&); - StorBucketDatabase::WrappedEntry mapOperationToBucketAndDisk( - api::BucketCommand&, const document::DocumentId*); - bool handlePersistenceMessage(const std::shared_ptr<api::StorageMessage>&, - uint16_t disk); + StorBucketDatabase::WrappedEntry mapOperationToDisk(api::StorageMessage&, const document::BucketId&); + StorBucketDatabase::WrappedEntry mapOperationToBucketAndDisk(api::BucketCommand&, const document::DocumentId*); + bool handlePersistenceMessage(const std::shared_ptr<api::StorageMessage>&, uint16_t disk); // Document operations bool onPut(const std::shared_ptr<api::PutCommand>&) override; @@ -175,23 +170,15 @@ private: bool onInternal(const std::shared_ptr<api::InternalCommand>&) override; bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; - void handleAbortBucketOperations( - const std::shared_ptr<AbortBucketOperationsCommand>&); - + void handleAbortBucketOperations(const std::shared_ptr<AbortBucketOperationsCommand>&); void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; void sendReply(const std::shared_ptr<api::StorageReply>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void onClose() override; void onFlush(bool downwards) override; - - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - - virtual void storageDistributionChanged() override; - + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + void storageDistributionChanged() override; void updateState(); }; } // storage - diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h index 9967fc24c7d..ff7e9e5dfb4 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h @@ -41,7 +41,7 @@ public: const std::vector<api::ApplyBucketDiffCommand::Entry>& part, uint16_t hasMask); void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; bool isFirstNode() const { return (reply.get() != 0); } }; diff --git a/storage/src/vespa/storage/persistence/persistencethread.h b/storage/src/vespa/storage/persistence/persistencethread.h index f4c70353fab..d2c4dba3a5f 100644 --- a/storage/src/vespa/storage/persistence/persistencethread.h +++ b/storage/src/vespa/storage/persistence/persistencethread.h @@ -2,15 +2,15 @@ #pragma once -#include <vespa/storage/common/statusmessages.h> -#include <vespa/storage/persistence/diskthread.h> -#include <vespa/storage/persistence/processallhandler.h> -#include <vespa/storage/persistence/mergehandler.h> -#include <vespa/storage/persistence/diskmoveoperationhandler.h> +#include "diskthread.h" +#include "processallhandler.h" +#include "mergehandler.h" +#include "diskmoveoperationhandler.h" +#include "persistenceutil.h" +#include "providershutdownwrapper.h" #include <vespa/storageframework/storageframework.h> #include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/persistence/persistenceutil.h> -#include <vespa/storage/persistence/providershutdownwrapper.h> +#include <vespa/storage/common/statusmessages.h> namespace storage { @@ -35,7 +35,7 @@ public: bool isMerging(const BucketId& bucket) const; - virtual framework::Thread& getThread() override { return *_thread; } + framework::Thread& getThread() override { return *_thread; } MessageTracker::UP handlePut(api::PutCommand& cmd); MessageTracker::UP handleRemove(api::RemoveCommand& cmd); @@ -99,10 +99,8 @@ private: void processMessages(FileStorHandler::LockedMessage & lock); // Thread main loop - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; bool checkForError(const spi::Result& response, MessageTracker& tracker); - spi::Bucket getBucket(const DocumentId& id, const BucketId& bucket) const; void flushAllReplies(const document::BucketId& bucketId, @@ -114,4 +112,3 @@ private: }; } // storage - diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp index 2095e19261c..c08b19a9e45 100644 --- a/storage/src/vespa/storage/persistence/processallhandler.cpp +++ b/storage/src/vespa/storage/persistence/processallhandler.cpp @@ -2,7 +2,6 @@ #include "processallhandler.h" #include "bucketprocessor.h" -#include <vespa/storage/common/bucketmessages.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp index 8d816760815..62039f36133 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp +++ b/storage/src/vespa/storage/persistence/splitbitdetector.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/persistence/splitbitdetector.h> #include <vespa/storage/persistence/bucketprocessor.h> #include <vespa/document/bucket/bucketidfactory.h> diff --git a/storage/src/vespa/storage/storageserver/CMakeLists.txt b/storage/src/vespa/storage/storageserver/CMakeLists.txt index 17638f55b3a..5ca7e074e6b 100644 --- a/storage/src/vespa/storage/storageserver/CMakeLists.txt +++ b/storage/src/vespa/storage/storageserver/CMakeLists.txt @@ -20,6 +20,7 @@ vespa_add_library(storage_storageserver distributornode.cpp servicelayernode.cpp statereporter.cpp + storagemetricsset.cpp changedbucketownershiphandler.cpp INSTALL lib64 DEPENDS diff --git a/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h b/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h index 0e33c8c86c6..7d5b64c1d17 100644 --- a/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h +++ b/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h @@ -9,11 +9,14 @@ #pragma once +#include <cstdint> +#include <string> + namespace storage { class ApplicationGenerationFetcher { public: - virtual ~ApplicationGenerationFetcher() {}; + virtual ~ApplicationGenerationFetcher() {} virtual int64_t getGeneration() const = 0; virtual std::string getComponentName() const = 0; diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h index 6b87be804d0..fd9516a85aa 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h @@ -112,47 +112,29 @@ public: ServiceLayerComponentRegister&); ~BucketIntegrityChecker(); - virtual void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void onClose() override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; SchedulingOptions& getSchedulingOptions() { return _scheduleOptions; } - bool isWorkingOnCycle() const; - uint32_t getCycleCount() const; /** Give thread a bump by signalling it. */ void bump() const; - void setMaxThreadWaitTime(framework::MilliSecTime milliSecs) - { _maxThreadWaitTime = milliSecs; } + void setMaxThreadWaitTime(framework::MilliSecTime milliSecs) { _maxThreadWaitTime = milliSecs; } framework::Clock& getClock() { return _component.getClock(); } private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>) override; - + void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>) override; void onDoneInit() override; - bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&) override; - bool onNotifyBucketChangeReply( - const std::shared_ptr<api::NotifyBucketChangeReply>&) override - { return true; } - - SchedulingOptions::RunState getCurrentRunState( - framework::SecondTime time) const; - - virtual void run(framework::ThreadHandle&) override; - + bool onNotifyBucketChangeReply(const std::shared_ptr<api::NotifyBucketChangeReply>&) override { return true; } + SchedulingOptions::RunState getCurrentRunState(framework::SecondTime time) const; + void run(framework::ThreadHandle&) override; uint32_t getTotalPendingCount() const; - - // Status::Reporter implementation - virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const override; - + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; } - diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 31100de78d1..3cae63d3586 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. /** - - -* @class CommunicationManager + * @class CommunicationManager * @ingroup storageserver * * @brief Class used for sending messages over the network. @@ -12,26 +10,26 @@ #pragma once -#include <vespa/vespalib/util/document_runnable.h> -#include <map> -#include <memory> -#include <queue> -#include <vector> -#include <atomic> -#include <vespa/metrics/metrics.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/storageframework/storageframework.h> +#include <vespa/documentapi/documentapi.h> +#include "communicationmanagermetrics.h" +#include "messageallocationtypes.h" +#include "documentapiconverter.h" #include <vespa/storage/common/storagelink.h> #include <vespa/storage/config/config-stor-communicationmanager.h> +#include <vespa/storageframework/storageframework.h> +#include <vespa/storageframework/storageframework.h> #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> -#include <vespa/documentapi/documentapi.h> -#include <vespa/storage/storageserver/communicationmanagermetrics.h> -#include <vespa/storage/storageserver/messageallocationtypes.h> -#include "documentapiconverter.h" -#include <vespa/storageframework/storageframework.h> +#include <vespa/messagebus/rpcmessagebus.h> +#include <vespa/metrics/metrics.h> +#include <vespa/vespalib/util/document_runnable.h> +#include <map> +#include <memory> +#include <queue> +#include <vector> +#include <atomic> namespace storage { @@ -189,43 +187,32 @@ private: public: CommunicationManager(StorageComponentRegister& compReg, const config::ConfigUri & configUri); - virtual ~CommunicationManager(); + ~CommunicationManager(); void enqueue(const std::shared_ptr<api::StorageMessage> & msg); - mbus::RPCMessageBus& getMessageBus() { assert(_mbus.get()); return *_mbus; } - const PriorityConverter& getPriorityConverter() const { return _docApiConverter.getPriorityConverter(); } /** * From StorageLink. Called when messages arrive from storage * modules. Will convert and dispatch messages to MessageServer */ - virtual bool onUp(const std::shared_ptr<api::StorageMessage>&) override; - + bool onUp(const std::shared_ptr<api::StorageMessage>&) override; bool sendCommand(const std::shared_ptr<api::StorageCommand>& command); - bool sendReply(const std::shared_ptr<api::StorageReply>& reply); void sendDirectRPCReply(RPCRequestWrapper& request, const std::shared_ptr<api::StorageReply>& reply); void sendMessageBusReply(StorageTransportContext& context, const std::shared_ptr<api::StorageReply>& reply); // Pump thread void run(framework::ThreadHandle&) override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - /** Get messages from messagebus. */ void handleMessage(std::unique_ptr<mbus::Message> msg) override; - void sendMessageBusMessage(const std::shared_ptr<api::StorageCommand>& msg, - std::unique_ptr<mbus::Message> mbusMsg, const mbus::Route& route); + std::unique_ptr<mbus::Message> mbusMsg, const mbus::Route& route); - /** Get replies from messagebus. */ void handleReply(std::unique_ptr<mbus::Reply> msg) override; - void updateMessagebusProtocol(const document::DocumentTypeRepo::SP &repo); - }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index 03792d8fb56..31fe8fe7878 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -8,9 +8,9 @@ #pragma once +#include "distributornodecontext.h" +#include "storagenode.h" #include <vespa/storage/common/distributorcomponent.h> -#include <vespa/storage/storageserver/distributornodecontext.h> -#include <vespa/storage/storageserver/storagenode.h> #include <vespa/storageframework/generic/thread/tickingthread.h> namespace storage { @@ -41,19 +41,16 @@ public: StorageLink::UP communicationManager = StorageLink::UP()); ~DistributorNode(); - virtual const lib::NodeType& getNodeType() const override - { return lib::NodeType::DISTRIBUTOR; } - - virtual ResumeGuard pause() override; + const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; } + ResumeGuard pause() override; void handleConfigChange(vespa::config::content::core::StorDistributormanagerConfig&); void handleConfigChange(vespa::config::content::core::StorVisitordispatcherConfig&); private: - virtual void initializeNodeSpecific() override; - virtual StorageLink::UP createChain() override; - - virtual api::Timestamp getUniqueTimestamp() override; + void initializeNodeSpecific() override; + StorageLink::UP createChain() override; + api::Timestamp getUniqueTimestamp() override; /** * Shut down necessary distributor-specific components before shutting @@ -63,4 +60,3 @@ private: }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index ebfa10fe814..577fedb58e1 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -1,15 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/storageserver/mergethrottler.h> - +#include "mergethrottler.h" +#include "storagemetricsset.h" #include <iostream> #include <sstream> -#include <iterator> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/persistence/messages.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/log/log.h> LOG_SETUP(".mergethrottler"); @@ -46,6 +43,71 @@ const mbus::string DummyMbusMessage<Base>::NAME = "SkyNet"; } +MergeThrottler::ChainedMergeState::ChainedMergeState() + : _cmd(), + _cmdString(), + _clusterStateVersion(0), + _inCycle(false), + _executingLocally(false), + _unwinding(false), + _cycleBroken(false), + _aborted(false) +{ } + +MergeThrottler::ChainedMergeState::ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing) + : _cmd(cmd), + _cmdString(cmd->toString()), + _clusterStateVersion(static_cast<const api::MergeBucketCommand&>(*cmd).getClusterStateVersion()), + _inCycle(false), + _executingLocally(executing), + _unwinding(false), + _cycleBroken(false), + _aborted(false) +{ } +MergeThrottler::ChainedMergeState::~ChainedMergeState() {} + +MergeThrottler::Metrics::Metrics(metrics::MetricSet* owner) + : metrics::MetricSet("mergethrottler", "", "", owner), + averageQueueWaitingTime("averagequeuewaitingtime", "", "Average time a merge spends in the throttler queue", this), + chaining("mergechains", this), + local("locallyexecutedmerges", this) +{ } +MergeThrottler::Metrics::~Metrics() {} + +MergeThrottler::MergeFailureMetrics::MergeFailureMetrics(metrics::MetricSet* owner) + : metrics::MetricSet("failures", "", "Detailed failure statistics", owner), + sum("total", "", "Sum of all failures", this), + notready("notready", "", "The number of merges discarded because distributor was not ready", this), + timeout("timeout", "", "The number of merges that failed because they timed out towards storage", this), + aborted("aborted", "", "The number of merges that failed because the storage node was (most likely) shutting down", this), + wrongdistribution("wrongdistribution", "", "The number of merges that were discarded (flushed) because they were initiated at an older cluster state than the current", this), + bucketnotfound("bucketnotfound", "", "The number of operations that failed because the bucket did not exist", this), + busy("busy", "", "The number of merges that failed because the storage node was busy", this), + exists("exists", "", "The number of merges that were rejected due to a merge operation for their bucket already being processed", this), + rejected("rejected", "", "The number of merges that were rejected", this), + other("other", "", "The number of other failures", this) +{ + sum.addMetricToSum(notready); + sum.addMetricToSum(timeout); + sum.addMetricToSum(aborted); + sum.addMetricToSum(wrongdistribution); + sum.addMetricToSum(bucketnotfound); + sum.addMetricToSum(busy); + sum.addMetricToSum(exists); + sum.addMetricToSum(rejected); + sum.addMetricToSum(other); +} +MergeThrottler::MergeFailureMetrics::~MergeFailureMetrics() { } + + +MergeThrottler::MergeOperationMetrics::MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner) + : metrics::MetricSet(name, "", vespalib::make_string("Statistics for %s", name.c_str()), owner), + ok("ok", "", vespalib::make_string("The number of successful merges for '%s'", name.c_str()), this), + failures(this) +{ +} +MergeThrottler::MergeOperationMetrics::~MergeOperationMetrics() { } + MergeThrottler::MergeNodeSequence::MergeNodeSequence( const api::MergeBucketCommand& cmd, uint16_t thisIndex) diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.h b/storage/src/vespa/storage/storageserver/mergethrottler.h index 8ee4ca7be71..74ffe095d7c 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.h +++ b/storage/src/vespa/storage/storageserver/mergethrottler.h @@ -7,11 +7,6 @@ */ #pragma once -#include <map> -#include <utility> -#include <vector> -#include <set> -#include <memory> #include <vespa/vespalib/util/document_runnable.h> #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/common/storagelink.h> @@ -48,37 +43,8 @@ public: metrics::LongCountMetric rejected; metrics::LongCountMetric other; - MergeFailureMetrics(metrics::MetricSet* owner) - : metrics::MetricSet("failures", "", "Detailed failure statistics", owner), - sum("total", "", "Sum of all failures", this), - notready("notready", "", "The number of merges discarded " - "because distributor was not ready", this), - timeout("timeout", "", "The number of merges that failed because " - "they timed out towards storage", this), - aborted("aborted", "", "The number of merges that failed " - "because the storage node was (most likely) shutting down", this), - wrongdistribution("wrongdistribution", "", "The number of merges that " - "were discarded (flushed) because they were initiated at an " - "older cluster state than the current", this), - bucketnotfound("bucketnotfound", "", "The number of operations that failed " - "because the bucket did not exist", this), - busy("busy", "", "The number of merges that failed because the " - "storage node was busy", this), - exists("exists", "", "The number of merges that were rejected due to a " - "merge operation for their bucket already being processed", this), - rejected("rejected", "", "The number of merges that were rejected", this), - other("other", "", "The number of other failures", this) - { - sum.addMetricToSum(notready); - sum.addMetricToSum(timeout); - sum.addMetricToSum(aborted); - sum.addMetricToSum(wrongdistribution); - sum.addMetricToSum(bucketnotfound); - sum.addMetricToSum(busy); - sum.addMetricToSum(exists); - sum.addMetricToSum(rejected); - sum.addMetricToSum(other); - } + MergeFailureMetrics(metrics::MetricSet* owner); + ~MergeFailureMetrics(); }; class MergeOperationMetrics : public metrics::MetricSet @@ -87,12 +53,8 @@ public: metrics::LongCountMetric ok; MergeFailureMetrics failures; - MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner) - : metrics::MetricSet(name, "", vespalib::make_string("Statistics for %s", name.c_str()), owner), - ok("ok", "", vespalib::make_string("The number of successful merges for '%s'", name.c_str()), this), - failures(this) - { - } + MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner); + ~MergeOperationMetrics(); }; class Metrics : public metrics::MetricSet @@ -102,15 +64,8 @@ public: MergeOperationMetrics chaining; MergeOperationMetrics local; - Metrics(metrics::MetricSet* owner = 0) - : metrics::MetricSet("mergethrottler", "", "", owner), - averageQueueWaitingTime( - "averagequeuewaitingtime", "", "Average time a merge spends in " - "the throttler queue", this), - chaining("mergechains", this), - local("locallyexecutedmerges", this) - { - } + Metrics(metrics::MetricSet* owner = 0); + ~Metrics(); }; private: @@ -151,30 +106,9 @@ private: bool _cycleBroken; bool _aborted; - ChainedMergeState() - : _cmd(), - _cmdString(), - _clusterStateVersion(0), - _inCycle(false), - _executingLocally(false), - _unwinding(false), - _cycleBroken(false), - _aborted(false) - { - } - - ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing = false) - : _cmd(cmd), - _cmdString(cmd->toString()), - _clusterStateVersion(static_cast<const api::MergeBucketCommand&>( - *cmd).getClusterStateVersion()), - _inCycle(false), - _executingLocally(executing), - _unwinding(false), - _cycleBroken(false), - _aborted(false) - { - } + ChainedMergeState(); + ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing = false); + ~ChainedMergeState(); // Use default copy-constructor/assignment operator bool isExecutingLocally() const { return _executingLocally; } @@ -239,9 +173,7 @@ public: * windowSizeIncrement used for allowing unit tests to start out with more * than 1 as their window size. */ - MergeThrottler(const config::ConfigUri & configUri, - StorageComponentRegister&); - + MergeThrottler(const config::ConfigUri & configUri, StorageComponentRegister&); ~MergeThrottler(); /** Implements document::Runnable::run */ @@ -267,12 +199,8 @@ public: vespalib::Lock& getStateLock() { return _stateLock; } Metrics& getMetrics() { return *_metrics; } - std::size_t getMaxQueueSize() const { return _maxQueueSize; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - // HtmlStatusReporter implementation void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; private: friend class ThreadRendezvousGuard; // impl in .cpp file @@ -285,9 +213,7 @@ private: std::size_t _sortedIndex; // Index of current storage node in the sorted node sequence const uint16_t _thisIndex; // Index of the current storage node - MergeNodeSequence( - const api::MergeBucketCommand& cmd, - uint16_t thisIndex); + MergeNodeSequence(const api::MergeBucketCommand& cmd, uint16_t thisIndex); std::size_t getSortedIndex() const { return _sortedIndex; } const std::vector<api::MergeBucketCommand::Node>& getSortedNodes() const { @@ -332,13 +258,8 @@ private: // NOTE: unless explicitly specified, all the below functions require // _sync lock to be held upon call (usually implicitly via MessageGuard) - void handleMessageDown( - const std::shared_ptr<api::StorageMessage>& msg, - MessageGuard& msgGuard); - - void handleMessageUp( - const std::shared_ptr<api::StorageMessage>& msg, - MessageGuard& msgGuard); + void handleMessageDown(const std::shared_ptr<api::StorageMessage>& msg, MessageGuard& msgGuard); + void handleMessageUp(const std::shared_ptr<api::StorageMessage>& msg, MessageGuard& msgGuard); /** * Handle the receival of MergeBucketReply, be it from another node @@ -372,17 +293,13 @@ private: * * Precondition: no existing merge state exists for msg's bucketid. */ - void processNewMergeCommand( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + void processNewMergeCommand(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * Precondition: an existing merge state exists for msg's bucketid. * @return true if message was handled, false otherwise (see onUp/onDown). */ - bool processCycledMergeCommand( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + bool processCycledMergeCommand(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * Forwards the given MergeBucketCommand to the storage node given @@ -403,10 +320,7 @@ private: * @return Highest priority waiting merge or null SP if queue is empty */ api::StorageMessage::SP getNextQueuedMerge(); - - void enqueueMerge( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + void enqueueMerge(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * @return true if throttle policy says at least one additional @@ -434,25 +348,15 @@ private: * Immediately reject all queued merges whose cluster state version is * less than that of rejectLessThanVersion */ - void rejectOutdatedQueuedMerges(MessageGuard& msgGuard, - uint32_t rejectLessThanVersion); - + void rejectOutdatedQueuedMerges(MessageGuard& msgGuard, uint32_t rejectLessThanVersion); bool attemptProcessNextQueuedMerge(MessageGuard& msgGuard); - bool processQueuedMerges(MessageGuard& msgGuard); - void handleRendezvous(vespalib::MonitorGuard& guard); - void rendezvousWithWorkerThread(vespalib::MonitorGuard&); - void releaseWorkerThreadRendezvous(vespalib::MonitorGuard&); - bool isDiffCommand(const api::StorageMessage& msg) const; - bool isMergeCommand(const api::StorageMessage& msg) const; - bool isMergeReply(const api::StorageMessage& msg) const; - bool bucketIsUnknownOrAborted(const document::BucketId& bucket) const; std::shared_ptr<api::StorageMessage> makeAbortReply( @@ -460,8 +364,7 @@ private: vespalib::stringref reason) const; void handleOutdatedMerges(const api::SetSystemStateCommand&); - void rejectOperationsInThreadQueue(MessageGuard&, - uint32_t minimumStateVersion); + void rejectOperationsInThreadQueue(MessageGuard&, uint32_t minimumStateVersion); void markActiveMergesAsAborted(uint32_t minimumStateVersion); // const function, but metrics are mutable @@ -471,4 +374,3 @@ private: }; } // namespace storage - diff --git a/storage/src/vespa/storage/storageserver/opslogger.h b/storage/src/vespa/storage/storageserver/opslogger.h index 57f304a04aa..905c0fd4e85 100644 --- a/storage/src/vespa/storage/storageserver/opslogger.h +++ b/storage/src/vespa/storage/storageserver/opslogger.h @@ -27,20 +27,15 @@ public: ~OpsLogger(); void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool onPutReply(const std::shared_ptr<api::PutReply>& msg) override; bool onUpdateReply(const std::shared_ptr<api::UpdateReply>& msg) override; bool onRemoveReply(const std::shared_ptr<api::RemoveReply>& msg) override; bool onGetReply(const std::shared_ptr<api::GetReply>& msg) override; /** Ignore all replies on the way down the storage chain. */ - bool onDown(const std::shared_ptr<api::StorageMessage>&) override - { return false; }; - + bool onDown(const std::shared_ptr<api::StorageMessage>&) override { return false; }; void configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config) override; - private: vespalib::Lock _lock; std::string _fileName; @@ -51,4 +46,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h index 028168937b5..974b8ca2393 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.h +++ b/storage/src/vespa/storage/storageserver/statemanager.h @@ -72,23 +72,19 @@ public: void tick(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - /** Implementation of HtmlStatusReporter */ - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + lib::NodeState::CSP getReportedNodeState() const override; + lib::NodeState::CSP getCurrentNodeState() const override; + lib::ClusterState::CSP getSystemState() const override; - virtual lib::NodeState::CSP getReportedNodeState() const override; - virtual lib::NodeState::CSP getCurrentNodeState() const override; - virtual lib::ClusterState::CSP getSystemState() const override; - - virtual void addStateListener(StateListener&) override; - virtual void removeStateListener(StateListener&) override; - - virtual Lock::SP grabStateChangeLock() override; - virtual void setReportedNodeState(const lib::NodeState& state) override; + void addStateListener(StateListener&) override; + void removeStateListener(StateListener&) override; + Lock::SP grabStateChangeLock() override; + void setReportedNodeState(const lib::NodeState& state) override; void setClusterState(const lib::ClusterState& c); - HostInfo& getHostInfo() { return *_hostInfo; } private: @@ -136,10 +132,7 @@ private: */ std::string getNodeInfo() const; - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; }; } // storage - - diff --git a/storage/src/vespa/storage/storageserver/statereporter.h b/storage/src/vespa/storage/storageserver/statereporter.h index 51a9e93a197..c46a878ef40 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.h +++ b/storage/src/vespa/storage/storageserver/statereporter.h @@ -10,11 +10,11 @@ #pragma once -#include <vespa/metrics/metrics.h> -#include <vespa/metrics/state_api_adapter.h> +#include "applicationgenerationfetcher.h" #include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/storageserver/applicationgenerationfetcher.h> #include <vespa/storageframework/storageframework.h> +#include <vespa/metrics/metrics.h> +#include <vespa/metrics/state_api_adapter.h> #include <vespa/vespalib/net/metrics_producer.h> #include <vespa/vespalib/net/state_api.h> @@ -37,11 +37,8 @@ public: const std::string& name = "status"); ~StateReporter(); - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; - bool reportStatus(std::ostream& out, - const framework::HttpUrlPath& path) const override; - + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream& out, const framework::HttpUrlPath& path) const override; private: metrics::MetricManager &_manager; metrics::StateApiAdapter _metricsAdapter; @@ -50,16 +47,10 @@ private: ApplicationGenerationFetcher& _generationFetcher; std::string _name; - // Implements vespalib::MetricsProducer - virtual vespalib::string getMetrics(const vespalib::string &consumer) override; - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override; - - // Implements vespalib::HealthProducer - virtual Health getHealth() const override; - - // Implements vespalib::ComponentConfigProducer - virtual void getComponentConfig(Consumer &consumer) override; + vespalib::string getMetrics(const vespalib::string &consumer) override; + vespalib::string getTotalMetrics(const vespalib::string &consumer) override; + Health getHealth() const override; + void getComponentConfig(Consumer &consumer) override; }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/storagemetricsset.cpp b/storage/src/vespa/storage/storageserver/storagemetricsset.cpp new file mode 100644 index 00000000000..aa57e3ebcd5 --- /dev/null +++ b/storage/src/vespa/storage/storageserver/storagemetricsset.cpp @@ -0,0 +1,77 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "storagemetricsset.h" +#include <vespa/document/fieldvalue/serializablearray.h> + +namespace storage { + +MessageMemoryUseMetricSet::MessageMemoryUseMetricSet(metrics::MetricSet* owner) + : metrics::MetricSet("message_memory_use", "memory", "Message use from storage messages", owner), + total("total", "memory", "Message use from storage messages", this), + lowpri("lowpri", "memory", "Message use from low priority storage messages", this), + normalpri("normalpri", "memory", "Message use from normal priority storage messages", this), + highpri("highpri", "memory", "Message use from high priority storage messages", this), + veryhighpri("veryhighpri", "memory", "Message use from very high priority storage messages", this) +{ } +MessageMemoryUseMetricSet::~MessageMemoryUseMetricSet() {} + +DocumentSerializationMetricSet::DocumentSerializationMetricSet(metrics::MetricSet* owner) + : metrics::MetricSet("document_serialization", "docserialization", + "Counts of document serialization of various types", owner), + usedCachedSerializationCount( + "cached_serialization_count", "docserialization", + "Number of times we didn't need to serialize the document as " + "we already had serialized version cached", this), + compressedDocumentCount( + "compressed_serialization_count", "docserialization", + "Number of times we compressed document when serializing", + this), + compressionDidntHelpCount( + "compressed_didnthelp_count", "docserialization", + "Number of times we compressed document when serializing, but " + "the compressed version was bigger, so it was dumped", this), + uncompressableCount( + "uncompressable_serialization_count", "docserialization", + "Number of times we didn't attempt compression as document " + "had already been tagged uncompressable", this), + serializedUncompressed( + "uncompressed_serialization_count", "docserialization", + "Number of times we serialized a document uncompressed", this), + inputWronglySerialized( + "input_wrongly_serialized_count", "docserialization", + "Number of times we reserialized a document because the " + "compression it had in cache did not match what was configured", + this) +{ } +DocumentSerializationMetricSet::~DocumentSerializationMetricSet() { } + +StorageMetricSet::StorageMetricSet() + : metrics::MetricSet("server", "memory", + "Metrics for VDS applications"), + memoryUse("memoryusage", "memory", "", this), + memoryUse_messages(this), + memoryUse_visiting("memoryusage_visiting", "memory", + "Message use from visiting", this), + documentSerialization(this) +{ } +StorageMetricSet::~StorageMetricSet() { } + +void StorageMetricSet::updateMetrics() { + document::SerializableArray::Statistics stats( + document::SerializableArray::getStatistics()); + + documentSerialization.usedCachedSerializationCount.set( + stats._usedCachedSerializationCount); + documentSerialization.compressedDocumentCount.set( + stats._compressedDocumentCount); + documentSerialization.compressionDidntHelpCount.set( + stats._compressionDidntHelpCount); + documentSerialization.uncompressableCount.set( + stats._uncompressableCount); + documentSerialization.serializedUncompressed.set( + stats._serializedUncompressed); + documentSerialization.inputWronglySerialized.set( + stats._inputWronglySerialized); +} + +} // storage diff --git a/storage/src/vespa/storage/storageserver/storagemetricsset.h b/storage/src/vespa/storage/storageserver/storagemetricsset.h index 18be3e21ada..f7083705763 100644 --- a/storage/src/vespa/storage/storageserver/storagemetricsset.h +++ b/storage/src/vespa/storage/storageserver/storagemetricsset.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/metrics/metrics.h> -#include <vespa/document/fieldvalue/serializablearray.h> namespace storage { @@ -16,22 +15,8 @@ public: metrics::LongValueMetric highpri; metrics::LongValueMetric veryhighpri; - MessageMemoryUseMetricSet(metrics::MetricSet* owner) - : metrics::MetricSet("message_memory_use", "memory", - "Message use from storage messages", owner), - total("total", "memory", - "Message use from storage messages", this), - lowpri("lowpri", "memory", - "Message use from low priority storage messages", this), - normalpri("normalpri", "memory", - "Message use from normal priority storage messages", this), - highpri("highpri", "memory", - "Message use from high priority storage messages", this), - veryhighpri("veryhighpri", "memory", - "Message use from very high priority storage messages", this) - { - } - + MessageMemoryUseMetricSet(metrics::MetricSet* owner); + ~MessageMemoryUseMetricSet(); }; struct DocumentSerializationMetricSet : public metrics::MetricSet @@ -43,36 +28,8 @@ struct DocumentSerializationMetricSet : public metrics::MetricSet metrics::LongCountMetric serializedUncompressed; metrics::LongCountMetric inputWronglySerialized; - DocumentSerializationMetricSet(metrics::MetricSet* owner) - : metrics::MetricSet("document_serialization", "docserialization", - "Counts of document serialization of various types", owner), - usedCachedSerializationCount( - "cached_serialization_count", "docserialization", - "Number of times we didn't need to serialize the document as " - "we already had serialized version cached", this), - compressedDocumentCount( - "compressed_serialization_count", "docserialization", - "Number of times we compressed document when serializing", - this), - compressionDidntHelpCount( - "compressed_didnthelp_count", "docserialization", - "Number of times we compressed document when serializing, but " - "the compressed version was bigger, so it was dumped", this), - uncompressableCount( - "uncompressable_serialization_count", "docserialization", - "Number of times we didn't attempt compression as document " - "had already been tagged uncompressable", this), - serializedUncompressed( - "uncompressed_serialization_count", "docserialization", - "Number of times we serialized a document uncompressed", this), - inputWronglySerialized( - "input_wrongly_serialized_count", "docserialization", - "Number of times we reserialized a document because the " - "compression it had in cache did not match what was configured", - this) - { - } - + DocumentSerializationMetricSet(metrics::MetricSet* owner); + ~DocumentSerializationMetricSet(); }; struct StorageMetricSet : public metrics::MetricSet @@ -82,34 +39,9 @@ struct StorageMetricSet : public metrics::MetricSet metrics::LongValueMetric memoryUse_visiting; DocumentSerializationMetricSet documentSerialization; - StorageMetricSet() - : metrics::MetricSet("server", "memory", - "Metrics for VDS applications"), - memoryUse("memoryusage", "memory", "", this), - memoryUse_messages(this), - memoryUse_visiting("memoryusage_visiting", "memory", - "Message use from visiting", this), - documentSerialization(this) - { - } - - void updateMetrics() { - document::SerializableArray::Statistics stats( - document::SerializableArray::getStatistics()); - - documentSerialization.usedCachedSerializationCount.set( - stats._usedCachedSerializationCount); - documentSerialization.compressedDocumentCount.set( - stats._compressedDocumentCount); - documentSerialization.compressionDidntHelpCount.set( - stats._compressionDidntHelpCount); - documentSerialization.uncompressableCount.set( - stats._uncompressableCount); - documentSerialization.serializedUncompressed.set( - stats._serializedUncompressed); - documentSerialization.inputWronglySerialized.set( - stats._inputWronglySerialized); - } + StorageMetricSet(); + ~StorageMetricSet(); + void updateMetrics(); }; } // storage diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index 5df29191489..5eea62a17ad 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -12,9 +12,10 @@ #pragma once +#include "storagemetricsset.h" +#include "storagenodecontext.h" +#include "applicationgenerationfetcher.h" #include <vespa/document/bucket/bucketidfactory.h> -#include <memory> -#include <string> #include <vespa/storage/config/config-stor-server.h> #include <vespa/config/helper/legacysubscriber.h> @@ -34,9 +35,6 @@ #include <vespa/storageframework/defaultimplementation/memory/memorymanager.h> #include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h> #include <vespa/storage/frameworkimpl/memory/memorystatusviewer.h> -#include <vespa/storage/storageserver/applicationgenerationfetcher.h> -#include <vespa/storage/storageserver/storagenodecontext.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storage/visiting/visitormessagesessionfactory.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storage/storageutil/resumeguard.h> @@ -78,12 +76,9 @@ public: virtual ~StorageNode(); virtual const lib::NodeType& getNodeType() const = 0; - bool attemptedStopped() const; - - virtual void notifyDoneInitializing() override; + void notifyDoneInitializing() override; void waitUntilInitialized(uint32_t timeoutSeconds = 15); - void updateMetrics(const MetricLockGuard & guard) override; /** Updates the document type repo. */ @@ -94,17 +89,12 @@ public: * is alive, no calls will be made towards the persistence provider. */ virtual ResumeGuard pause() = 0; - void requestShutdown(vespalib::stringref reason) override; - - void - notifyPartitionDown(int partId, vespalib::stringref reason); - + void notifyPartitionDown(int partId, vespalib::stringref reason); DoneInitializeHandler& getDoneInitializeHandler() { return *this; } - // For testing + // For testing StorageLink* getChain() { return _chain.get(); } - virtual void initializeStatusWebServer(); private: @@ -140,10 +130,10 @@ private: std::unique_ptr<StorageLink> _chain; /** Implementation of config callbacks. */ - virtual void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>) override; + void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>) override; virtual void configure(std::unique_ptr<document::DocumenttypesConfig> config, bool hasChanged, int64_t generation); void updateUpgradeFlag(const vespa::config::content::UpgradingConfig&); @@ -184,8 +174,6 @@ protected: virtual void handleLiveConfigUpdate(); void shutdown(); virtual void removeConfigSubscriptions(); - }; } // storage - diff --git a/storage/src/vespa/storage/storageutil/palette.h b/storage/src/vespa/storage/storageutil/palette.h index fe42eae0d31..338d8a3add7 100644 --- a/storage/src/vespa/storage/storageutil/palette.h +++ b/storage/src/vespa/storage/storageutil/palette.h @@ -11,6 +11,8 @@ #pragma once #include <vector> +#include <cstdint> +#include <iosfwd> namespace storage { diff --git a/storage/src/vespa/storage/tools/throttlingsim.h b/storage/src/vespa/storage/tools/throttlingsim.h index b583a7d2533..a7384d0f362 100644 --- a/storage/src/vespa/storage/tools/throttlingsim.h +++ b/storage/src/vespa/storage/tools/throttlingsim.h @@ -75,7 +75,7 @@ public: double max_diff; virtual void returnMessage(const Message& m) = 0; - virtual void run() override; + void run() override; virtual void print(double timenow); Client(Messaging& msgng, double windowSize, int to); @@ -91,17 +91,15 @@ class FixedClient : public Client { public: FixedClient(Messaging& msgng, int winsize, int to) : Client(msgng, winsize, to) {}; - - virtual void returnMessage(const Message& m) override; + void returnMessage(const Message& m) override; }; class LoadBalancingClient : public Client { public: LoadBalancingClient(Messaging& msgng, int winsize, int to); - - virtual void returnMessage(const Message& m) override; - virtual void run() override; - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void run() override; + void print(double timenow) override; std::vector<double> weights; }; @@ -109,10 +107,9 @@ public: class BusyCounterBalancingClient : public Client { public: BusyCounterBalancingClient(Messaging& msgng, int winsize, int to); - - virtual void returnMessage(const Message& m) override; - virtual void run() override; - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void run() override; + void print(double timenow) override; std::vector<int> busyCount; }; @@ -126,8 +123,7 @@ public: DynamicClient(Messaging& msgng, int maxWinSize, double to) : Client(msgng, 1, static_cast<int>(to)), maxwinsize(maxWinSize), threshold(maxWinSize / 2), lastFailTimestamp(0) {}; - - virtual void returnMessage(const Message& m) override; + void returnMessage(const Message& m) override; }; class LatencyControlClient : public Client { @@ -137,10 +133,8 @@ public: LatencyControlClient(Messaging& msgng, double to) : Client(msgng, 1, static_cast<int>(to)), count(0){}; - - virtual void returnMessage(const Message& m) override; - - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void print(double timenow) override; }; @@ -154,5 +148,4 @@ public: ThrottlingApp() {}; int Main() override; - }; diff --git a/storage/src/vespa/storage/visiting/commandqueue.h b/storage/src/vespa/storage/visiting/commandqueue.h index 07677fdcd38..ba0141add45 100644 --- a/storage/src/vespa/storage/visiting/commandqueue.h +++ b/storage/src/vespa/storage/visiting/commandqueue.h @@ -22,229 +22,189 @@ namespace storage { - template<class Command> - class CommandQueue : public vespalib::Printable - { - public: - struct CommandEntry { - typedef typename Command::Priority PriorityType; - std::shared_ptr<Command> _command; - uint64_t _time; - uint64_t _sequenceId; - PriorityType _priority; - - CommandEntry(const std::shared_ptr<Command>& cmd, - uint64_t time, - uint64_t sequenceId, - PriorityType priority) - : _command(cmd), _time(time), _sequenceId(sequenceId), _priority(priority) - {} - - // Sort on both priority and sequence ID - bool operator<(const CommandEntry& entry) const { - if (_priority != entry._priority) { - return (_priority < entry._priority); - } - return (_sequenceId < entry._sequenceId); - } - }; - - private: - typedef boost::multi_index::multi_index_container< - CommandEntry, - boost::multi_index::indexed_by< - boost::multi_index::ordered_unique< - boost::multi_index::identity<CommandEntry> - >, - boost::multi_index::ordered_non_unique< - boost::multi_index::member<CommandEntry, uint64_t, &CommandEntry::_time> - > - > - > CommandList; - typedef typename boost::multi_index - ::nth_index<CommandList, 1>::type timelist; - - framework::Clock& _clock; - mutable CommandList _commands; +template<class Command> +class CommandQueue : public vespalib::Printable +{ +public: + struct CommandEntry { + typedef typename Command::Priority PriorityType; + std::shared_ptr<Command> _command; + uint64_t _time; uint64_t _sequenceId; - - public: - typedef typename CommandList::iterator iterator; - typedef typename CommandList::reverse_iterator reverse_iterator; - typedef typename CommandList::const_iterator const_iterator; - typedef typename CommandList::const_reverse_iterator const_reverse_iterator; - typedef typename timelist::const_iterator const_titerator; - - CommandQueue(framework::Clock& clock) - : _clock(clock), - _sequenceId(0) {} - - const framework::Clock& getTimer() const { return _clock; } - - iterator begin() { return _commands.begin(); } - iterator end() { return _commands.end(); } - - const_iterator begin() const { return _commands.begin(); } - const_iterator end() const { return _commands.end(); } - - const_titerator tbegin() const { - timelist& tl = boost::multi_index::get<1>(_commands); - return tl.begin(); - } - const_titerator tend() const { - timelist& tl = boost::multi_index::get<1>(_commands); - return tl.end(); + PriorityType _priority; + + CommandEntry(const std::shared_ptr<Command>& cmd, + uint64_t time, + uint64_t sequenceId, + PriorityType priority) + : _command(cmd), _time(time), _sequenceId(sequenceId), _priority(priority) + {} + + // Sort on both priority and sequence ID + bool operator<(const CommandEntry& entry) const { + if (_priority != entry._priority) { + return (_priority < entry._priority); + } + return (_sequenceId < entry._sequenceId); } + }; - bool empty() const; - - uint32_t size() const; - - std::pair<std::shared_ptr<Command>, time_t> releaseNextCommand(); - - std::shared_ptr<Command> peekNextCommand() const; - - void add(const std::shared_ptr<Command>& msg); +private: + typedef boost::multi_index::multi_index_container< + CommandEntry, + boost::multi_index::indexed_by< + boost::multi_index::ordered_unique< + boost::multi_index::identity<CommandEntry> + >, + boost::multi_index::ordered_non_unique< + boost::multi_index::member<CommandEntry, uint64_t, &CommandEntry::_time> + > + > + > CommandList; + typedef typename boost::multi_index + ::nth_index<CommandList, 1>::type timelist; - void erase(iterator it); + framework::Clock& _clock; + mutable CommandList _commands; + uint64_t _sequenceId; - std::list<CommandEntry> releaseTimedOut(); +public: + typedef typename CommandList::iterator iterator; + typedef typename CommandList::reverse_iterator reverse_iterator; + typedef typename CommandList::const_iterator const_iterator; + typedef typename CommandList::const_reverse_iterator const_reverse_iterator; + typedef typename timelist::const_iterator const_titerator; - std::pair<std::shared_ptr<Command>, time_t> - releaseLowestPriorityCommand(); + CommandQueue(framework::Clock& clock) + : _clock(clock), + _sequenceId(0) {} - std::shared_ptr<Command> peekLowestPriorityCommand() const; + const framework::Clock& getTimer() const { return _clock; } - void clear(); + iterator begin() { return _commands.begin(); } + iterator end() { return _commands.end(); } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; - }; + const_iterator begin() const { return _commands.begin(); } + const_iterator end() const { return _commands.end(); } - template<class Command> - inline bool - CommandQueue<Command>::empty() const - { - return _commands.empty(); + const_titerator tbegin() const { + timelist& tl = boost::multi_index::get<1>(_commands); + return tl.begin(); } - - template<class Command> - inline uint32_t - CommandQueue<Command>::size() const - { - return _commands.size(); + const_titerator tend() const { + timelist& tl = boost::multi_index::get<1>(_commands); + return tl.end(); } - template<class Command> - inline std::pair<std::shared_ptr<Command>, time_t> - CommandQueue<Command>::releaseNextCommand() - { - std::pair<std::shared_ptr<Command>, time_t> retVal( - std::shared_ptr<Command>(), 0); - if (!_commands.empty()) { - iterator first = _commands.begin(); - retVal.first = first->_command; - retVal.second = first->_time; - _commands.erase(first); - } - return retVal; + bool empty() const { return _commands.empty(); } + uint32_t size() const { return _commands.size(); } + std::pair<std::shared_ptr<Command>, time_t> releaseNextCommand(); + std::shared_ptr<Command> peekNextCommand() const; + void add(const std::shared_ptr<Command>& msg); + void erase(iterator it) { _commands.erase(it); } + std::list<CommandEntry> releaseTimedOut(); + std::pair<std::shared_ptr<Command>, time_t> releaseLowestPriorityCommand(); + + std::shared_ptr<Command> peekLowestPriorityCommand() const; + void clear() { return _commands.clear(); } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; +}; + + +template<class Command> +std::pair<std::shared_ptr<Command>, time_t> +CommandQueue<Command>::releaseNextCommand() +{ + std::pair<std::shared_ptr<Command>, time_t> retVal( + std::shared_ptr<Command>(), 0); + if (!_commands.empty()) { + iterator first = _commands.begin(); + retVal.first = first->_command; + retVal.second = first->_time; + _commands.erase(first); } - - template<class Command> - inline std::shared_ptr<Command> - CommandQueue<Command>::peekNextCommand() const - { - if (!_commands.empty()) { - const_iterator first = _commands.begin(); - return first->_command; - } else { - return std::shared_ptr<Command>(); - } - } - - template<class Command> - inline void - CommandQueue<Command>::add( - const std::shared_ptr<Command>& cmd) - { - framework::MicroSecTime time(_clock.getTimeInMicros() - + framework::MicroSecTime(cmd->getQueueTimeout() * 1000000)); - _commands.insert(CommandEntry(cmd, time.getTime(), ++_sequenceId, cmd->getPriority())); + return retVal; +} + +template<class Command> +std::shared_ptr<Command> +CommandQueue<Command>::peekNextCommand() const +{ + if (!_commands.empty()) { + const_iterator first = _commands.begin(); + return first->_command; + } else { + return std::shared_ptr<Command>(); } - - template<class Command> - inline void - CommandQueue<Command>::erase(iterator it) - { - _commands.erase(it); - } - - template<class Command> - inline std::list<typename CommandQueue<Command>::CommandEntry> - CommandQueue<Command>::releaseTimedOut() - { - std::list<CommandEntry> mylist; - framework::MicroSecTime time(_clock.getTimeInMicros()); - while (!empty() && tbegin()->_time <= time.getTime()) { - mylist.push_back(*tbegin()); - timelist& tl = boost::multi_index::get<1>(_commands); - tl.erase(tbegin()); - } - return mylist; +} + +template<class Command> +void +CommandQueue<Command>::add( + const std::shared_ptr<Command>& cmd) +{ + framework::MicroSecTime time(_clock.getTimeInMicros() + + framework::MicroSecTime(cmd->getQueueTimeout() * 1000000)); + _commands.insert(CommandEntry(cmd, time.getTime(), ++_sequenceId, cmd->getPriority())); +} + +template<class Command> +std::list<typename CommandQueue<Command>::CommandEntry> +CommandQueue<Command>::releaseTimedOut() +{ + std::list<CommandEntry> mylist; + framework::MicroSecTime time(_clock.getTimeInMicros()); + while (!empty() && tbegin()->_time <= time.getTime()) { + mylist.push_back(*tbegin()); + timelist& tl = boost::multi_index::get<1>(_commands); + tl.erase(tbegin()); } - - template <class Command> - inline std::pair<std::shared_ptr<Command>, time_t> - CommandQueue<Command>::releaseLowestPriorityCommand() - { - if (!_commands.empty()) { - iterator last = (++_commands.rbegin()).base(); - time_t time = last->_time; - std::shared_ptr<Command> cmd(last->_command); - _commands.erase(last); - return std::pair<std::shared_ptr<Command>, time_t>(cmd, time); - } else { - return std::pair<std::shared_ptr<Command>, time_t>( - std::shared_ptr<Command>(), 0); - } + return mylist; +} + +template <class Command> +std::pair<std::shared_ptr<Command>, time_t> +CommandQueue<Command>::releaseLowestPriorityCommand() +{ + if (!_commands.empty()) { + iterator last = (++_commands.rbegin()).base(); + time_t time = last->_time; + std::shared_ptr<Command> cmd(last->_command); + _commands.erase(last); + return std::pair<std::shared_ptr<Command>, time_t>(cmd, time); + } else { + return std::pair<std::shared_ptr<Command>, time_t>( + std::shared_ptr<Command>(), 0); } - - template <class Command> - inline std::shared_ptr<Command> - CommandQueue<Command>::peekLowestPriorityCommand() const - { - if (!_commands.empty()) { - const_reverse_iterator last = _commands.rbegin(); - return last->_command; - } else { - return std::shared_ptr<Command>(); - } +} + +template <class Command> +std::shared_ptr<Command> +CommandQueue<Command>::peekLowestPriorityCommand() const +{ + if (!_commands.empty()) { + const_reverse_iterator last = _commands.rbegin(); + return last->_command; + } else { + return std::shared_ptr<Command>(); } - - template<class Command> - inline void - CommandQueue<Command>::clear() - { - _commands.clear(); +} + +template<class Command> +void +CommandQueue<Command>::print(std::ostream& out, bool verbose, const std::string& indent) const +{ + (void) verbose; + out << "Insert order:\n"; + for (const_iterator it = begin(); it != end(); ++it) { + out << indent << *it->_command << ", priority " << it->_priority + << ", time " << it->_time << "\n"; } - - template<class Command> - inline void - CommandQueue<Command>::print(std::ostream& out, bool verbose, - const std::string& indent) const - { - (void) verbose; - out << "Insert order:\n"; - for (const_iterator it = begin(); it != end(); ++it) { - out << indent << *it->_command << ", priority " << it->_priority - << ", time " << it->_time << "\n"; - } - out << indent << "Time order:"; - for (const_titerator it = tbegin(); it != tend(); ++it) { - out << "\n" << indent << *it->_command << ", priority " << it->_priority - << ", time " << it->_time; - } + out << indent << "Time order:"; + for (const_titerator it = tbegin(); it != tend(); ++it) { + out << "\n" << indent << *it->_command << ", priority " << it->_priority + << ", time " << it->_time; } +} } // storage - diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h index ecf51035a03..814cba9501b 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.h +++ b/storage/src/vespa/storage/visiting/countvisitor.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp index a36ace1d427..acafa30ef9d 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp +++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp @@ -3,12 +3,10 @@ #include "dumpvisitorsingle.h" #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/document/update/documentupdate.h> -#include <vespa/log/log.h> -#include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> -#include <memory> +#include <vespa/log/log.h> LOG_SETUP(".visitor.instance.dumpvisitorsingle"); namespace storage { diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h index d7f7b63d851..b0fd4b2b9f0 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h +++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { @@ -19,8 +19,7 @@ public: const vdslib::Parameters& params); private: - void handleDocuments(const document::BucketId&, - std::vector<spi::DocEntry::UP>&, HitCounter&) override; + void handleDocuments(const document::BucketId&, std::vector<spi::DocEntry::UP>&, HitCounter&) override; }; struct DumpVisitorSingleFactory : public VisitorFactory { @@ -31,14 +30,10 @@ struct DumpVisitorSingleFactory : public VisitorFactory { }; Visitor* - makeVisitor(StorageComponent& c, - VisitorEnvironment&, const vdslib::Parameters& params) override - { + + makeVisitor(StorageComponent& c, VisitorEnvironment&, const vdslib::Parameters& params) override { return new DumpVisitorSingle(c, params); } }; } - - - diff --git a/storage/src/vespa/storage/visiting/messages.h b/storage/src/vespa/storage/visiting/messages.h index d646355895f..b79fae0575f 100644 --- a/storage/src/vespa/storage/visiting/messages.h +++ b/storage/src/vespa/storage/visiting/messages.h @@ -29,11 +29,9 @@ public: _config(config) {} std::unique_ptr<api::StorageReply> makeReply() override; - const vespa::config::content::core::StorVisitorConfig& getConfig() const { return _config; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfig()"; if (verbose) { @@ -53,12 +51,8 @@ public: PropagateVisitorConfigReply(const PropagateVisitorConfig& cmd) : api::InternalReply(ID, cmd) - { - } - - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + {} + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfigReply()"; if (verbose) { @@ -76,4 +70,3 @@ PropagateVisitorConfig::makeReply() } } // storage - diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h index dac6996028b..b9f54a5d0ea 100644 --- a/storage/src/vespa/storage/visiting/recoveryvisitor.h +++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" #include <vespa/storageapi/message/datagram.h> namespace documentapi { diff --git a/storage/src/vespa/storage/visiting/testvisitor.h b/storage/src/vespa/storage/visiting/testvisitor.h index c2740b11d56..db4e1d60939 100644 --- a/storage/src/vespa/storage/visiting/testvisitor.h +++ b/storage/src/vespa/storage/visiting/testvisitor.h @@ -8,7 +8,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { @@ -30,10 +30,9 @@ private: } void completedVisiting(HitCounter& hitCounter) override; - void abortedVisiting() override; - // Send datagram with message back to client + // Send datagram with message back to client void report(const std::string& message); std::string _params; @@ -55,6 +54,3 @@ struct TestVisitorFactory : public VisitorFactory { }; } - - - diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index 3d5e9fc2c53..918d2d0e339 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -174,8 +174,7 @@ private: bool hasPendingIterators() const { return _pendingIterators > 0; } - void print(std::ostream& out, bool, const std::string& /*indent*/) const override - { + void print(std::ostream& out, bool, const std::string& ) const override { out << "BucketIterationState(" << _bucketId << ", pending GetIters: " << _pendingIterators diff --git a/storage/src/vespa/storage/visiting/visitormanager.h b/storage/src/vespa/storage/visiting/visitormanager.h index 9b750e3af4f..b966526ad7a 100644 --- a/storage/src/vespa/storage/visiting/visitormanager.h +++ b/storage/src/vespa/storage/visiting/visitormanager.h @@ -19,19 +19,18 @@ #pragma once -#include <vespa/vespalib/util/document_runnable.h> +#include "commandqueue.h" +#include "visitor.h" +#include "visitormetrics.h" +#include "visitorthread.h" +#include "config-stor-visitor.h" +#include <vespa/storageframework/storageframework.h> +#include <vespa/storage/common/storagelink.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/internal.h> #include <vespa/storageapi/message/visitor.h> -#include <vespa/storage/common/storagelink.h> -#include <vespa/storage/visiting/commandqueue.h> -#include <vespa/storage/visiting/config-stor-visitor.h> -#include <vespa/storage/visiting/visitor.h> -#include <vespa/storage/visiting/visitormetrics.h> -#include <vespa/storage/visiting/visitorthread.h> -#include <vespa/storageframework/storageframework.h> -#include <vespa/storageframework/storageframework.h> #include <vespa/config/config.h> +#include <vespa/vespalib/util/document_runnable.h> namespace storage { namespace api { @@ -90,14 +89,11 @@ public: VisitorManager(const config::ConfigUri & configUri, StorageComponentRegister&, VisitorMessageSessionFactory&, const VisitorFactory::Map& external = VisitorFactory::Map()); - virtual ~VisitorManager(); - - virtual void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + ~VisitorManager(); + void onClose() override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; uint32_t getActiveVisitorCount() const; - void setTimeBetweenTicks(uint32_t time); void setMaxConcurrentVisitors(uint32_t count) { // Used in unit testing @@ -126,7 +122,7 @@ public: private: void configure(std::unique_ptr<vespa::config::content::core::StorVisitorConfig>) override; - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; /** * Schedules a visitor for running. onCreateVisitor will typically call @@ -157,13 +153,12 @@ private: */ bool attemptScheduleQueuedVisitor(vespalib::MonitorGuard& visitorLock); - // VisitorMessageHandler implementation + // VisitorMessageHandler implementation void send(const std::shared_ptr<api::StorageCommand>& cmd, Visitor& visitor) override; void send(const std::shared_ptr<api::StorageReply>& reply) override; void closed(api::VisitorId id) override; - // Status::Reporter implementation - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; /** * The maximum amount of concurrent visitors for a priority is given @@ -179,4 +174,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/visiting/visitorthread.h b/storage/src/vespa/storage/visiting/visitorthread.h index 2f0a125d6ce..5f9d8897d9f 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.h +++ b/storage/src/vespa/storage/visiting/visitorthread.h @@ -13,17 +13,17 @@ #pragma once -#include <deque> -#include <vespa/vespalib/util/document_runnable.h> -#include <vespa/metrics/metrictimer.h> +#include "visitor.h" +#include "visitormetrics.h" +#include "visitormessagesessionfactory.h" +#include <vespa/storageframework/storageframework.h> +#include <vespa/storage/persistence/messages.h> +#include <vespa/storage/common/storagecomponent.h> #include <vespa/storageapi/messageapi/messagehandler.h> +#include <vespa/metrics/metrictimer.h> +#include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/persistence/messages.h> -#include <vespa/storage/visiting/visitor.h> -#include <vespa/storage/visiting/visitormetrics.h> -#include <vespa/storage/visiting/visitormessagesessionfactory.h> -#include <vespa/storageframework/storageframework.h> +#include <deque> namespace storage { @@ -36,8 +36,7 @@ class VisitorThread : public framework::Runnable, typedef std::map<api::VisitorId, std::shared_ptr<Visitor> > VisitorMap; VisitorMap _visitors; - std::deque<std::pair<api::VisitorId, - framework::SecondTime> > _recentlyCompleted; + std::deque<std::pair<api::VisitorId, framework::SecondTime> > _recentlyCompleted; struct Event { enum Type { @@ -100,13 +99,9 @@ public: VisitorMessageHandler& sender); ~VisitorThread(); - void processMessage(api::VisitorId visitorId, - const std::shared_ptr<api::StorageMessage>& msg); - + void processMessage(api::VisitorId visitorId, const std::shared_ptr<api::StorageMessage>& msg); void shutdown(); - void setTimeBetweenTicks(uint32_t time) { _timeBetweenTicks = time; } - void handleMessageBusReply(std::unique_ptr<mbus::Reply> reply, Visitor& visitor); /** For unit tests needing to pause thread. */ @@ -117,7 +112,7 @@ public: } private: - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; /** * Attempt to fetch an event from the visitor thread's queue. If an event * was available, pop it from the queue and return it. If not, return @@ -127,12 +122,11 @@ private: Event popNextQueuedEventIfAvailable(); void tick(); void trimRecentlyCompletedList(framework::SecondTime currentTime); - void handleNonExistingVisitorCall(const Event& entry, - api::ReturnCode& code); + void handleNonExistingVisitorCall(const Event& entry, api::ReturnCode& code); std::shared_ptr<Visitor> createVisitor(const vespalib::stringref & libName, - const vdslib::Parameters& params, - vespalib::asciistream & error); + const vdslib::Parameters& params, + vespalib::asciistream & error); bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) override; @@ -142,12 +136,9 @@ private: /** Deletes a visitor instance. */ void close(); - void getStatus(vespalib::asciistream & out, - const framework::HttpUrlPath& path) const; - + void getStatus(vespalib::asciistream & out, const framework::HttpUrlPath& path) const; void updateMetrics(const MetricLockGuard &) override; }; } // storage - diff --git a/storageapi/src/tests/testrunner.cpp b/storageapi/src/tests/testrunner.cpp index 9a07796a3f4..05fb3184c04 100644 --- a/storageapi/src/tests/testrunner.cpp +++ b/storageapi/src/tests/testrunner.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storageapicppunittestrunner"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h index 692cc171250..17ad75aa851 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h @@ -13,7 +13,6 @@ #pragma once -#include <stdint.h> #include <vespa/storageapi/defs.h> #include <vespa/vespalib/util/printable.h> #include <vespa/vespalib/util/xmlserializable.h> @@ -77,13 +76,10 @@ public: bool empty() const { return _metaCount == 0 && _usedFileSize == 0 && _checksum == 0; } - - void print(std::ostream& out, bool verbose, - const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { vespalib::AsciiPrintable::print(out, verbose, indent); } - virtual void print(vespalib::asciistream&, const PrintProperties&) const override; + void print(vespalib::asciistream&, const PrintProperties&) const override; void printXml(vespalib::XmlOutputStream&) const; }; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h index 9fa125b1159..f44de9700b7 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.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 <vespa/storageapi/mbusprot/protocolserialization.h> +#include "protocolserialization.h" namespace storage { namespace mbusprot { @@ -11,29 +11,29 @@ public: ProtocolSerialization4_2(const document::DocumentTypeRepo::SP&); protected: - virtual void onEncode(GBBuf&, const api::GetCommand&) const override; - virtual void onEncode(GBBuf&, const api::RemoveCommand&) const override; - virtual void onEncode(GBBuf&, const api::RevertCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; - virtual void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; - virtual void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; - virtual void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; + void onEncode(GBBuf&, const api::GetCommand&) const override; + void onEncode(GBBuf&, const api::RemoveCommand&) const override; + void onEncode(GBBuf&, const api::RevertCommand&) const override; + void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; + void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; + void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; + void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; + void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; + void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; + void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; + void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; + void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; + void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; - virtual void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; + void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; + void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; virtual void onEncodeBucketInfoCommand(GBBuf&, const api::BucketInfoCommand&) const; virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const = 0; @@ -42,29 +42,29 @@ protected: virtual void onEncodeDiffEntry(GBBuf&, const api::GetBucketDiffCommand::Entry&) const; virtual void onEncode(GBBuf&, const api::ReturnCode&) const; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRevertCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; - virtual SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; - virtual SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; - virtual SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; - virtual SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; - virtual SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeGetCommand(BBuf&) const override; + SCmd::UP onDecodeRemoveCommand(BBuf&) const override; + SCmd::UP onDecodeRevertCommand(BBuf&) const override; + SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; + SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; + SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; + SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; + SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; + SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; + SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; - virtual SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; + SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; virtual void onDecodeBucketInfoCommand(BBuf&, api::BucketInfoCommand&) const; virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const = 0; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h index c5a26987a08..826700584da 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.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 <vespa/storageapi/mbusprot/protocolserialization4_2.h> +#include "protocolserialization4_2.h" #include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { @@ -15,66 +15,64 @@ public: ProtocolSerialization5_0(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const override; + api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; - virtual void onEncode(GBBuf&, const api::PutCommand&) const override; - virtual void onEncode(GBBuf&, const api::PutReply&) const override; - virtual void onEncode(GBBuf&, const api::UpdateCommand&) const override; - virtual void onEncode(GBBuf&, const api::UpdateReply&) const override; - virtual void onEncode(GBBuf&, const api::GetReply&) const override; - virtual void onEncode(GBBuf&, const api::RemoveReply&) const override; - virtual void onEncode(GBBuf&, const api::RevertReply&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; - virtual void onEncode(GBBuf&, const api::SplitBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::MultiOperationReply&) const override; - virtual void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; - virtual void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; + void onEncode(GBBuf&, const api::PutCommand&) const override; + void onEncode(GBBuf&, const api::PutReply&) const override; + void onEncode(GBBuf&, const api::UpdateCommand&) const override; + void onEncode(GBBuf&, const api::UpdateReply&) const override; + void onEncode(GBBuf&, const api::GetReply&) const override; + void onEncode(GBBuf&, const api::RemoveReply&) const override; + void onEncode(GBBuf&, const api::RevertReply&) const override; + void onEncode(GBBuf&, const api::CreateBucketReply&) const override; + void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; + void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; + void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + void onEncode(GBBuf&, const api::MergeBucketReply&) const override; + void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; + void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; + void onEncode(GBBuf&, const api::SplitBucketReply&) const override; + void onEncode(GBBuf&, const api::MultiOperationReply&) const override; + void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; + void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; + void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; - virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; + void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; virtual void onEncodeBucketReply(GBBuf&, const api::BucketReply&) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; - virtual void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; - virtual void onEncodeReply(GBBuf&, const api::StorageReply&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; + void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; + void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; + void onEncodeReply(GBBuf&, const api::StorageReply&) const override; - virtual SCmd::UP onDecodePutCommand(BBuf&) const override; - virtual SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeUpdateCommand(BBuf&) const override; - virtual SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; - virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - virtual SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; - virtual SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; + SCmd::UP onDecodePutCommand(BBuf&) const override; + SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeUpdateCommand(BBuf&) const override; + SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; + SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; + SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; - virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; + void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; virtual void onDecodeBucketReply(BBuf&, api::BucketReply&) const; - virtual SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; - virtual void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; - virtual void onDecodeReply(BBuf&, api::StorageReply&) const override; + SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; + void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; + void onDecodeReply(BBuf&, api::StorageReply&) const override; }; } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h index 393596046c2..92e559f5de9 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h @@ -1,8 +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 <vespa/storageapi/mbusprot/protocolserialization5_0.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> +#include "protocolserialization5_0.h" namespace storage { namespace mbusprot { @@ -17,24 +16,22 @@ public: ProtocolSerialization5_1(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const override; + api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; protected: - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; - virtual void onEncode(GBBuf&, const api::GetCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + void onEncode(GBBuf&, const api::GetCommand&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + + SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeGetCommand(BBuf&) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; }; } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h index 35af05d192b..552d9ee3508 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h @@ -3,9 +3,8 @@ #pragma once +#include "protocolserialization5_1.h" #include <vespa/vespalib/util/growablebytebuffer.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> #include <vespa/storageapi/message/persistence.h> namespace storage { @@ -14,20 +13,19 @@ namespace mbusprot { class ProtocolSerialization5_2 : public ProtocolSerialization5_1 { public: - ProtocolSerialization5_2( - const document::DocumentTypeRepo::SP& repo, - const documentapi::LoadTypeSet & loadTypes) + ProtocolSerialization5_2(const document::DocumentTypeRepo::SP& repo, + const documentapi::LoadTypeSet & loadTypes) : ProtocolSerialization5_1(repo, loadTypes) - {} + {} protected: - virtual void onEncode(GBBuf &, const api::PutCommand &) const override; - virtual void onEncode(GBBuf &, const api::RemoveCommand &) const override; - virtual void onEncode(GBBuf &, const api::UpdateCommand &) const override; + void onEncode(GBBuf &, const api::PutCommand &) const override; + void onEncode(GBBuf &, const api::RemoveCommand &) const override; + void onEncode(GBBuf &, const api::UpdateCommand &) const override; - virtual SCmd::UP onDecodePutCommand(BBuf &) const override; - virtual SCmd::UP onDecodeRemoveCommand(BBuf &) const override; - virtual SCmd::UP onDecodeUpdateCommand(BBuf &) const override; + SCmd::UP onDecodePutCommand(BBuf &) const override; + SCmd::UP onDecodeRemoveCommand(BBuf &) const override; + SCmd::UP onDecodeUpdateCommand(BBuf &) const override; static void decodeTasCondition(api::StorageCommand & cmd, BBuf & buf); static void encodeTasCondition(GBBuf & buf, const api::StorageCommand & cmd); diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h index 8549df6077f..d6d95e2b1fe 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.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 "storagemessage.h" +#include "storageprotocol.h" #include <vespa/messagebus/message.h> -#include <vespa/storageapi/mbusprot/storagemessage.h> -#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagecommand.h> namespace storage { @@ -16,15 +16,13 @@ public: StorageCommand(const storage::api::StorageCommand::SP&); const mbus::string & getProtocol() const override { return StorageProtocol::NAME; } - uint32_t getType() const override { return _cmd->getType().getId(); } - const api::StorageCommand::SP& getCommand() { return _cmd; } api::StorageCommand::CSP getCommand() const { return _cmd; } - virtual api::StorageMessage::SP getInternalMessage() override { return _cmd; } - virtual api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } + api::StorageMessage::SP getInternalMessage() override { return _cmd; } + api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } - virtual uint8_t priority() const override { + uint8_t priority() const override { return ((getInternalMessage()->getPriority()) / 255) * 16; } @@ -34,4 +32,3 @@ private: } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h index 8c10ab1dfe1..e1bcff1b27c 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h @@ -1,12 +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 "protocolserialization5_2.h" #include <vespa/messagebus/iprotocol.h> -#include <string> -#include <vespa/storageapi/mbusprot/protocolserialization5_0.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_2.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { namespace mbusprot { @@ -21,17 +17,10 @@ public: StorageProtocol(const document::DocumentTypeRepo::SP, const documentapi::LoadTypeSet& loadTypes); - // Implements IProtocol. const mbus::string& getName() const override { return NAME; } - - // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string& name, const mbus::string& param) const override; - - // Implements IProtocol. mbus::Blob encode(const vespalib::Version&, const mbus::Routable&) const override; - - // Implements IProtocol. mbus::Routable::UP decode(const vespalib::Version&, mbus::BlobRef) const override; private: @@ -42,6 +31,3 @@ private: } // mbusprot } // storage - - - diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h index aa7c827a32a..2e7dafc505f 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagereply.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 "storagemessage.h" +#include "storageprotocol.h" #include <vespa/messagebus/reply.h> -#include <vespa/storageapi/mbusprot/storagemessage.h> -#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagereply.h> namespace storage { @@ -20,21 +20,19 @@ public: StorageReply(const mbus::BlobRef& data, const ProtocolSerialization&); StorageReply(const api::StorageReply::SP& reply); - virtual ~StorageReply(); + ~StorageReply(); - virtual const mbus::string& getProtocol() const override - { return StorageProtocol::NAME; } + const mbus::string& getProtocol() const override { return StorageProtocol::NAME; } uint32_t getType() const override { return _mbusType; } const api::StorageReply::SP& getReply() { deserialize(); return _reply; } api::StorageReply::CSP getReply() const { deserialize(); return _reply; } - virtual api::StorageMessage::SP getInternalMessage() override - { deserialize(); return _reply; } - virtual api::StorageMessage::CSP getInternalMessage() const override - { deserialize(); return _reply; } - virtual uint8_t priority() const override { + api::StorageMessage::SP getInternalMessage() override { deserialize(); return _reply; } + api::StorageMessage::CSP getInternalMessage() const override { deserialize(); return _reply; } + + uint8_t priority() const override { if (_reply.get()) { return _reply->getPriority(); } @@ -48,4 +46,3 @@ private: } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/message/batch.h b/storageapi/src/vespa/storageapi/message/batch.h index 85e7a8df9ee..c2bb8b816b8 100644 --- a/storageapi/src/vespa/storageapi/message/batch.h +++ b/storageapi/src/vespa/storageapi/message/batch.h @@ -156,14 +156,13 @@ public: @return Returns a list of the updates to be performed. */ const UpdateList& getUpdates() const { return _updates; }; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Returns a bucket id suitable for routing this message. */ document::BucketId getBucketId() const override { return _bucketId; } - virtual bool hasSingleBucketId() const override { return true; } + bool hasSingleBucketId() const override { return true; } DECLARE_STORAGECOMMAND(BatchDocumentUpdateCommand, onBatchDocumentUpdate) @@ -183,18 +182,12 @@ class BatchDocumentUpdateReply : public StorageReply { std::vector<bool> _documentsNotFound; public: explicit BatchDocumentUpdateReply(const BatchDocumentUpdateCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - const std::vector<bool>& getDocumentsNotFound() const { return _documentsNotFound; } std::vector<bool>& getDocumentsNotFound() { return _documentsNotFound; } DECLARE_STORAGEREPLY(BatchDocumentUpdateReply, onBatchDocumentUpdateReply) }; - - } } - - diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index c78591eca61..31948852840 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -7,14 +7,14 @@ #pragma once -#include <vespa/document/base/globalid.h> -#include <vespa/vdslib/state/clusterstate.h> -#include <vespa/storageapi/defs.h> #include <vespa/storageapi/messageapi/bucketcommand.h> #include <vespa/storageapi/messageapi/bucketreply.h> #include <vespa/storageapi/messageapi/bucketinfocommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> #include <vespa/storageapi/messageapi/maintenancecommand.h> +#include <vespa/document/base/globalid.h> +#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/storageapi/defs.h> namespace document { class DocumentTypeRepo; } @@ -32,12 +32,9 @@ class CreateBucketCommand : public MaintenanceCommand { public: explicit CreateBucketCommand(const document::BucketId& id); - void setActive(bool active) { _active = active; } bool getActive() const { return _active; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(CreateBucketCommand, onCreateBucket) }; @@ -50,9 +47,7 @@ public: class CreateBucketReply : public BucketInfoReply { public: explicit CreateBucketReply(const CreateBucketCommand& cmd); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(CreateBucketReply, onCreateBucketReply); }; @@ -69,9 +64,7 @@ public: const BucketInfo& getBucketInfo() const { return _info; } void setBucketInfo(const BucketInfo& info) { _info = info; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(DeleteBucketCommand, onDeleteBucket) }; @@ -84,9 +77,7 @@ public: class DeleteBucketReply : public BucketInfoReply { public: explicit DeleteBucketReply(const DeleteBucketCommand& cmd); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DeleteBucketReply, onDeleteBucketReply) }; @@ -136,14 +127,10 @@ public: const std::vector<Node>& getNodes() const { return _nodes; } Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } - uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - void setClusterStateVersion(uint32_t version) { _clusterStateVersion = version; } void setChain(const std::vector<uint16_t>& chain) { _chain = chain; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(MergeBucketCommand, onMergeBucket) }; @@ -173,8 +160,7 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(MergeBucketReply, onMergeBucketReply) }; @@ -198,8 +184,7 @@ public: uint16_t _hasMask; Entry(); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; bool operator<(const Entry& e) const { return (_timestamp < e._timestamp); } @@ -219,7 +204,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketDiffCommand, onGetBucketDiff) }; @@ -247,8 +232,7 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetBucketDiffReply, onGetBucketDiffReply) }; @@ -274,8 +258,7 @@ public: Entry(const GetBucketDiffCommand::Entry&); bool filled() const; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; }; private: @@ -296,8 +279,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(ApplyBucketDiffCommand, onApplyBucketDiff) }; @@ -326,7 +308,7 @@ public: std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(ApplyBucketDiffReply, onApplyBucketDiffReply) }; @@ -359,13 +341,11 @@ public: RequestBucketInfoCommand(uint16_t distributor, const lib::ClusterState& state); - const std::vector<document::BucketId>& getBuckets() const - { return _buckets; } + const std::vector<document::BucketId>& getBuckets() const { return _buckets; } bool hasSystemState() const { return (_state.get() != 0); } uint16_t getDistributor() const { return _distributor; } - const lib::ClusterState& getSystemState() const - { return *_state; } + const lib::ClusterState& getSystemState() const { return *_state; } const vespalib::string& getDistributionHash() const { return _distributionHash; } @@ -402,14 +382,10 @@ public: explicit RequestBucketInfoReply(const RequestBucketInfoCommand& cmd); ~RequestBucketInfoReply(); - const EntryVector & getBucketInfo() const { return _buckets; } EntryVector & getBucketInfo() { return _buckets; } - uint32_t getMemoryFootprint() const override; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RequestBucketInfoReply, onRequestBucketInfoReply) }; @@ -426,15 +402,11 @@ public: */ class NotifyBucketChangeCommand : public BucketCommand { BucketInfo _info; - public: NotifyBucketChangeCommand(const document::BucketId& bucket, const BucketInfo& bucketInfo); - const BucketInfo& getBucketInfo() const { return _info; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(NotifyBucketChangeCommand, onNotifyBucketChange) }; @@ -451,9 +423,7 @@ public: class NotifyBucketChangeReply : public BucketReply { public: explicit NotifyBucketChangeReply(const NotifyBucketChangeCommand& cmd); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(NotifyBucketChangeReply, onNotifyBucketChangeReply) }; @@ -474,16 +444,13 @@ public: private: BUCKET_STATE _state; public: - SetBucketStateCommand(const document::BucketId& bucket, - BUCKET_STATE state); - + SetBucketStateCommand(const document::BucketId& bucket, BUCKET_STATE state); void print(std::ostream& out, bool verbose, const std::string& indent) const override; - BUCKET_STATE getState() const { return _state; } - DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState) private: - virtual vespalib::string getSummary() const override; + + vespalib::string getSummary() const override; }; /** @@ -496,12 +463,9 @@ class SetBucketStateReply : public BucketInfoReply { public: explicit SetBucketStateReply(const SetBucketStateCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(SetBucketStateReply, onSetBucketStateReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.h b/storageapi/src/vespa/storageapi/message/bucketsplitting.h index 6188a7cc44f..4e7c9397716 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.h +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.h @@ -57,7 +57,7 @@ public: void setMinByteSize(uint32_t v) { _minByteSize = v; } void setMinDocCount(uint32_t v) { _minDocCount = v; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SplitBucketCommand, onSplitBucket) }; @@ -71,19 +71,14 @@ public: class SplitBucketReply : public BucketReply { public: typedef std::pair<document::BucketId, BucketInfo> Entry; - -private: - std::vector<Entry> _result; - -public: explicit SplitBucketReply(const SplitBucketCommand& cmd); - std::vector<Entry>& getSplitInfo() { return _result; } const std::vector<Entry>& getSplitInfo() const { return _result; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SplitBucketReply, onSplitBucketReply) +private: + std::vector<Entry> _result; }; /** @@ -97,19 +92,13 @@ public: class JoinBucketsCommand : public MaintenanceCommand { std::vector<document::BucketId> _sources; uint8_t _minJoinBits; - public: explicit JoinBucketsCommand(const document::BucketId& target); - std::vector<document::BucketId>& getSourceBuckets() { return _sources; } - const std::vector<document::BucketId>& getSourceBuckets() const - { return _sources; } - + const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } void setMinJoinBits(uint8_t minJoinBits) { _minJoinBits = minJoinBits; } uint8_t getMinJoinBits() const { return _minJoinBits; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(JoinBucketsCommand, onJoinBuckets) }; @@ -121,20 +110,13 @@ public: */ class JoinBucketsReply : public BucketInfoReply { std::vector<document::BucketId> _sources; - public: explicit JoinBucketsReply(const JoinBucketsCommand& cmd); - JoinBucketsReply(const JoinBucketsCommand& cmd, const BucketInfo& bucketInfo); - - const std::vector<document::BucketId>& getSourceBuckets() const - { return _sources; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(JoinBucketsReply, onJoinBucketsReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h index 040f925f98a..642caa8e12a 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.h +++ b/storageapi/src/vespa/storageapi/message/datagram.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 <vespa/document/bucket/bucketid.h> -#include <vespa/vdslib/container/documentlist.h> +#include "visitor.h" #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/storagereply.h> #include <vespa/storageapi/defs.h> -#include <vespa/storageapi/message/visitor.h> +#include <vespa/vdslib/container/documentlist.h> namespace storage { namespace api { @@ -33,16 +32,11 @@ public: { assert(_docBlock.getBufferSize() > 0); return _docBlock; } const vdslib::DocumentList& getDocumentBlock() const { assert(_docBlock.getBufferSize() > 0); return _docBlock; } - - void setDocumentBlock(vdslib::DocumentList& block) { - _docBlock = block; - } + void setDocumentBlock(vdslib::DocumentList& block) { _docBlock = block; } document::BucketId getBucketId() const override { return _bucketId; } - virtual bool hasSingleBucketId() const override { return true; } - + bool hasSingleBucketId() const override { return true; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool keepTimeStamps() const { return _keepTimeStamps; } void keepTimeStamps(bool keepTime) { _keepTimeStamps = keepTime; } @@ -58,9 +52,7 @@ public: class DocBlockReply : public StorageReply { public: explicit DocBlockReply(const DocBlockCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocBlockReply, onDocBlockReply) }; @@ -76,15 +68,11 @@ public: */ class MapVisitorCommand : public StorageCommand { vdslib::Parameters _statistics; - public: MapVisitorCommand(); - vdslib::Parameters& getData() { return _statistics; }; const vdslib::Parameters& getData() const { return _statistics; }; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(MapVisitorCommand, onMapVisitor) }; @@ -97,9 +85,7 @@ public: class MapVisitorReply : public StorageReply { public: explicit MapVisitorReply(const MapVisitorCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(MapVisitorReply, onMapVisitorReply) }; @@ -120,7 +106,6 @@ public: bool _removeEntry; Entry() : _doc(), _lastModified(0), _removeEntry(false) {} - Entry(const document::Document::SP& doc, int64_t lastModified, bool removeEntry) : _doc(doc), @@ -132,18 +117,13 @@ public: private: document::BucketId _bucketId; std::vector<Entry> _documents; - public: DocumentListCommand(const document::BucketId& bid); - const document::BucketId& getBucketId() { return _bucketId; } std::vector<Entry>& getDocuments() { return _documents; } const std::vector<Entry>& getDocuments() const { return _documents; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(DocumentListCommand, onDocumentList) - }; std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e); @@ -157,9 +137,7 @@ std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e) class DocumentListReply : public StorageReply { public: explicit DocumentListReply(const DocumentListCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocumentListReply, onDocumentListReply) }; @@ -176,18 +154,11 @@ public: */ class EmptyBucketsCommand : public StorageCommand { std::vector<document::BucketId> _buckets; - public: EmptyBucketsCommand(const std::vector<document::BucketId>&); - - const std::vector<document::BucketId>& getBuckets() const - { return _buckets; } - + const std::vector<document::BucketId>& getBuckets() const { return _buckets; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(EmptyBucketsCommand, onEmptyBuckets) - -private: }; /** @@ -199,12 +170,9 @@ private: class EmptyBucketsReply : public StorageReply { public: explicit EmptyBucketsReply(const EmptyBucketsCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(EmptyBucketsReply, onEmptyBucketsReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/documentsummary.h b/storageapi/src/vespa/storageapi/message/documentsummary.h index b32723c6ddb..d9f943afc07 100644 --- a/storageapi/src/vespa/storageapi/message/documentsummary.h +++ b/storageapi/src/vespa/storageapi/message/documentsummary.h @@ -1,8 +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 "visitor.h" #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -18,13 +18,10 @@ class DocumentSummaryCommand : public StorageCommand, { public: explicit DocumentSummaryCommand(); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const override { return getSerializedSize(); } - DECLARE_STORAGECOMMAND(DocumentSummaryCommand, onDocumentSummary) }; @@ -37,12 +34,9 @@ public: class DocumentSummaryReply : public StorageReply { public: explicit DocumentSummaryReply(const DocumentSummaryCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocumentSummaryReply, onDocumentSummaryReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index 470acca566b..251750eed60 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -67,12 +67,9 @@ public: uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 20; } - vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(PutCommand, onPut); }; @@ -140,8 +137,7 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(UpdateCommand, onUpdate); }; @@ -203,9 +199,7 @@ public: GetCommand(const document::BucketId&, const document::DocumentId&, const vespalib::stringref & fieldSet, Timestamp before = MAX_TIMESTAMP); ~GetCommand(); - void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } - const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } const vespalib::string& getFieldSet() const { return _fieldSet; } @@ -214,7 +208,7 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(GetCommand, onGet) }; @@ -246,13 +240,10 @@ public: Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } bool wasFound() const { return (_doc.get() != 0); } - uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 30; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(GetReply, onGetReply) }; @@ -267,20 +258,15 @@ class RemoveCommand : public TestAndSetCommand { Timestamp _timestamp; public: - RemoveCommand(const document::BucketId&, const document::DocumentId& docId, - Timestamp timestamp); + RemoveCommand(const document::BucketId&, const document::DocumentId& docId, Timestamp timestamp); ~RemoveCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } - const document::DocumentId& getDocumentId() const override { return _docId; } Timestamp getTimestamp() const { return _timestamp; } - vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; - + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(RemoveCommand, onRemove) }; @@ -294,7 +280,6 @@ class RemoveReply : public BucketInfoReply { document::DocumentId _docId; Timestamp _timestamp; Timestamp _oldTimestamp; - public: explicit RemoveReply(const RemoveCommand& cmd, Timestamp oldTimestamp = 0); ~RemoveReply(); @@ -302,13 +287,9 @@ public: const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getTimestamp() { return _timestamp; }; Timestamp getOldTimestamp() const { return _oldTimestamp; } - void setOldTimestamp(Timestamp oldTimestamp) { _oldTimestamp = oldTimestamp; } - bool wasFound() const { return (_oldTimestamp != 0); } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RemoveReply, onRemoveReply) }; @@ -320,16 +301,12 @@ public: */ class RevertCommand : public BucketInfoCommand { std::vector<Timestamp> _tokens; - public: RevertCommand(const document::BucketId& bucket, const std::vector<Timestamp>& revertTokens); ~RevertCommand(); - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(RevertCommand, onRevert) }; @@ -341,19 +318,13 @@ public: */ class RevertReply : public BucketInfoReply { std::vector<Timestamp> _tokens; - public: explicit RevertReply(const RevertCommand& cmd); ~RevertReply(); - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RevertReply, onRevertReply) }; } // api } // storage - - diff --git a/storageapi/src/vespa/storageapi/message/queryresult.h b/storageapi/src/vespa/storageapi/message/queryresult.h index 8020fa22dea..282a45ee43b 100644 --- a/storageapi/src/vespa/storageapi/message/queryresult.h +++ b/storageapi/src/vespa/storageapi/message/queryresult.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 "visitor.h" #include <vespa/vdslib/container/searchresult.h> #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -43,12 +43,9 @@ private: class QueryResultReply : public StorageReply { public: explicit QueryResultReply(const QueryResultCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(QueryResultReply, onQueryResultReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 08b5663e2d6..6232ddece90 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -5,7 +5,6 @@ #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> - namespace storage { namespace api { @@ -15,17 +14,12 @@ public: RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::BucketId&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; uint32_t getMemoryFootprint() const override { return _documentSelection.length(); } - const vespalib::string& getDocumentSelection() const { return _documentSelection; } - DECLARE_STORAGECOMMAND(RemoveLocationCommand, onRemoveLocation); - private: vespalib::string _documentSelection; }; @@ -34,10 +28,8 @@ class RemoveLocationReply : public BucketInfoReply { public: RemoveLocationReply(const RemoveLocationCommand& cmd); - DECLARE_STORAGEREPLY(RemoveLocationReply, onRemoveLocationReply) }; } } - diff --git a/storageapi/src/vespa/storageapi/message/searchresult.h b/storageapi/src/vespa/storageapi/message/searchresult.h index b2662800a9d..220f48a5973 100644 --- a/storageapi/src/vespa/storageapi/message/searchresult.h +++ b/storageapi/src/vespa/storageapi/message/searchresult.h @@ -1,8 +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 "visitor.h" #include <vespa/vdslib/container/searchresult.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -16,13 +16,8 @@ namespace api { class SearchResultCommand : public StorageCommand, public vdslib::SearchResult { public: SearchResultCommand(); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - uint32_t getMemoryFootprint() const override { - return getSerializedSize(); - } - + uint32_t getMemoryFootprint() const override { return getSerializedSize(); } DECLARE_STORAGECOMMAND(SearchResultCommand, onSearchResult) }; @@ -35,12 +30,9 @@ public: class SearchResultReply : public StorageReply { public: explicit SearchResultReply(const SearchResultCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(SearchResultReply, onSearchResultReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/stat.h b/storageapi/src/vespa/storageapi/message/stat.h index 3ee4afbb4ba..071f3e8ebdd 100644 --- a/storageapi/src/vespa/storageapi/message/stat.h +++ b/storageapi/src/vespa/storageapi/message/stat.h @@ -20,30 +20,22 @@ namespace api { class StatBucketCommand : public BucketCommand { private: vespalib::string _docSelection; - public: StatBucketCommand(const document::BucketId& bucket, const vespalib::stringref & documentSelection); const vespalib::string& getDocumentSelection() const { return _docSelection; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; - + StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(StatBucketCommand, onStatBucket); }; class StatBucketReply : public BucketReply { vespalib::string _results; - public: StatBucketReply(const StatBucketCommand&, const vespalib::stringref & results = ""); - const vespalib::string& getResults() { return _results; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(StatBucketReply, onStatBucketReply) }; @@ -60,9 +52,7 @@ public: class GetBucketListCommand : public BucketCommand { public: GetBucketListCommand(const document::BucketId& bucket); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(GetBucketListCommand, onGetBucketList); }; @@ -76,8 +66,7 @@ public: const vespalib::stringref & bucketInformation) : _bucket(id), _bucketInformation(bucketInformation) - { - } + {} bool operator==(const BucketInfo& other) const { return (_bucket == other._bucket @@ -90,12 +79,9 @@ private: public: GetBucketListReply(const GetBucketListCommand&); - std::vector<BucketInfo>& getBuckets() { return _buckets; } const std::vector<BucketInfo>& getBuckets() const { return _buckets; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(GetBucketListReply, onGetBucketListReply) }; @@ -104,4 +90,3 @@ std::ostream& operator<<(std::ostream& out, const GetBucketListReply::BucketInfo } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/state.h b/storageapi/src/vespa/storageapi/message/state.h index 12a357c1b40..86830f86e7b 100644 --- a/storageapi/src/vespa/storageapi/message/state.h +++ b/storageapi/src/vespa/storageapi/message/state.h @@ -1,9 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @file state.h - * - * State commands. - */ + #pragma once #include <vespa/storageapi/messageapi/storagecommand.h> @@ -25,9 +21,7 @@ class GetNodeStateCommand : public StorageCommand { public: explicit GetNodeStateCommand(lib::NodeState::UP expectedState); - const lib::NodeState* getExpectedState() const - { return _expectedState.get(); } - + const lib::NodeState* getExpectedState() const { return _expectedState.get(); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetNodeStateCommand, onGetNodeState) @@ -71,9 +65,7 @@ class SetSystemStateCommand : public StorageCommand { public: explicit SetSystemStateCommand(const lib::ClusterState&); - const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SetSystemStateCommand, onSetSystemState) @@ -93,7 +85,6 @@ public: // Not serialized. Available locally const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SetSystemStateReply, onSetSystemStateReply) @@ -101,4 +92,3 @@ public: } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index a9d1de402da..c1d0bb637a0 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -108,14 +108,11 @@ public: void setVisitorOrdering(document::OrderingSpecification::Order ordering) { _ordering = ordering; } document::OrderingSpecification::Order getVisitorOrdering() const { return _ordering; } - void setMaxBucketsPerVisitor(uint32_t max) - { _maxBucketsPerVisitor = max; } - uint32_t getMaxBucketsPerVisitor() const - { return _maxBucketsPerVisitor; } + void setMaxBucketsPerVisitor(uint32_t max) { _maxBucketsPerVisitor = max; } + uint32_t getMaxBucketsPerVisitor() const { return _maxBucketsPerVisitor; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(CreateVisitorCommand, onCreateVisitor) }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h index 7c078b9545a..95b2284661a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h @@ -8,8 +8,7 @@ #pragma once -#include <vespa/document/bucket/bucketid.h> -#include <vespa/storageapi/messageapi/storagecommand.h> +#include "storagecommand.h" namespace storage { namespace api { @@ -32,13 +31,9 @@ public: document::BucketId getBucketId() const override { return _bucket; } bool hasBeenRemapped() const { return (_originalBucket.getRawId() != 0); } - const document::BucketId& getOriginalBucketId() const - { return _originalBucket; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual bool hasSingleBucketId() const override { return true; } - + const document::BucketId& getOriginalBucketId() const { return _originalBucket; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + bool hasSingleBucketId() const override { return true; } }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h index 62171a9e3c0..d9d924bc338 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h @@ -12,7 +12,7 @@ #pragma once -#include <vespa/storageapi/messageapi/bucketcommand.h> +#include "bucketcommand.h" namespace storage { namespace api { @@ -24,8 +24,7 @@ protected: public: DECLARE_POINTER_TYPEDEFS(BucketInfoCommand); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h index d39a6a5eaf8..d5b174e4f2e 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h @@ -12,9 +12,9 @@ #pragma once +#include "bucketreply.h" +#include "bucketinfocommand.h" #include <vespa/storageapi/buckets/bucketinfo.h> -#include <vespa/storageapi/messageapi/bucketreply.h> -#include <vespa/storageapi/messageapi/bucketinfocommand.h> namespace storage { namespace api { @@ -31,11 +31,8 @@ public: const BucketInfo& getBucketInfo() const { return _result; }; void setBucketInfo(const BucketInfo& info) { _result = info; } - - /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h index 833f1396c49..0cd2c2065fe 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h @@ -8,8 +8,7 @@ #pragma once -#include <vespa/document/bucket/bucketid.h> -#include <vespa/storageapi/messageapi/storagereply.h> +#include "storagereply.h" namespace storage { namespace api { @@ -39,10 +38,8 @@ public: if (_originalBucket.getRawId() == 0) _originalBucket = _bucket; _bucket = bucket; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h index 66873dfba27..131ee8d2400 100644 --- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h +++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h @@ -13,6 +13,7 @@ #pragma once +#include <memory> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp index f11d91b7079..e2d10487431 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp @@ -1,10 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "returncode.h" -#include <vespa/messagebus/errorcode.h> - -#include <vespa/document/util/bytebuffer.h> -#include <vespa/fnet/frt/error.h> #include <ostream> namespace storage { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.h b/storageapi/src/vespa/storageapi/messageapi/returncode.h index a7be570e8f4..0aa87c64012 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.h +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.h @@ -14,7 +14,6 @@ #include <vespa/document/util/serializable.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <iosfwd> -#include <string> namespace document { class ByteBuffer; @@ -68,9 +67,7 @@ public: private: Result _result; vespalib::string _message; - - void onDeserialize(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer) override; + void onDeserialize(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer) override; void onSerialize(document::ByteBuffer& buffer) const override; public: @@ -123,4 +120,3 @@ public: } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h index 00f17458e6a..d67cbcf2bcb 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h @@ -12,7 +12,7 @@ #pragma once -#include <vespa/storageapi/messageapi/storagemessage.h> +#include "storagemessage.h" namespace storage { namespace api { @@ -46,7 +46,7 @@ public: void setNewId() { StorageMessage::setNewMsgId(); } /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * A way for someone to make a reply to a storage message without diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index 47dd93a9535..8801916c14b 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -11,11 +11,11 @@ #pragma once +#include "messagehandler.h" #include <map> #include <vespa/vespalib/util/printable.h> #include <vespa/messagebus/routing/route.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/storageapi/messageapi/messagehandler.h> #include <vespa/vdslib/state/nodetype.h> #include <vespa/messagebus/trace.h> #include <vespa/documentapi/loadtypes/loadtype.h> @@ -42,9 +42,8 @@ namespace vespalib { public: \ DECLARE_POINTER_TYPEDEFS(reply) \ private: \ - virtual bool callHandler( \ - MessageHandler& h, \ - const std::shared_ptr<StorageMessage>& m) const override \ + bool callHandler(MessageHandler& h, \ + const std::shared_ptr<StorageMessage>& m) const override \ { \ return h.callback(std::static_pointer_cast<reply>(m)); \ } @@ -66,7 +65,7 @@ public: \ #define IMPLEMENT_COMMAND(command, reply) \ IMPLEMENT_COMMON(command) \ std::unique_ptr<storage::api::StorageReply> \ - storage::api::command::makeReply() \ + storage::api::command::makeReply() \ { \ return std::unique_ptr<storage::api::StorageReply>(new reply(*this)); \ } diff --git a/storageapi/src/vespa/storageapi/messageapi/storagereply.h b/storageapi/src/vespa/storageapi/messageapi/storagereply.h index eab6470f463..4d185ea7a29 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagereply.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagereply.h @@ -12,8 +12,8 @@ #pragma once -#include <vespa/storageapi/messageapi/returncode.h> -#include <vespa/storageapi/messageapi/storagemessage.h> +#include "returncode.h" +#include "storagemessage.h" namespace storage { namespace api { @@ -34,9 +34,7 @@ public: void setResult(const ReturnCode& r) { _result = r; } void setResult(ReturnCode::Result r) { _result = ReturnCode(r); } const ReturnCode& getResult() const { return _result; } - - /** Overload this to get more descriptive output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/vdslib/src/tests/testrunner.cpp b/vdslib/src/tests/testrunner.cpp index fef61af9a17..0c5dcd1d00a 100644 --- a/vdslib/src/tests/testrunner.cpp +++ b/vdslib/src/tests/testrunner.cpp @@ -1,13 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("vdslibcppunittestrunner"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); |