diff options
Diffstat (limited to 'storageapi')
8 files changed, 32 insertions, 10 deletions
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index bfd657c2f05..cb0cf756586 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -16,6 +16,7 @@ #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/update/fieldpathupdates.h> #include <vespa/document/test/make_document_bucket.h> +#include <vespa/document/test/make_bucket_space.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/util/growablebytebuffer.h> #include <vespa/vespalib/objects/nbostream.h> @@ -30,6 +31,7 @@ using document::DocumentId; using document::DocumentType; using document::DocumentTypeRepo; using document::test::makeDocumentBucket; +using document::test::makeBucketSpace; using storage::lib::ClusterState; using vespalib::string; @@ -389,7 +391,7 @@ StorageProtocolTest::testRequestBucketInfo51() std::vector<document::BucketId> ids; ids.push_back(document::BucketId(3)); ids.push_back(document::BucketId(7)); - RequestBucketInfoCommand::SP cmd(new RequestBucketInfoCommand(ids)); + RequestBucketInfoCommand::SP cmd(new RequestBucketInfoCommand(makeBucketSpace(), ids)); RequestBucketInfoCommand::SP cmd2(copyCommand(cmd, _version5_1)); CPPUNIT_ASSERT_EQUAL(ids, cmd2->getBuckets()); CPPUNIT_ASSERT(!cmd2->hasSystemState()); @@ -399,6 +401,7 @@ StorageProtocolTest::testRequestBucketInfo51() { ClusterState state("distributor:3 .1.s:d"); RequestBucketInfoCommand::SP cmd(new RequestBucketInfoCommand( + makeBucketSpace(), 3, state, "14")); RequestBucketInfoCommand::SP cmd2(copyCommand(cmd, _version5_1)); CPPUNIT_ASSERT(cmd2->hasSystemState()); @@ -657,7 +660,7 @@ StorageProtocolTest::testCreateVisitor51() buckets.push_back(document::BucketId(16, 2)); CreateVisitorCommand::SP cmd( - new CreateVisitorCommand("library", "id", "doc selection")); + new CreateVisitorCommand(makeBucketSpace(), "library", "id", "doc selection")); cmd->setControlDestination("controldest"); cmd->setDataDestination("datadest"); cmd->setVisitorCmdId(1); diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp index d207b307593..e4993a1ee7b 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp @@ -562,11 +562,12 @@ ProtocolSerialization4_2::onEncode( api::StorageCommand::UP ProtocolSerialization4_2::onDecodeCreateVisitorCommand(BBuf& buf) const { + BucketSpace bucketSpace(BucketSpace::placeHolder()); vespalib::stringref libraryName = SH::getString(buf); vespalib::stringref instanceId = SH::getString(buf); vespalib::stringref selection = SH::getString(buf); api::CreateVisitorCommand::UP msg( - new api::CreateVisitorCommand(libraryName, instanceId, selection)); + new api::CreateVisitorCommand(bucketSpace, libraryName, instanceId, selection)); msg->setVisitorCmdId(SH::getInt(buf)); msg->setControlDestination(SH::getString(buf)); msg->setDataDestination(SH::getString(buf)); diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp index 2bd160b1aab..22f58ebc58b 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp @@ -638,12 +638,13 @@ ProtocolSerialization5_0::onDecodeRequestBucketInfoCommand(BBuf& buf) const buckets[i] = document::BucketId(SH::getLong(buf)); } api::RequestBucketInfoCommand::UP msg; + BucketSpace bucketSpace(BucketSpace::placeHolder()); if (buckets.size() != 0) { - msg.reset(new api::RequestBucketInfoCommand(buckets)); + msg.reset(new api::RequestBucketInfoCommand(bucketSpace, buckets)); } else { int distributor = SH::getShort(buf); lib::ClusterState state(SH::getString(buf)); - msg.reset(new api::RequestBucketInfoCommand(distributor, state, SH::getString(buf))); + msg.reset(new api::RequestBucketInfoCommand(bucketSpace, distributor, state, SH::getString(buf))); } onDecodeCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp index 4f84eff0ab8..dc97742b733 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp @@ -161,11 +161,12 @@ ProtocolSerialization5_1::onEncode( api::StorageCommand::UP ProtocolSerialization5_1::onDecodeCreateVisitorCommand(BBuf& buf) const { + BucketSpace bucketSpace(BucketSpace::placeHolder()); vespalib::stringref libraryName = SH::getString(buf); vespalib::stringref instanceId = SH::getString(buf); vespalib::stringref selection = SH::getString(buf); api::CreateVisitorCommand::UP msg( - new api::CreateVisitorCommand(libraryName, instanceId, selection)); + new api::CreateVisitorCommand(bucketSpace, libraryName, instanceId, selection)); msg->setVisitorCmdId(SH::getInt(buf)); msg->setControlDestination(SH::getString(buf)); msg->setDataDestination(SH::getString(buf)); diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp index 983a65114b3..18ad95c2c02 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.cpp +++ b/storageapi/src/vespa/storageapi/message/bucket.cpp @@ -440,8 +440,10 @@ ApplyBucketDiffReply::print(std::ostream& out, bool verbose, } RequestBucketInfoCommand::RequestBucketInfoCommand( + document::BucketSpace bucketSpace, const std::vector<document::BucketId>& buckets) : StorageCommand(MessageType::REQUESTBUCKETINFO), + _bucketSpace(bucketSpace), _buckets(buckets), _state(), _distributor(0xFFFF) @@ -449,9 +451,11 @@ RequestBucketInfoCommand::RequestBucketInfoCommand( } RequestBucketInfoCommand::RequestBucketInfoCommand( + document::BucketSpace bucketSpace, uint16_t distributor, const lib::ClusterState& state, const vespalib::stringref & distributionHash) : StorageCommand(MessageType::REQUESTBUCKETINFO), + _bucketSpace(bucketSpace), _buckets(), _state(new lib::ClusterState(state)), _distributor(distributor), @@ -460,8 +464,10 @@ RequestBucketInfoCommand::RequestBucketInfoCommand( } RequestBucketInfoCommand::RequestBucketInfoCommand( + document::BucketSpace bucketSpace, uint16_t distributor, const lib::ClusterState& state) : StorageCommand(MessageType::REQUESTBUCKETINFO), + _bucketSpace(bucketSpace), _buckets(), _state(new lib::ClusterState(state)), _distributor(distributor), diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index d2bf97e7768..0c97772d184 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -336,6 +336,7 @@ public: * the buckets that belong to the given distributor should be returned. */ class RequestBucketInfoCommand : public StorageCommand { + document::BucketSpace _bucketSpace; std::vector<document::BucketId> _buckets; std::unique_ptr<lib::ClusterState> _state; uint16_t _distributor; @@ -343,12 +344,15 @@ class RequestBucketInfoCommand : public StorageCommand { public: explicit RequestBucketInfoCommand( + document::BucketSpace bucketSpace, const std::vector<document::BucketId>& buckets); - RequestBucketInfoCommand(uint16_t distributor, + RequestBucketInfoCommand(document::BucketSpace bucketSpace, + uint16_t distributor, const lib::ClusterState& state, const vespalib::stringref & _distributionHash); - RequestBucketInfoCommand(uint16_t distributor, + RequestBucketInfoCommand(document::BucketSpace bucketSpace, + uint16_t distributor, const lib::ClusterState& state); const std::vector<document::BucketId>& getBuckets() const { return _buckets; } diff --git a/storageapi/src/vespa/storageapi/message/visitor.cpp b/storageapi/src/vespa/storageapi/message/visitor.cpp index 8c10eb501b2..7b5a614bd3e 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.cpp +++ b/storageapi/src/vespa/storageapi/message/visitor.cpp @@ -13,10 +13,12 @@ IMPLEMENT_REPLY(DestroyVisitorReply) IMPLEMENT_COMMAND(VisitorInfoCommand, VisitorInfoReply) IMPLEMENT_REPLY(VisitorInfoReply) -CreateVisitorCommand::CreateVisitorCommand(const vespalib::stringref & libraryName, +CreateVisitorCommand::CreateVisitorCommand(document::BucketSpace bucketSpace, + const vespalib::stringref & libraryName, const vespalib::stringref & instanceId, const vespalib::stringref & docSelection) : StorageCommand(MessageType::VISITOR_CREATE), + _bucketSpace(bucketSpace), _libName(libraryName), _params(), _controlDestination(), @@ -41,6 +43,7 @@ CreateVisitorCommand::CreateVisitorCommand(const vespalib::stringref & libraryNa CreateVisitorCommand::CreateVisitorCommand(const CreateVisitorCommand& o) : StorageCommand(o), + _bucketSpace(o._bucketSpace), _libName(o._libName), _params(o._params), _controlDestination(o._controlDestination), diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index 3d659831351..f252ecd344f 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -26,6 +26,7 @@ namespace api { */ class CreateVisitorCommand : public StorageCommand { private: + document::BucketSpace _bucketSpace; vespalib::string _libName; // Name of visitor library to use, ie. DumpVisitor.so vdslib::Parameters _params; @@ -53,7 +54,8 @@ private: uint32_t _maxBucketsPerVisitor; public: - CreateVisitorCommand(const vespalib::stringref & libraryName, + CreateVisitorCommand(document::BucketSpace bucketSpace, + const vespalib::stringref & libraryName, const vespalib::stringref & instanceId, const vespalib::stringref & docSelection); @@ -83,6 +85,7 @@ public: VisitorId getVisitorId() const { return _visitorId; } uint32_t getVisitorCmdId() const { return _visitorCmdId; } + document::BucketSpace getBucketSpace() const { return _bucketSpace; } const vespalib::string & getLibraryName() const { return _libName; } const vespalib::string & getInstanceId() const { return _instanceId; } const vespalib::string & getControlDestination() const |