summaryrefslogtreecommitdiffstats
path: root/storageapi
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-10-23 12:14:19 +0000
committerTor Egge <Tor.Egge@oath.com>2017-10-23 12:14:19 +0000
commitc2105574acbf1694e83b4b43fa8200fb48eb79b2 (patch)
tree094e665bed23596671614b6b9131a11fabbe5677 /storageapi
parent116c78e48da8f099c32168c48f8fbde56a2f74a0 (diff)
Add bucket space to request bucket info command.
Diffstat (limited to 'storageapi')
-rw-r--r--storageapi/src/tests/mbusprot/storageprotocoltest.cpp5
-rw-r--r--storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp5
-rw-r--r--storageapi/src/vespa/storageapi/message/bucket.cpp6
-rw-r--r--storageapi/src/vespa/storageapi/message/bucket.h8
4 files changed, 19 insertions, 5 deletions
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
index bfd657c2f05..0c8b5d326fe 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());
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/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; }