summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-10-20 13:36:16 +0200
committerGitHub <noreply@github.com>2017-10-20 13:36:16 +0200
commit5fd803fe826569265db2f76d327610ac829ed7ea (patch)
treed7a341f9f71afe98c2704218a88a5cf47a93374b
parentc29d5f06c591d303ef37ae75ab6e306ea3314bd5 (diff)
parent5b37d8b706055661ab68e8b2dee96cdedeaf0c72 (diff)
Merge pull request #3808 from vespa-engine/toregge/add-bucket-space-to-storage-commands-pass4
Adjust constructors for more storage commands to use document::Bucket
-rw-r--r--document/CMakeLists.txt1
-rw-r--r--document/src/vespa/document/CMakeLists.txt1
-rw-r--r--document/src/vespa/document/test/CMakeLists.txt6
-rw-r--r--document/src/vespa/document/test/make_document_bucket.cpp (renamed from storage/src/tests/common/make_document_bucket.cpp)6
-rw-r--r--document/src/vespa/document/test/make_document_bucket.h (renamed from storage/src/tests/common/make_document_bucket.h)4
-rw-r--r--documentapi/src/tests/messagebus/messagebus_test.cpp6
-rw-r--r--documentapi/src/tests/messages/messages50test.cpp13
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp13
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h23
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp3
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h5
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp6
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.h10
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp4
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp49
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/routablefactories50.h10
-rw-r--r--persistence/src/tests/spi/clusterstatetest.cpp5
-rw-r--r--storage/src/tests/bucketdb/bucketmanagertest.cpp4
-rw-r--r--storage/src/tests/common/CMakeLists.txt1
-rw-r--r--storage/src/tests/common/storagelinktest.cpp4
-rw-r--r--storage/src/tests/distributor/bucketdbupdatertest.cpp4
-rw-r--r--storage/src/tests/distributor/distributortest.cpp4
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp4
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/idealstatemanagertest.cpp4
-rw-r--r--storage/src/tests/distributor/mergeoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/pendingmessagetrackertest.cpp4
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/removelocationtest.cpp4
-rw-r--r--storage/src/tests/distributor/removeoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/splitbuckettest.cpp4
-rw-r--r--storage/src/tests/distributor/statoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/updateoperationtest.cpp4
-rw-r--r--storage/src/tests/persistence/common/filestortestfixture.cpp4
-rw-r--r--storage/src/tests/persistence/diskmoveoperationhandlertest.cpp5
-rw-r--r--storage/src/tests/persistence/filestorage/deletebuckettest.cpp4
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp22
-rw-r--r--storage/src/tests/persistence/filestorage/mergeblockingtest.cpp4
-rw-r--r--storage/src/tests/persistence/filestorage/operationabortingtest.cpp6
-rw-r--r--storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp4
-rw-r--r--storage/src/tests/persistence/filestorage/singlebucketjointest.cpp4
-rw-r--r--storage/src/tests/persistence/legacyoperationhandlertest.cpp4
-rw-r--r--storage/src/tests/persistence/mergehandlertest.cpp4
-rw-r--r--storage/src/tests/persistence/persistencequeuetest.cpp4
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp4
-rw-r--r--storage/src/tests/persistence/persistencethread_splittest.cpp4
-rw-r--r--storage/src/tests/persistence/processalltest.cpp4
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp4
-rw-r--r--storage/src/tests/storageserver/bouncertest.cpp4
-rw-r--r--storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp4
-rw-r--r--storage/src/tests/storageserver/communicationmanagertest.cpp4
-rw-r--r--storage/src/tests/storageserver/documentapiconvertertest.cpp76
-rw-r--r--storage/src/tests/storageserver/mergethrottlertest.cpp4
-rw-r--r--storage/src/tests/visiting/visitormanagertest.cpp4
-rw-r--r--storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp32
-rw-r--r--storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h2
-rw-r--r--storage/src/vespa/storage/bucketmover/bucketmover.cpp5
-rw-r--r--storage/src/vespa/storage/common/bucketmessages.cpp23
-rw-r--r--storage/src/vespa/storage/common/bucketmessages.h14
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/messages.cpp12
-rw-r--r--storage/src/vespa/storage/persistence/messages.h6
-rw-r--r--storage/src/vespa/storage/persistence/persistencethread.cpp2
-rw-r--r--storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp5
-rw-r--r--storage/src/vespa/storage/storageserver/documentapiconverter.cpp28
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp20
-rw-r--r--storage/src/vespa/storage/visiting/visitor.h12
-rw-r--r--storageapi/src/tests/mbusprot/storageprotocoltest.cpp11
-rw-r--r--storageapi/src/vespa/storageapi/message/datagram.cpp101
-rw-r--r--storageapi/src/vespa/storageapi/message/datagram.h99
-rw-r--r--storageapi/src/vespa/storageapi/messageapi/messagehandler.h17
-rw-r--r--storageserver/src/tests/storageservertest.cpp7
73 files changed, 236 insertions, 573 deletions
diff --git a/document/CMakeLists.txt b/document/CMakeLists.txt
index 72f4ee445fb..fd347ca492d 100644
--- a/document/CMakeLists.txt
+++ b/document/CMakeLists.txt
@@ -23,6 +23,7 @@ vespa_define_module(
src/vespa/document/serialization
src/vespa/document/update
src/vespa/document/util
+ src/vespa/document/test
TEST_DEPENDS
vdstestlib
diff --git a/document/src/vespa/document/CMakeLists.txt b/document/src/vespa/document/CMakeLists.txt
index 8d6999fdc24..7ae341f6d4b 100644
--- a/document/src/vespa/document/CMakeLists.txt
+++ b/document/src/vespa/document/CMakeLists.txt
@@ -14,6 +14,7 @@ vespa_add_library(document
$<TARGET_OBJECTS:document_repo>
$<TARGET_OBJECTS:document_serialization>
$<TARGET_OBJECTS:document_predicate>
+ $<TARGET_OBJECTS:document_test>
INSTALL lib64
DEPENDS
)
diff --git a/document/src/vespa/document/test/CMakeLists.txt b/document/src/vespa/document/test/CMakeLists.txt
new file mode 100644
index 00000000000..f16bfe0144a
--- /dev/null
+++ b/document/src/vespa/document/test/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+vespa_add_library(document_test OBJECT
+ SOURCES
+ make_document_bucket.cpp
+ DEPENDS
+)
diff --git a/storage/src/tests/common/make_document_bucket.cpp b/document/src/vespa/document/test/make_document_bucket.cpp
index cef33c515ee..f4d22f7b83f 100644
--- a/storage/src/tests/common/make_document_bucket.cpp
+++ b/document/src/vespa/document/test/make_document_bucket.cpp
@@ -2,11 +2,7 @@
#include "make_document_bucket.h"
-using document::Bucket;
-using document::BucketId;
-using document::BucketSpace;
-
-namespace storage::test {
+namespace document::test {
Bucket makeDocumentBucket(BucketId bucketId)
{
diff --git a/storage/src/tests/common/make_document_bucket.h b/document/src/vespa/document/test/make_document_bucket.h
index a95bc501c65..8c7411cc0e8 100644
--- a/storage/src/tests/common/make_document_bucket.h
+++ b/document/src/vespa/document/test/make_document_bucket.h
@@ -4,10 +4,10 @@
#include <vespa/document/bucket/bucket.h>
-namespace storage::test {
+namespace document::test {
// Helper function used by unit tests
-document::Bucket makeDocumentBucket(document::BucketId bucketId);
+Bucket makeDocumentBucket(BucketId bucketId);
}
diff --git a/documentapi/src/tests/messagebus/messagebus_test.cpp b/documentapi/src/tests/messagebus/messagebus_test.cpp
index 919dc6b6570..aa3fba01ef9 100644
--- a/documentapi/src/tests/messagebus/messagebus_test.cpp
+++ b/documentapi/src/tests/messagebus/messagebus_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/document/base/testdocrepo.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/vespalib/testkit/testapp.h>
@@ -13,6 +14,7 @@ using namespace documentapi;
using mbus::Blob;
using mbus::Routable;
using mbus::IRoutingPolicy;
+using document::test::makeDocumentBucket;
class Test : public vespalib::TestApp {
DocumentTypeRepo::SP _repo;
@@ -108,11 +110,11 @@ void Test::get_document_message_is_not_sequenced() {
}
void Test::stat_bucket_message_is_not_sequenced() {
- StatBucketMessage message(document::BucketId(16, 1), "");
+ StatBucketMessage message(makeDocumentBucket(document::BucketId(16, 1)), "");
EXPECT_FALSE(message.hasSequenceId());
}
void Test::get_bucket_list_message_is_not_sequenced() {
- GetBucketListMessage message(document::BucketId(16, 1));
+ GetBucketListMessage message(makeDocumentBucket(document::BucketId(16, 1)));
EXPECT_FALSE(message.hasSequenceId());
}
diff --git a/documentapi/src/tests/messages/messages50test.cpp b/documentapi/src/tests/messages/messages50test.cpp
index 964e4e12288..f25e3f19b08 100644
--- a/documentapi/src/tests/messages/messages50test.cpp
+++ b/documentapi/src/tests/messages/messages50test.cpp
@@ -7,9 +7,12 @@
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/bucket/bucketidfactory.h>
#include <vespa/document/select/parser.h>
+#include <vespa/document/test/make_document_bucket.h>
using document::DataType;
using document::DocumentTypeRepo;
+using document::test::makeDocumentBucket;
+using document::BucketSpace;
///////////////////////////////////////////////////////////////////////////////
//
@@ -88,7 +91,7 @@ createDoc(const DocumentTypeRepo &repo, const string &type_name, const string &i
bool
Messages50Test::testGetBucketListMessage()
{
- GetBucketListMessage msg(document::BucketId(16, 123));
+ GetBucketListMessage msg(makeDocumentBucket(document::BucketId(16, 123)));
msg.setLoadType(_loadTypes["foo"]);
EXPECT_EQUAL(string("foo"), msg.getLoadType().getName());
EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 12u, serialize("GetBucketListMessage", msg));
@@ -98,7 +101,7 @@ Messages50Test::testGetBucketListMessage()
if (EXPECT_TRUE(obj.get() != NULL)) {
GetBucketListMessage &ref = static_cast<GetBucketListMessage&>(*obj);
EXPECT_EQUAL(string("foo"), ref.getLoadType().getName());
- EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucketId());
+ EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucket().getBucketId());
}
}
return true;
@@ -132,7 +135,7 @@ Messages50Test::testEmptyBucketsMessage()
bool
Messages50Test::testStatBucketMessage()
{
- StatBucketMessage msg(document::BucketId(16, 123), "id.user=123");
+ StatBucketMessage msg(makeDocumentBucket(document::BucketId(16, 123)), "id.user=123");
EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 27u, serialize("StatBucketMessage", msg));
@@ -140,7 +143,7 @@ Messages50Test::testStatBucketMessage()
mbus::Routable::UP obj = deserialize("StatBucketMessage", DocumentProtocol::MESSAGE_STATBUCKET, lang);
if (EXPECT_TRUE(obj.get() != NULL)) {
StatBucketMessage &ref = static_cast<StatBucketMessage&>(*obj);
- EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucketId());
+ EXPECT_EQUAL(document::BucketId(16, 123), ref.getBucket().getBucketId());
EXPECT_EQUAL("id.user=123", ref.getDocumentSelection());
}
}
@@ -1110,7 +1113,7 @@ Messages50Test::testWrongDistributionReply()
bool
Messages50Test::testGetBucketListReply()
{
- GetBucketListReply reply;
+ GetBucketListReply reply(BucketSpace::placeHolder());
reply.getBuckets().push_back(GetBucketListReply::BucketInfo(document::BucketId(16, 123), "foo"));
reply.getBuckets().push_back(GetBucketListReply::BucketInfo(document::BucketId(17, 1123), "bar"));
reply.getBuckets().push_back(GetBucketListReply::BucketInfo(document::BucketId(18, 11123), "zoink"));
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp
index 71bb750a5aa..974135972f6 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.cpp
@@ -6,16 +6,9 @@
namespace documentapi {
-GetBucketListMessage::GetBucketListMessage() :
+GetBucketListMessage::GetBucketListMessage(const document::Bucket &bucket) :
DocumentMessage(),
- _bucketId()
-{
- // empty
-}
-
-GetBucketListMessage::GetBucketListMessage(const document::BucketId &bucketId) :
- DocumentMessage(),
- _bucketId(bucketId)
+ _bucket(bucket)
{
// empty
}
@@ -23,7 +16,7 @@ GetBucketListMessage::GetBucketListMessage(const document::BucketId &bucketId) :
DocumentReply::UP
GetBucketListMessage::doCreateReply() const
{
- return DocumentReply::UP(new GetBucketListReply());
+ return DocumentReply::UP(new GetBucketListReply(_bucket.getBucketSpace()));
}
uint32_t
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h
index 350f36cc708..6b70808aea5 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h
@@ -2,13 +2,13 @@
#pragma once
#include "documentmessage.h"
-#include <vespa/document/bucket/bucketid.h>
+#include <vespa/document/bucket/bucket.h>
namespace documentapi {
class GetBucketListMessage : public DocumentMessage {
private:
- document::BucketId _bucketId;
+ document::Bucket _bucket;
protected:
// Implements DocumentMessage.
@@ -16,30 +16,19 @@ protected:
public:
/**
- * Constructs a new message for deserialization.
- */
- GetBucketListMessage();
-
- /**
* Constructs a new message with initial content.
*
- * @param bucketId The bucket whose list to retrieve.
+ * @param bucket The bucket whose list to retrieve.
*/
- GetBucketListMessage(const document::BucketId &bucketId);
+ GetBucketListMessage(const document::Bucket &bucket);
/**
* Returns the bucket whose list to retrieve.
*
- * @return The bucket id.
+ * @return The bucket.
*/
- const document::BucketId& getBucketId() const { return _bucketId; }
+ const document::Bucket &getBucket() const { return _bucket; }
- /**
- * Sets the bucket whose list to retrieve.
- *
- * @param id The bucket id to set.
- */
- void setBucketId(const document::BucketId& id) { _bucketId = id; }
uint32_t getType() const override;
string toString() const override { return "getbucketlistmessage"; }
};
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp
index e144158e0ef..e9f66ed1f2f 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp
@@ -23,8 +23,9 @@ GetBucketListReply::BucketInfo::operator==(const GetBucketListReply::BucketInfo
return _bucket == rhs._bucket && _bucketInformation == rhs._bucketInformation;
}
-GetBucketListReply::GetBucketListReply() :
+GetBucketListReply::GetBucketListReply(document::BucketSpace bucketSpace) :
DocumentReply(DocumentProtocol::REPLY_GETBUCKETLIST),
+ _bucketSpace(bucketSpace),
_buckets()
{
// empty
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h
index 3ded7f7d08b..3c6a2a25bfc 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h
@@ -2,7 +2,7 @@
#pragma once
#include "documentreply.h"
-#include <vespa/document/bucket/bucketid.h>
+#include <vespa/document/bucket/bucket.h>
namespace documentapi {
@@ -20,13 +20,14 @@ public:
};
private:
+ document::BucketSpace _bucketSpace;
std::vector<BucketInfo> _buckets;
public:
/**
* Constructs a new reply with no content.
*/
- GetBucketListReply();
+ GetBucketListReply(document::BucketSpace bucketSpace);
/**
* Returns the bucket state contained in this.
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp
index 4208c9974bc..00aef46cb79 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.cpp
@@ -3,15 +3,17 @@
#include "statbucketreply.h"
#include <vespa/documentapi/messagebus/documentprotocol.h>
+using document::BucketSpace;
+
namespace documentapi {
StatBucketMessage::StatBucketMessage() :
DocumentMessage(),
- _bucket(),
+ _bucket(BucketSpace::placeHolder(), document::BucketId()),
_documentSelection()
{}
-StatBucketMessage::StatBucketMessage(document::BucketId bucket, const string& documentSelection) :
+StatBucketMessage::StatBucketMessage(document::Bucket bucket, const string& documentSelection) :
DocumentMessage(),
_bucket(bucket),
_documentSelection(documentSelection)
diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.h
index 74e908f4a85..a13d675ee0b 100644
--- a/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.h
+++ b/documentapi/src/vespa/documentapi/messagebus/messages/statbucketmessage.h
@@ -2,13 +2,13 @@
#pragma once
#include "documentmessage.h"
-#include <vespa/document/bucket/bucketid.h>
+#include <vespa/document/bucket/bucket.h>
namespace documentapi {
class StatBucketMessage : public DocumentMessage {
private:
- document::BucketId _bucket;
+ document::Bucket _bucket;
string _documentSelection;
protected:
@@ -25,7 +25,7 @@ public:
*
* @param bucket The bucket whose list to retrieve.
*/
- StatBucketMessage(document::BucketId bucket, const string& documentSelection);
+ StatBucketMessage(document::Bucket bucket, const string& documentSelection);
~StatBucketMessage();
@@ -34,14 +34,14 @@ public:
*
* @return The bucket id.
*/
- document::BucketId getBucketId() const { return _bucket; }
+ document::Bucket getBucket() const { return _bucket; }
/**
* Set the bucket to stat.
*
* @param id The identifier to set.
*/
- void setBucketId(document::BucketId id) { _bucket = id; };
+ void setBucket(document::Bucket bucket) { _bucket = bucket; };
/**
* Returns the document selection used to filter the documents
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
index b7b451e8ddf..b638fd1cabe 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
@@ -139,11 +139,11 @@ StoragePolicy::doSelect(mbus::RoutingContext &context)
break;
case DocumentProtocol::MESSAGE_STATBUCKET:
- id = static_cast<const StatBucketMessage&>(msg).getBucketId();
+ id = static_cast<const StatBucketMessage&>(msg).getBucket().getBucketId();
break;
case DocumentProtocol::MESSAGE_GETBUCKETLIST:
- id = static_cast<const GetBucketListMessage&>(msg).getBucketId();
+ id = static_cast<const GetBucketListMessage&>(msg).getBucket().getBucketId();
break;
case DocumentProtocol::MESSAGE_CREATEVISITOR:
diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp
index 504b3fcdf4f..fff46c0128d 100644
--- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.cpp
@@ -10,6 +10,7 @@
using vespalib::nbostream;
using std::make_unique;
using std::make_shared;
+using document::BucketSpace;
namespace documentapi {
@@ -270,36 +271,6 @@ RoutableFactories50::DestroyVisitorReplyFactory::doEncode(const DocumentReply &o
}
DocumentMessage::UP
-RoutableFactories50::DocBlockMessageFactory::doDecode(document::ByteBuffer &buf) const
-{
- (void)buf;
- return DocumentMessage::UP(); // TODO: remove message type
-}
-
-bool
-RoutableFactories50::DocBlockMessageFactory::doEncode(const DocumentMessage &obj, vespalib::GrowableByteBuffer &buf) const
-{
- (void)obj;
- (void)buf;
- return false;
-}
-
-DocumentReply::UP
-RoutableFactories50::DocBlockReplyFactory::doDecode(document::ByteBuffer &buf) const
-{
- (void)buf;
- return DocumentReply::UP(); // TODO: remove reply type
-}
-
-bool
-RoutableFactories50::DocBlockReplyFactory::doEncode(const DocumentReply &obj, vespalib::GrowableByteBuffer &buf) const
-{
- (void)obj;
- (void)buf;
- return false;
-}
-
-DocumentMessage::UP
RoutableFactories50::DocumentListMessageFactory::doDecode(document::ByteBuffer &buf) const
{
DocumentMessage::UP ret(new DocumentListMessage());
@@ -437,26 +408,23 @@ RoutableFactories50::EmptyBucketsReplyFactory::doEncode(const DocumentReply &obj
DocumentMessage::UP
RoutableFactories50::GetBucketListMessageFactory::doDecode(document::ByteBuffer &buf) const
{
- DocumentMessage::UP ret(new GetBucketListMessage());
- GetBucketListMessage &msg = static_cast<GetBucketListMessage&>(*ret);
-
- msg.setBucketId(document::BucketId(decodeLong(buf)));
-
- return ret;
+ document::BucketId bucketId(decodeLong(buf));
+ document::Bucket bucket(BucketSpace::placeHolder(), bucketId);
+ return std::make_unique<GetBucketListMessage>(bucket);
}
bool
RoutableFactories50::GetBucketListMessageFactory::doEncode(const DocumentMessage &obj, vespalib::GrowableByteBuffer &buf) const
{
const GetBucketListMessage &msg = static_cast<const GetBucketListMessage&>(obj);
- buf.putLong(msg.getBucketId().getRawId());
+ buf.putLong(msg.getBucket().getBucketId().getRawId());
return true;
}
DocumentReply::UP
RoutableFactories50::GetBucketListReplyFactory::doDecode(document::ByteBuffer &buf) const
{
- DocumentReply::UP ret(new GetBucketListReply());
+ DocumentReply::UP ret(new GetBucketListReply(BucketSpace::placeHolder()));
GetBucketListReply &reply = static_cast<GetBucketListReply&>(*ret);
int32_t len = decodeInt(buf);
@@ -869,7 +837,8 @@ RoutableFactories50::StatBucketMessageFactory::doDecode(document::ByteBuffer &bu
DocumentMessage::UP ret(new StatBucketMessage());
StatBucketMessage &msg = static_cast<StatBucketMessage&>(*ret);
- msg.setBucketId(document::BucketId(decodeLong(buf)));
+ document::Bucket bucket(BucketSpace::placeHolder(), document::BucketId(decodeLong(buf)));
+ msg.setBucket(bucket);
msg.setDocumentSelection(decodeString(buf));
return ret;
@@ -880,7 +849,7 @@ RoutableFactories50::StatBucketMessageFactory::doEncode(const DocumentMessage &o
{
const StatBucketMessage &msg = static_cast<const StatBucketMessage&>(obj);
- buf.putLong(msg.getBucketId().getRawId());
+ buf.putLong(msg.getBucket().getBucketId().getRawId());
buf.putString(msg.getDocumentSelection());
return true;
diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h
index cf9f223ab3b..102b7f16c43 100644
--- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h
+++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h
@@ -200,16 +200,6 @@ public:
DocumentReply::UP doDecode(document::ByteBuffer &buf) const override;
bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override;
};
- class DocBlockMessageFactory : public DocumentMessageFactory {
- protected:
- DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override;
- bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override;
- };
- class DocBlockReplyFactory : public DocumentReplyFactory {
- protected:
- DocumentReply::UP doDecode(document::ByteBuffer &buf) const override;
- bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override;
- };
class DocumentListMessageFactory : public DocumentMessageFactory {
const document::DocumentTypeRepo &_repo;
DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override;
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp
index 2fdaf25abf6..7d34ddd4b03 100644
--- a/persistence/src/tests/spi/clusterstatetest.cpp
+++ b/persistence/src/tests/spi/clusterstatetest.cpp
@@ -2,11 +2,14 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/persistence/conformancetest/conformancetest.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/config-stor-distribution.h>
+using storage::spi::test::makeBucket;
+
namespace storage {
namespace spi {
@@ -169,7 +172,7 @@ ClusterStateTest::testReady()
{
lib::ClusterState s("version:1 storage:3 distributor:3");
- Bucket b(document::Bucket(document::BucketSpace::placeHolder(), document::BucketId(16, 1)), PartitionId(0));
+ Bucket b(makeBucket(document::BucketId(16, 1)));
// With 3 copies, this bucket has ideal state 0, 2, 1
diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp
index 9b3ef4bf2e8..98f3e06fc62 100644
--- a/storage/src/tests/bucketdb/bucketmanagertest.cpp
+++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp
@@ -14,7 +14,7 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
#include <tests/common/testhelper.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdslib/state/random.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/testkit/testapp.h>
@@ -30,7 +30,7 @@ using document::DocumenttypesConfig;
using config::FileSpec;
using document::DocumentType;
using document::DocumentTypeRepo;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt
index dc322c345e3..c7243e68146 100644
--- a/storage/src/tests/common/CMakeLists.txt
+++ b/storage/src/tests/common/CMakeLists.txt
@@ -3,7 +3,6 @@ vespa_add_library(storage_testcommon TEST
SOURCES
dummystoragelink.cpp
testhelper.cpp
- make_document_bucket.cpp
metricstest.cpp
storagelinktest.cpp
testnodestateupdater.cpp
diff --git a/storage/src/tests/common/storagelinktest.cpp b/storage/src/tests/common/storagelinktest.cpp
index 0490581d7ff..95fe8ad23da 100644
--- a/storage/src/tests/common/storagelinktest.cpp
+++ b/storage/src/tests/common/storagelinktest.cpp
@@ -1,12 +1,12 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/common/storagelinktest.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <iostream>
#include <string>
#include <vespa/storageapi/message/stat.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp
index 54a5f3ec4b1..f9578fc47a4 100644
--- a/storage/src/tests/distributor/bucketdbupdatertest.cpp
+++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp
@@ -8,14 +8,14 @@
#include <vespa/storageframework/defaultimplementation/clock/realclock.h>
#include <vespa/storage/storageutil/distributorstatecache.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/simpleclusterinformation.h>
#include <vespa/storage/distributor/distributor.h>
#include <vespa/vespalib/text/stringtokenizer.h>
using namespace storage::api;
using namespace storage::lib;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp
index e40add9b76d..b830aa6d506 100644
--- a/storage/src/tests/distributor/distributortest.cpp
+++ b/storage/src/tests/distributor/distributortest.cpp
@@ -9,13 +9,13 @@
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/config/config-stor-distributormanager.h>
#include <tests/common/dummystoragelink.h>
#include <vespa/storage/distributor/distributor.h>
#include <vespa/vespalib/text/stringtokenizer.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index a66a22c7eb1..6cf8d068231 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -5,9 +5,9 @@
#include <vespa/storage/distributor/operation_sequencer.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storage/distributor/distributor.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index 315152e4683..ee1ea70163f 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -8,7 +8,7 @@
#include <tests/distributor/distributortestutil.h>
#include <vespa/storageapi/message/persistence.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/config/helper/configgetter.hpp>
@@ -21,7 +21,7 @@ using std::shared_ptr;
using config::ConfigGetter;
using document::DocumenttypesConfig;
using config::FileSpec;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp
index 8f4b99d9d7f..e48046fb4ac 100644
--- a/storage/src/tests/distributor/idealstatemanagertest.cpp
+++ b/storage/src/tests/distributor/idealstatemanagertest.cpp
@@ -9,9 +9,9 @@
#include <vespa/storageapi/message/visitor.h>
#include <vespa/storageapi/message/bucketsplitting.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp
index d33ee64a883..f1db60a5ef4 100644
--- a/storage/src/tests/distributor/mergeoperationtest.cpp
+++ b/storage/src/tests/distributor/mergeoperationtest.cpp
@@ -8,12 +8,12 @@
#include <vespa/storage/distributor/operations/idealstate/mergeoperation.h>
#include <vespa/storage/distributor/bucketdbupdater.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/distributor.h>
#include <vespa/vespalib/text/stringtokenizer.h>
using std::shared_ptr;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
index 1fc12821e1d..6aba8e1fb98 100644
--- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp
+++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
@@ -7,11 +7,11 @@
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdslib/state/random.h>
#include <vespa/vdstestlib/cppunit/macros.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index 156fc2fc8ca..5cc9a26a9ea 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -10,7 +10,7 @@
#include <vespa/storageapi/message/state.h>
#include <tests/distributor/distributortestutil.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/testkit/test_kit.h>
@@ -27,7 +27,7 @@ using namespace storage;
using namespace storage::api;
using namespace storage::lib;
using namespace std::literals::string_literals;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp
index 975d77d870f..8c55b7e715c 100644
--- a/storage/src/tests/distributor/removelocationtest.cpp
+++ b/storage/src/tests/distributor/removelocationtest.cpp
@@ -6,10 +6,10 @@
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storage/distributor/operations/external/removelocationoperation.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/distributor.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp
index 013d62bac14..4c2f1bba00d 100644
--- a/storage/src/tests/distributor/removeoperationtest.cpp
+++ b/storage/src/tests/distributor/removeoperationtest.cpp
@@ -6,10 +6,10 @@
#include <vespa/storage/distributor/distributor.h>
#include <vespa/storageapi/message/persistence.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/operations/external/removeoperation.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/splitbuckettest.cpp b/storage/src/tests/distributor/splitbuckettest.cpp
index e4c90dcbbe3..2caf8f106f1 100644
--- a/storage/src/tests/distributor/splitbuckettest.cpp
+++ b/storage/src/tests/distributor/splitbuckettest.cpp
@@ -9,12 +9,12 @@
#include <vespa/storage/distributor/idealstatemanager.h>
#include <vespa/storageapi/message/multioperation.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/distributor.h>
using std::shared_ptr;
using namespace document;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/distributor/statoperationtest.cpp b/storage/src/tests/distributor/statoperationtest.cpp
index e9364b06085..442d74503ab 100644
--- a/storage/src/tests/distributor/statoperationtest.cpp
+++ b/storage/src/tests/distributor/statoperationtest.cpp
@@ -4,12 +4,12 @@
#include <vespa/storageapi/message/stat.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/operations/external/statbucketoperation.h>
#include <vespa/storage/distributor/operations/external/statbucketlistoperation.h>
#include <vespa/storage/distributor/distributor.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 7d3c61d5674..9f6a7010179 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -13,10 +13,10 @@
#include <vespa/storage/distributor/operations/external/twophaseupdateoperation.h>
#include <vespa/storageapi/message/batch.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/distributor.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace distributor {
diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp
index 425751ee0d0..62590eabdad 100644
--- a/storage/src/tests/distributor/updateoperationtest.cpp
+++ b/storage/src/tests/distributor/updateoperationtest.cpp
@@ -7,7 +7,7 @@
#include <vespa/storageapi/message/state.h>
#include <vespa/storageapi/message/bucket.h>
#include <tests/distributor/distributortestutil.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/distributor/operations/external/updateoperation.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/storage/distributor/distributor.h>
@@ -23,7 +23,7 @@ using namespace storage::lib;
using config::ConfigGetter;
using config::FileSpec;
using vespalib::string;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
class UpdateOperation_Test : public CppUnit::TestFixture,
public DistributorTestUtil
diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp
index 2fd070de394..4694e8df363 100644
--- a/storage/src/tests/persistence/common/filestortestfixture.cpp
+++ b/storage/src/tests/persistence/common/filestortestfixture.cpp
@@ -4,12 +4,12 @@
#include <vespa/storage/persistence/filestorage/filestormanager.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/persistence/spi/test.h>
#include <sstream>
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/diskmoveoperationhandlertest.cpp b/storage/src/tests/persistence/diskmoveoperationhandlertest.cpp
index 3d7e65fec1c..def9dd6ec6e 100644
--- a/storage/src/tests/persistence/diskmoveoperationhandlertest.cpp
+++ b/storage/src/tests/persistence/diskmoveoperationhandlertest.cpp
@@ -4,6 +4,9 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/storage/persistence/messages.h>
#include <tests/persistence/persistencetestutils.h>
+#include <vespa/document/test/make_document_bucket.h>
+
+using document::test::makeDocumentBucket;
namespace storage {
@@ -43,7 +46,7 @@ DiskMoveOperationHandlerTest::testSimple()
DiskMoveOperationHandler diskMoveHandler(
getEnv(3),
getPersistenceProvider());
- BucketDiskMoveCommand move(document::BucketId(16, 4), 3, 4);
+ BucketDiskMoveCommand move(makeDocumentBucket(document::BucketId(16, 4)), 3, 4);
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
diskMoveHandler.handleBucketDiskMove(move, context);
diff --git a/storage/src/tests/persistence/filestorage/deletebuckettest.cpp b/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
index e6da51e103a..3e0f36a6cdd 100644
--- a/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
+++ b/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
@@ -4,13 +4,13 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/storageapi/message/bucket.h>
#include <tests/persistence/common/persistenceproviderwrapper.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
LOG_SETUP(".deletebuckettest");
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 87655d8bd35..7b6bd4c5a86 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -4,7 +4,7 @@
#include <tests/common/storagelinktest.h>
#include <tests/common/teststorageapp.h>
#include <tests/persistence/filestorage/forwardingmessagesender.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/storageserver/statemanager.h>
#include <vespa/storage/bucketdb/bucketmanager.h>
#include <vespa/storage/persistence/persistencethread.h>
@@ -41,7 +41,7 @@ using std::unique_ptr;
using document::Document;
using namespace storage::api;
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
#define ASSERT_SINGLE_REPLY(replytype, reply, link, time) \
reply = 0; \
@@ -490,7 +490,7 @@ FileStorManagerTest::testDiskMove()
{
std::shared_ptr<BucketDiskMoveCommand> cmd(
- new BucketDiskMoveCommand(bid, 0, 1));
+ new BucketDiskMoveCommand(makeDocumentBucket(bid), 0, 1));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -571,7 +571,7 @@ FileStorManagerTest::testRepairNotifiesDistributorOnChange()
getDummyPersistence().simulateMaintenanceFailure();
std::shared_ptr<RepairBucketCommand> cmd(
- new RepairBucketCommand(document::BucketId(16, 1), 0));
+ new RepairBucketCommand(makeDocumentBucket(document::BucketId(16, 1)), 0));
top.sendDown(cmd);
top.waitForMessages(2, _waitTime);
@@ -1931,7 +1931,7 @@ createIterator(DummyStorageLink& link,
selection.setFromTimestamp(spi::Timestamp(fromTime.getTime()));
selection.setToTimestamp(spi::Timestamp(toTime.getTime()));
CreateIteratorCommand::SP createIterCmd(
- new CreateIteratorCommand(bucket,
+ new CreateIteratorCommand(makeDocumentBucket(bucket),
selection,
headerOnly ? "[header]" : "[all]",
spi::NEWEST_DOCUMENT_ONLY));
@@ -2019,7 +2019,7 @@ FileStorManagerTest::testVisiting()
127));
spi::IteratorId iterId(createIterator(top, ids[0], "true"));
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), ids[0], iterId, 16*1024));
+ new GetIterCommand(std::move(token), makeDocumentBucket(ids[0]), iterId, 16*1024));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
@@ -2047,7 +2047,7 @@ FileStorManagerTest::testVisiting()
16*1024,
127));
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), ids[1], iterId, 16*1024));
+ new GetIterCommand(std::move(token), makeDocumentBucket(ids[1]), iterId, 16*1024));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
@@ -2086,7 +2086,7 @@ FileStorManagerTest::testVisiting()
16*1024,
127));
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), ids[1], iterId, 16*1024));
+ new GetIterCommand(std::move(token), makeDocumentBucket(ids[1]), iterId, 16*1024));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
@@ -2807,7 +2807,7 @@ FileStorManagerTest::testGetIter()
2048,
127));
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), bid, iterId, 2048));
+ new GetIterCommand(std::move(token), makeDocumentBucket(bid), iterId, 2048));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
@@ -2845,7 +2845,7 @@ FileStorManagerTest::testGetIter()
2048,
127));
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), bid, iterId, 2048));
+ new GetIterCommand(std::move(token), makeDocumentBucket(bid), iterId, 2048));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
@@ -2909,7 +2909,7 @@ FileStorManagerTest::testSetBucketActiveState()
// Trigger bucket info to be read back into the database
{
std::shared_ptr<ReadBucketInfo> cmd(
- new ReadBucketInfo(bid));
+ new ReadBucketInfo(makeDocumentBucket(bid)));
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
CPPUNIT_ASSERT_EQUAL((size_t) 1, top.getNumReplies());
diff --git a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
index 8bf8ac087b9..50999f5883e 100644
--- a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
+++ b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
@@ -6,9 +6,9 @@
#include <tests/persistence/common/persistenceproviderwrapper.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
index 9a71fe16a15..aab0aa2c0fb 100644
--- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
+++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
@@ -5,7 +5,7 @@
#include <tests/persistence/common/persistenceproviderwrapper.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vespalib/util/barrier.h>
#include <vespa/vespalib/util/thread.h>
#include <vespa/vespalib/stllike/hash_set_insert.hpp>
@@ -13,7 +13,7 @@
#include <vespa/log/log.h>
LOG_SETUP(".operationabortingtest");
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
@@ -352,7 +352,7 @@ OperationAbortingTest::testDoNotAbortRecheckBucketCommands()
{
document::BucketId bucket(16, 1);
std::vector<api::StorageMessage::SP> msgs;
- msgs.push_back(api::StorageMessage::SP(new RecheckBucketInfoCommand(bucket)));
+ msgs.push_back(api::StorageMessage::SP(new RecheckBucketInfoCommand(makeDocumentBucket(bucket))));
bool shouldCreateBucketInitially(true);
doTestSpecificOperationsNotAborted(
diff --git a/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp b/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
index cbb1cb48f3e..6f8741876aa 100644
--- a/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
+++ b/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
@@ -4,12 +4,12 @@
#include <vespa/storageapi/message/bucket.h>
#include <vespa/persistence/spi/test.h>
#include <tests/persistence/common/persistenceproviderwrapper.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp b/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
index 83d79ab4d77..8e6340c930c 100644
--- a/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
+++ b/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
@@ -7,11 +7,11 @@
#include <tests/persistence/common/persistenceproviderwrapper.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
LOG_SETUP(".singlebucketjointest");
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/legacyoperationhandlertest.cpp b/storage/src/tests/persistence/legacyoperationhandlertest.cpp
index ff331d44ecd..40fe3119747 100644
--- a/storage/src/tests/persistence/legacyoperationhandlertest.cpp
+++ b/storage/src/tests/persistence/legacyoperationhandlertest.cpp
@@ -8,12 +8,12 @@
#include <vespa/persistence/spi/test.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/persistencetestutils.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
using document::DocumentTypeRepo;
using document::TestDocRepo;
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp
index 3c00a7796ba..120dbd4ce45 100644
--- a/storage/src/tests/persistence/mergehandlertest.cpp
+++ b/storage/src/tests/persistence/mergehandlertest.cpp
@@ -6,14 +6,14 @@
#include <tests/persistence/persistencetestutils.h>
#include <tests/persistence/common/persistenceproviderwrapper.h>
#include <tests/distributor/messagesenderstub.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <cmath>
#include <vespa/log/log.h>
LOG_SETUP(".test.persistence.handler.merge");
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/persistencequeuetest.cpp b/storage/src/tests/persistence/persistencequeuetest.cpp
index a86cfd38cda..77e0ed6b71c 100644
--- a/storage/src/tests/persistence/persistencequeuetest.cpp
+++ b/storage/src/tests/persistence/persistencequeuetest.cpp
@@ -7,11 +7,11 @@
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
#include <tests/persistence/filestorage/forwardingmessagesender.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
LOG_SETUP(".persistencequeuetest");
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index d8df03602ef..480f236997a 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -3,7 +3,7 @@
#include <vespa/document/datatype/documenttype.h>
#include <vespa/storageapi/message/persistence.h>
#include <tests/persistence/persistencetestutils.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/document/update/assignvalueupdate.h>
@@ -13,7 +13,7 @@
using document::DocumentType;
using storage::framework::defaultimplementation::AllocationLogic;
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/persistencethread_splittest.cpp b/storage/src/tests/persistence/persistencethread_splittest.cpp
index 50fedee1d0a..b6e02e88540 100644
--- a/storage/src/tests/persistence/persistencethread_splittest.cpp
+++ b/storage/src/tests/persistence/persistencethread_splittest.cpp
@@ -5,10 +5,10 @@
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/persistence/spi/test.h>
#include <tests/persistence/persistencetestutils.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace {
diff --git a/storage/src/tests/persistence/processalltest.cpp b/storage/src/tests/persistence/processalltest.cpp
index 4b300c12dd3..11754d50961 100644
--- a/storage/src/tests/persistence/processalltest.cpp
+++ b/storage/src/tests/persistence/processalltest.cpp
@@ -6,9 +6,9 @@
#include <vespa/storage/persistence/messages.h>
#include <vespa/documentapi/loadtypes/loadtype.h>
#include <tests/persistence/persistencetestutils.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 2332596263b..a19ba26e866 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -3,7 +3,7 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/storage/persistence/persistencethread.h>
#include <tests/persistence/persistencetestutils.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/documentapi/messagebus/messages/testandsetcondition.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/document/update/assignvalueupdate.h>
@@ -15,7 +15,7 @@ using std::shared_ptr;
using namespace std::string_literals;
using storage::spi::test::makeBucket;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp
index 44d2dc889ab..5be57155ec9 100644
--- a/storage/src/tests/storageserver/bouncertest.cpp
+++ b/storage/src/tests/storageserver/bouncertest.cpp
@@ -8,11 +8,11 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/config/common/exceptions.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
index 53d41051fae..732aff5faf6 100644
--- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
+++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
@@ -13,10 +13,10 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/storageserver/changedbucketownershiphandler.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp
index 4f9a68a69c2..5111368dd1c 100644
--- a/storage/src/tests/storageserver/communicationmanagertest.cpp
+++ b/storage/src/tests/storageserver/communicationmanagertest.cpp
@@ -10,10 +10,10 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
#include <tests/common/testhelper.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdstestlib/cppunit/macros.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp
index ff261e88922..1744bfb6a79 100644
--- a/storage/src/tests/storageserver/documentapiconvertertest.cpp
+++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp
@@ -13,7 +13,7 @@
#include <vespa/document/bucket/bucketidfactory.h>
#include <vespa/config/subscription/configuri.h>
#include <vespa/vespalib/testkit/test_kit.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
using document::DataType;
using document::DocIdString;
@@ -21,7 +21,7 @@ using document::Document;
using document::DocumentId;
using document::DocumentTypeRepo;
using document::readDocumenttypesConfig;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
@@ -52,8 +52,6 @@ struct DocumentApiConverterTest : public CppUnit::TestFixture
void testCreateVisitorReplyLastBucket();
void testDestroyVisitor();
void testVisitorInfo();
- void testDocBlock();
- void testDocBlockWithKeepTimeStamps();
void testMultiOperation();
void testBatchDocumentUpdate();
@@ -68,8 +66,6 @@ struct DocumentApiConverterTest : public CppUnit::TestFixture
CPPUNIT_TEST(testCreateVisitorReplyLastBucket);
CPPUNIT_TEST(testDestroyVisitor);
CPPUNIT_TEST(testVisitorInfo);
- CPPUNIT_TEST(testDocBlock);
- CPPUNIT_TEST(testDocBlockWithKeepTimeStamps);
CPPUNIT_TEST(testMultiOperation);
CPPUNIT_TEST(testBatchDocumentUpdate);
CPPUNIT_TEST_SUITE_END();
@@ -270,74 +266,6 @@ DocumentApiConverterTest::testVisitorInfo()
}
void
-DocumentApiConverterTest::testDocBlock()
-{
- Document::SP doc(new Document(_html_type, DocumentId(DocIdString("test", "test"))));
-
- char buffer[10000];
- vdslib::WritableDocumentList docBlock(_repo, buffer, sizeof(buffer));
- docBlock.addPut(*doc, 100);
-
- document::BucketIdFactory fac;
- document::BucketId bucketId = fac.getBucketId(doc->getId());
- bucketId.setUsedBits(32);
-
- api::DocBlockCommand dbcmd(bucketId, docBlock, std::shared_ptr<void>());
- dbcmd.setTimeout(123456);
-
- std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo);
-
- documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get());
- CPPUNIT_ASSERT(mbusdb);
-
- CPPUNIT_ASSERT_EQUAL((uint64_t)123456, mbusdb->getTimeRemaining());
-
- const vdslib::DocumentList& list = mbusdb->getOperations();
- CPPUNIT_ASSERT_EQUAL((uint32_t)1, list.size());
- CPPUNIT_ASSERT_EQUAL(*doc, *dynamic_cast<document::Document*>(list.begin()->getDocument().get()));
-
- std::unique_ptr<mbus::Reply> reply = mbusdb->createReply();
- CPPUNIT_ASSERT(reply.get());
-
- std::unique_ptr<storage::api::StorageReply> rep =
- _converter->toStorageAPI(static_cast<documentapi::DocumentReply&>(*reply), dbcmd);
- api::DocBlockReply* pr = dynamic_cast<api::DocBlockReply*>(rep.get());
- CPPUNIT_ASSERT(pr);
-}
-
-
-void
-DocumentApiConverterTest::testDocBlockWithKeepTimeStamps()
-{
- char buffer[10000];
- vdslib::WritableDocumentList docBlock(_repo, buffer, sizeof(buffer));
- api::DocBlockCommand dbcmd(document::BucketId(0), docBlock, std::shared_ptr<void>());
-
- {
- CPPUNIT_ASSERT_EQUAL(dbcmd.keepTimeStamps(), false);
-
- std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo);
-
- documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get());
- CPPUNIT_ASSERT(mbusdb);
- CPPUNIT_ASSERT_EQUAL(mbusdb->keepTimeStamps(), false);
- }
-
- {
- dbcmd.keepTimeStamps(true);
- CPPUNIT_ASSERT_EQUAL(dbcmd.keepTimeStamps(), true);
-
- std::unique_ptr<mbus::Message> mbusmsg = _converter->toDocumentAPI(dbcmd, _repo);
-
- documentapi::MultiOperationMessage* mbusdb = dynamic_cast<documentapi::MultiOperationMessage*>(mbusmsg.get());
- CPPUNIT_ASSERT(mbusdb);
- CPPUNIT_ASSERT_EQUAL(mbusdb->keepTimeStamps(), true);
- }
-
-}
-
-
-void
DocumentApiConverterTest::testMultiOperation()
{
//create a document
diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp
index 17503200d10..7d04714e9a8 100644
--- a/storage/src/tests/storageserver/mergethrottlertest.cpp
+++ b/storage/src/tests/storageserver/mergethrottlertest.cpp
@@ -6,7 +6,7 @@
#include <tests/common/storagelinktest.h>
#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/storageserver/mergethrottler.h>
#include <vespa/storage/persistence/messages.h>
#include <vespa/storageapi/message/bucket.h>
@@ -22,7 +22,7 @@
using namespace document;
using namespace storage::api;
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp
index 017da4e4904..3c5780cf77c 100644
--- a/storage/src/tests/visiting/visitormanagertest.cpp
+++ b/storage/src/tests/visiting/visitormanagertest.cpp
@@ -12,7 +12,7 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/testhelper.h>
#include <tests/common/dummystoragelink.h>
-#include <tests/common/make_document_bucket.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <tests/storageserver/testvisitormessagesession.h>
#include <vespa/documentapi/messagebus/messages/multioperationmessage.h>
#include <vespa/documentapi/messagebus/messages/putdocumentmessage.h>
@@ -20,7 +20,7 @@
#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/util/exceptions.h>
-using storage::test::makeDocumentBucket;
+using document::test::makeDocumentBucket;
namespace storage {
namespace {
diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
index c5875139e1e..cf6d5183ce1 100644
--- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
+++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
@@ -16,6 +16,8 @@
#include <vespa/log/bufferedlogger.h>
LOG_SETUP(".storage.bucketdb.initializer");
+using document::BucketSpace;
+
namespace storage {
using BucketSet = vespalib::hash_set<document::BucketId, document::BucketId::hash>;
@@ -153,7 +155,7 @@ StorageBucketDBInitializer::onOpen()
// Trigger bucket database initialization
for (uint32_t i=0; i<_system._partitions.size(); ++i) {
if (!_system._partitions[i].isUp()) continue;
- ReadBucketList::SP msg(new ReadBucketList(spi::PartitionId(i)));
+ ReadBucketList::SP msg(new ReadBucketList(BucketSpace::placeHolder(), spi::PartitionId(i)));
_state._lists[msg->getMsgId()] = msg;
sendDown(msg);
}
@@ -335,26 +337,27 @@ StorageBucketDBInitializer::reportHtmlStatus(
// Always called from worker thread. Worker monitor already grabbed
void
-StorageBucketDBInitializer::registerBucket(const document::BucketId& bucket,
+StorageBucketDBInitializer::registerBucket(const document::Bucket &bucket,
spi::PartitionId partition,
api::BucketInfo bucketInfo)
{
+ document::BucketId bucketId(bucket.getBucketId());
StorBucketDatabase::WrappedEntry entry(_system._bucketDatabase.get(
- bucket, "StorageBucketDBInitializer::registerBucket",
+ bucketId, "StorageBucketDBInitializer::registerBucket",
StorBucketDatabase::CREATE_IF_NONEXISTING));
if (bucketInfo.valid()) {
if (entry.preExisted()) {
LOG(debug, "Had value %s for %s before registering",
entry->getBucketInfo().toString().c_str(),
- bucket.toString().c_str());
+ bucketId.toString().c_str());
}
LOG(debug, "Got new value %s from %s partition %u",
- bucketInfo.toString().c_str(), bucket.toString().c_str(),
+ bucketInfo.toString().c_str(), bucketId.toString().c_str(),
partition.getValue());
entry->setBucketInfo(bucketInfo);
} else {
LOG(debug, "Got invalid bucket info from %s partition %u: %s",
- bucket.toString().c_str(), partition.getValue(),
+ bucketId.toString().c_str(), partition.getValue(),
bucketInfo.toString().c_str());
}
if (entry.preExisted()) {
@@ -362,13 +365,13 @@ StorageBucketDBInitializer::registerBucket(const document::BucketId& bucket,
LOG(debug, "%s already existed in bucket database on disk %i. "
"Might have been moved from wrong directory prior to "
"listing this directory.",
- bucket.toString().c_str(), int(partition));
+ bucketId.toString().c_str(), int(partition));
return;
}
uint32_t keepOnDisk, joinFromDisk;
if (_system._distribution.getPreferredAvailableDisk(
_system._nodeState, _system._nodeIndex,
- bucket.stripUnused()) == partition)
+ bucketId.stripUnused()) == partition)
{
keepOnDisk = partition;
joinFromDisk = entry->disk;
@@ -378,7 +381,7 @@ StorageBucketDBInitializer::registerBucket(const document::BucketId& bucket,
}
LOG(debug, "%s exist on both disk %u and disk %i. Joining two versions "
"onto disk %u.",
- bucket.toString().c_str(), entry->disk, int(partition), keepOnDisk);
+ bucketId.toString().c_str(), entry->disk, int(partition), keepOnDisk);
entry.unlock();
// Must not have bucket db lock while sending down
InternalBucketJoinCommand::SP cmd(new InternalBucketJoinCommand(
@@ -388,13 +391,13 @@ StorageBucketDBInitializer::registerBucket(const document::BucketId& bucket,
}
sendDown(cmd);
} else {
- _system._component.getMinUsedBitsTracker().update(bucket);
+ _system._component.getMinUsedBitsTracker().update(bucketId);
LOG(spam, "Inserted %s on disk %i into bucket database",
- bucket.toString().c_str(), int(partition));
+ bucketId.toString().c_str(), int(partition));
entry->disk = partition;
entry.write();
uint16_t disk(_system._distribution.getIdealDisk(
- _system._nodeState, _system._nodeIndex, bucket.stripUnused(),
+ _system._nodeState, _system._nodeIndex, bucketId.stripUnused(),
lib::Distribution::IDEAL_DISK_EVEN_IF_DOWN));
if (disk != partition) {
++_metrics._wrongDisk;
@@ -478,7 +481,8 @@ StorageBucketDBInitializer::sendReadBucketInfo(spi::PartitionId disk)
_state._infoSetByLoad += finder._alreadySet;
}
for (uint32_t i=0; i<finder._next.size(); ++i) {
- ReadBucketInfo::SP cmd(new ReadBucketInfo(finder._next[i]));
+ document::Bucket bucket(BucketSpace::placeHolder(), finder._next[i]);
+ ReadBucketInfo::SP cmd(new ReadBucketInfo(bucket));
cmd->setPriority(_config._infoReadPriority);
state._pending.insert(finder._next[i]);
_state._infoRequests[cmd->getMsgId()] = disk;
@@ -583,7 +587,7 @@ StorageBucketDBInitializer::handleReadBucketListReply(
api::BucketInfo info;
assert(!info.valid());
for (uint32_t i=0, n=list.size(); i<n; ++i) {
- registerBucket(list[i], reply.getPartition(), info);
+ registerBucket(document::Bucket(reply.getBucketSpace(), list[i]), reply.getPartition(), info);
}
if (++_state._dirsListed == _state._dirsToList) {
handleListingCompleted();
diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
index b28b5a65cd4..99f273a384a 100644
--- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
+++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
@@ -179,7 +179,7 @@ public:
bool handleBadLocation(const document::BucketId&,
std::vector<uint32_t>& path);
/** Register a bucket in the bucket database. */
- void registerBucket(const document::BucketId&,
+ void registerBucket(const document::Bucket &bucket,
spi::PartitionId,
api::BucketInfo bucketInfo);
/**
diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
index 005e73767c1..01276db8087 100644
--- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp
+++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
@@ -13,6 +13,8 @@
#include <vespa/log/bufferedlogger.h>
LOG_SETUP(".bucketmover");
+using document::BucketSpace;
+
namespace storage::bucketmover {
BucketMover::BucketMover(const config::ConfigUri & configUri,
@@ -131,8 +133,9 @@ BucketMover::queueNewMoves()
break;
}
_pendingMoves.push_back(nextMove);
+ document::Bucket bucket(BucketSpace::placeHolder(), nextMove.getBucketId());
std::shared_ptr<BucketDiskMoveCommand> cmd(
- new BucketDiskMoveCommand(nextMove.getBucketId(),
+ new BucketDiskMoveCommand(bucket,
nextMove.getSourceDisk(),
nextMove.getTargetDisk()));
cmd->setPriority(nextMove.getPriority());
diff --git a/storage/src/vespa/storage/common/bucketmessages.cpp b/storage/src/vespa/storage/common/bucketmessages.cpp
index c7e013392f7..1317f5e0814 100644
--- a/storage/src/vespa/storage/common/bucketmessages.cpp
+++ b/storage/src/vespa/storage/common/bucketmessages.cpp
@@ -7,8 +7,10 @@ using document::BucketSpace;
namespace storage {
-ReadBucketList::ReadBucketList(spi::PartitionId partition)
- : api::InternalCommand(ID), _partition(partition)
+ReadBucketList::ReadBucketList(BucketSpace bucketSpace, spi::PartitionId partition)
+ : api::InternalCommand(ID),
+ _bucketSpace(bucketSpace),
+ _partition(partition)
{ }
ReadBucketList::~ReadBucketList() { }
@@ -25,6 +27,7 @@ ReadBucketList::print(std::ostream& out, bool verbose, const std::string& indent
ReadBucketListReply::ReadBucketListReply(const ReadBucketList& cmd)
: api::InternalReply(ID, cmd),
+ _bucketSpace(cmd.getBucketSpace()),
_partition(cmd.getPartition())
{ }
@@ -45,9 +48,9 @@ ReadBucketList::makeReply() {
return std::make_unique<ReadBucketListReply>(*this);
}
-ReadBucketInfo::ReadBucketInfo(const document::BucketId& bucketId)
+ReadBucketInfo::ReadBucketInfo(const document::Bucket &bucket)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucketId)
+ _bucket(bucket)
{ }
ReadBucketInfo::~ReadBucketInfo() { }
@@ -91,9 +94,9 @@ std::unique_ptr<api::StorageReply> ReadBucketInfo::makeReply() {
}
-RepairBucketCommand::RepairBucketCommand(const document::BucketId& bucket, uint16_t disk)
+RepairBucketCommand::RepairBucketCommand(const document::Bucket &bucket, uint16_t disk)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucket),
+ _bucket(bucket),
_disk(disk),
_verifyBody(false),
_moveToIdealDisk(false)
@@ -154,10 +157,10 @@ RepairBucketCommand::makeReply() {
return std::make_unique<RepairBucketReply>(*this);
}
-BucketDiskMoveCommand::BucketDiskMoveCommand(const document::BucketId& bucket,
+BucketDiskMoveCommand::BucketDiskMoveCommand(const document::Bucket &bucket,
uint16_t srcDisk, uint16_t dstDisk)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucket),
+ _bucket(bucket),
_srcDisk(srcDisk),
_dstDisk(dstDisk)
{
@@ -209,10 +212,10 @@ BucketDiskMoveCommand::makeReply()
}
-InternalBucketJoinCommand::InternalBucketJoinCommand(const document::BucketId& bucket,
+InternalBucketJoinCommand::InternalBucketJoinCommand(const document::Bucket &bucket,
uint16_t keepOnDisk, uint16_t joinFromDisk)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucket),
+ _bucket(bucket),
_keepOnDisk(keepOnDisk),
_joinFromDisk(joinFromDisk)
{
diff --git a/storage/src/vespa/storage/common/bucketmessages.h b/storage/src/vespa/storage/common/bucketmessages.h
index 9eef9ed6068..36e3a18c6b7 100644
--- a/storage/src/vespa/storage/common/bucketmessages.h
+++ b/storage/src/vespa/storage/common/bucketmessages.h
@@ -17,14 +17,16 @@ namespace storage {
* @brief List buckets existing on a partition.
*/
class ReadBucketList : public api::InternalCommand {
+ document::BucketSpace _bucketSpace;
spi::PartitionId _partition;
public:
typedef std::unique_ptr<ReadBucketList> UP;
static const uint32_t ID = 2003;
- ReadBucketList(spi::PartitionId partition);
+ ReadBucketList(document::BucketSpace bucketSpace, spi::PartitionId partition);
~ReadBucketList();
+ document::BucketSpace getBucketSpace() const { return _bucketSpace; }
spi::PartitionId getPartition() const { return _partition; }
std::unique_ptr<api::StorageReply> makeReply() override;
@@ -38,6 +40,7 @@ public:
* @ingroup common
*/
class ReadBucketListReply : public api::InternalReply {
+ document::BucketSpace _bucketSpace;
spi::PartitionId _partition;
spi::BucketIdListResult::List _buckets;
@@ -49,6 +52,7 @@ public:
ReadBucketListReply(const ReadBucketList& cmd);
~ReadBucketListReply();
+ document::BucketSpace getBucketSpace() const { return _bucketSpace; }
spi::PartitionId getPartition() const { return _partition; }
spi::BucketIdListResult::List& getBuckets() { return _buckets; }
@@ -75,7 +79,7 @@ class ReadBucketInfo : public api::InternalCommand {
public:
static const uint32_t ID = 2005;
- ReadBucketInfo(const document::BucketId& bucketId);
+ ReadBucketInfo(const document::Bucket &bucket);
~ReadBucketInfo();
document::Bucket getBucket() const override { return _bucket; }
@@ -129,7 +133,7 @@ public:
static const uint32_t ID = 2007;
- RepairBucketCommand(const document::BucketId& bucket, uint16_t disk);
+ RepairBucketCommand(const document::Bucket &bucket, uint16_t disk);
~RepairBucketCommand();
bool hasSingleBucketId() const override { return true; }
@@ -196,7 +200,7 @@ public:
typedef std::shared_ptr<BucketDiskMoveCommand> SP;
static const uint32_t ID = 2012;
- BucketDiskMoveCommand(const document::BucketId& bucket, uint16_t srcDisk, uint16_t dstDisk);
+ BucketDiskMoveCommand(const document::Bucket &bucket, uint16_t srcDisk, uint16_t dstDisk);
~BucketDiskMoveCommand();
document::Bucket getBucket() const override { return _bucket; }
@@ -267,7 +271,7 @@ class InternalBucketJoinCommand : public api::InternalCommand {
public:
static const uint32_t ID = 2015;
- InternalBucketJoinCommand(const document::BucketId& bucket, uint16_t keepOnDisk, uint16_t joinFromDisk);
+ InternalBucketJoinCommand(const document::Bucket &bucket, uint16_t keepOnDisk, uint16_t joinFromDisk);
~InternalBucketJoinCommand();
document::Bucket getBucket() const override { return _bucket; }
diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
index d0002841bbd..093576622db 100644
--- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
@@ -8,6 +8,8 @@
#include <vespa/log/log.h>
LOG_SETUP(".persistence.filestor.modifiedbucketchecker");
+using document::BucketSpace;
+
namespace storage {
ModifiedBucketChecker::ModifiedBucketChecker(
@@ -146,8 +148,8 @@ ModifiedBucketChecker::nextRecheckChunk(
size_t n = std::min(_maxPendingChunkSize, _rechecksNotStarted.size());
for (size_t i = 0; i < n; ++i) {
- document::BucketId bid(_rechecksNotStarted.back());
- commandsToSend.emplace_back(new RecheckBucketInfoCommand(bid));
+ document::Bucket bucket(BucketSpace::placeHolder(), _rechecksNotStarted.back());
+ commandsToSend.emplace_back(new RecheckBucketInfoCommand(bucket));
_rechecksNotStarted.pop_back();
}
_pendingRequests = n;
diff --git a/storage/src/vespa/storage/persistence/messages.cpp b/storage/src/vespa/storage/persistence/messages.cpp
index 5a7f679a0bf..78f4b02a192 100644
--- a/storage/src/vespa/storage/persistence/messages.cpp
+++ b/storage/src/vespa/storage/persistence/messages.cpp
@@ -7,12 +7,12 @@ using document::BucketSpace;
namespace storage {
GetIterCommand::GetIterCommand(framework::MemoryToken::UP token,
- const document::BucketId& bucketId,
+ const document::Bucket &bucket,
const spi::IteratorId iteratorId,
uint32_t maxByteSize)
: api::InternalCommand(ID),
_token(std::move(token)),
- _bucket(BucketSpace::placeHolder(), bucketId),
+ _bucket(bucket),
_iteratorId(iteratorId),
_maxByteSize(maxByteSize)
{
@@ -55,12 +55,12 @@ GetIterReply::print(std::ostream& out, bool verbose, const std::string& indent)
}
}
-CreateIteratorCommand::CreateIteratorCommand(const document::BucketId& bucketId,
+CreateIteratorCommand::CreateIteratorCommand(const document::Bucket &bucket,
const spi::Selection& selection,
const std::string& fields,
spi::IncludedVersions includedVersions)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucketId),
+ _bucket(bucket),
_selection(selection),
_fieldSet(fields),
_includedVersions(includedVersions),
@@ -122,9 +122,9 @@ DestroyIteratorCommand::makeReply() {
return std::make_unique<DestroyIteratorReply>(*this);
}
-RecheckBucketInfoCommand::RecheckBucketInfoCommand(const document::BucketId& bucketId)
+RecheckBucketInfoCommand::RecheckBucketInfoCommand(const document::Bucket& bucket)
: api::InternalCommand(ID),
- _bucket(BucketSpace::placeHolder(), bucketId)
+ _bucket(bucket)
{ }
RecheckBucketInfoCommand::~RecheckBucketInfoCommand() { }
diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h
index 7f38839d80c..d47a389a8c1 100644
--- a/storage/src/vespa/storage/persistence/messages.h
+++ b/storage/src/vespa/storage/persistence/messages.h
@@ -25,7 +25,7 @@ public:
typedef std::shared_ptr<GetIterCommand> SP;
GetIterCommand(framework::MemoryToken::UP token,
- const document::BucketId& bucketId,
+ const document::Bucket &bucket,
const spi::IteratorId iteratorId,
uint32_t maxByteSize);
~GetIterCommand();
@@ -93,7 +93,7 @@ public:
typedef std::unique_ptr<CreateIteratorCommand> UP;
typedef std::shared_ptr<CreateIteratorCommand> SP;
- CreateIteratorCommand(const document::BucketId& bucketId,
+ CreateIteratorCommand(const document::Bucket &bucket,
const spi::Selection& selection,
const std::string& fields,
spi::IncludedVersions includedVersions);
@@ -176,7 +176,7 @@ public:
typedef std::shared_ptr<RecheckBucketInfoCommand> SP;
typedef std::unique_ptr<RecheckBucketInfoCommand> UP;
- RecheckBucketInfoCommand(const document::BucketId& bucketId);
+ RecheckBucketInfoCommand(const document::Bucket &bucket);
~RecheckBucketInfoCommand();
document::Bucket getBucket() const override { return _bucket; }
diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp
index 7a8aec6afa2..75db3d3114d 100644
--- a/storage/src/vespa/storage/persistence/persistencethread.cpp
+++ b/storage/src/vespa/storage/persistence/persistencethread.cpp
@@ -447,7 +447,7 @@ PersistenceThread::handleReadBucketList(ReadBucketList& cmd)
_env._metrics.readBucketList,
_env._component.getClock()));
- spi::BucketIdListResult result(_spi.listBuckets(document::BucketSpace::placeHolder(), cmd.getPartition()));
+ spi::BucketIdListResult result(_spi.listBuckets(cmd.getBucketSpace(), cmd.getPartition()));
if (checkForError(result, *tracker)) {
ReadBucketListReply::SP reply(new ReadBucketListReply(cmd));
result.getList().swap(reply->getBuckets());
diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp
index 1bf15fefb90..337eaef69a5 100644
--- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp
+++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp
@@ -14,6 +14,7 @@
LOG_SETUP(".bucketintegritychecker");
using std::shared_ptr;
+using document::BucketSpace;
namespace storage {
@@ -595,9 +596,9 @@ BucketIntegrityChecker::run(framework::ThreadHandle& thread)
}
break;
}
-
+ document::Bucket bucket(BucketSpace::placeHolder(), bid);
std::shared_ptr<RepairBucketCommand> cmd(
- new RepairBucketCommand(bid, _status[i].disk));
+ new RepairBucketCommand(bucket, _status[i].disk));
cmd->verifyBody(_currentRunWithFullVerification);
cmd->moveToIdealDisk(true);
cmd->setPriority(230);
diff --git a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp
index 0602cb6de38..acfa07affc7 100644
--- a/storage/src/vespa/storage/storageserver/documentapiconverter.cpp
+++ b/storage/src/vespa/storage/storageserver/documentapiconverter.cpp
@@ -112,13 +112,13 @@ DocumentApiConverter::toStorageAPI(documentapi::DocumentMessage& fromMsg,
case DocumentProtocol::MESSAGE_STATBUCKET:
{
documentapi::StatBucketMessage& from(static_cast<documentapi::StatBucketMessage&>(fromMsg));
- toMsg = std::make_unique<api::StatBucketCommand>(document::Bucket(BucketSpace::placeHolder(), from.getBucketId()), from.getDocumentSelection());
+ toMsg = std::make_unique<api::StatBucketCommand>(from.getBucket(), from.getDocumentSelection());
break;
}
case DocumentProtocol::MESSAGE_GETBUCKETLIST:
{
documentapi::GetBucketListMessage& from(static_cast<documentapi::GetBucketListMessage&>(fromMsg));
- toMsg = std::make_unique<api::GetBucketListCommand>(document::Bucket(BucketSpace::placeHolder(), from.getBucketId()));
+ toMsg = std::make_unique<api::GetBucketListCommand>(from.getBucket());
break;
}
case DocumentProtocol::MESSAGE_VISITORINFO:
@@ -244,13 +244,6 @@ DocumentApiConverter::toDocumentAPI(api::StorageCommand& fromMsg, const document
toMsg = std::move(to);
break;
}
- case api::MessageType::DOCBLOCK_ID:
- {
- api::DocBlockCommand& from(static_cast<api::DocBlockCommand&>(fromMsg));
- toMsg = std::make_unique<documentapi::MultiOperationMessage>(from.getBucketId(), from.getDocumentBlock(),
- from.keepTimeStamps());
- break;
- }
case api::MessageType::SEARCHRESULT_ID:
{
api::SearchResultCommand& from(static_cast<api::SearchResultCommand&>(fromMsg));
@@ -284,21 +277,6 @@ DocumentApiConverter::toDocumentAPI(api::StorageCommand& fromMsg, const document
toMsg = std::move(to);
break;
}
- case api::MessageType::DOCUMENTLIST_ID:
- {
- api::DocumentListCommand& from(static_cast<api::DocumentListCommand&>(fromMsg));
- documentapi::DocumentListMessage::UP to(new documentapi::DocumentListMessage(from.getBucketId()));
-
- for (uint32_t i = 0; i < from.getDocuments().size(); i++) {
- to->getDocuments().push_back(
- documentapi::DocumentListMessage::Entry(
- from.getDocuments()[i]._lastModified,
- from.getDocuments()[i]._doc,
- from.getDocuments()[i]._removeEntry));
- }
- toMsg = std::move(to);
- break;
- }
case api::MessageType::EMPTYBUCKETS_ID:
{
api::EmptyBucketsCommand& from(static_cast<api::EmptyBucketsCommand&>(fromMsg));
@@ -336,7 +314,7 @@ DocumentApiConverter::toDocumentAPI(api::StorageCommand& fromMsg, const document
case api::MessageType::STATBUCKET_ID:
{
api::StatBucketCommand& from(static_cast<api::StatBucketCommand&>(fromMsg));
- toMsg = std::make_unique<documentapi::StatBucketMessage>(from.getBucketId(), from.getDocumentSelection());
+ toMsg = std::make_unique<documentapi::StatBucketMessage>(from.getBucket(), from.getDocumentSelection());
break;
}
default:
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index e6dfb70960e..b91e38e035e 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -17,6 +17,8 @@
#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance");
+using document::BucketSpace;
+
namespace storage {
Visitor::HitCounter::HitCounter(const document::OrderingSpecification* ordering)
@@ -211,7 +213,7 @@ Visitor::BucketIterationState::~BucketIterationState()
LOG(debug, "Visitor '%s' sending DestroyIteratorCommand for %s, "
"iterator id %zu.",
_visitor._id.c_str(),
- _bucketId.toString().c_str(),
+ _bucket.getBucketId().toString().c_str(),
uint64_t(_iteratorId));
_messageHandler.send(cmd, _visitor);
}
@@ -242,6 +244,7 @@ Visitor::Visitor(StorageComponent& component)
_visitorTarget(),
_state(STATE_NOT_STARTED),
_buckets(),
+ _bucketSpace(BucketSpace::placeHolder()),
_currentBucket(),
_bucketStates(),
_calledStartingVisitor(false),
@@ -768,7 +771,8 @@ Visitor::onCreateIteratorReply(
{
std::list<BucketIterationState*>::reverse_iterator it = _bucketStates.rbegin();
- document::BucketId bucketId(reply->getBucketId());
+ document::Bucket bucket(reply->getBucket());
+ document::BucketId bucketId(bucket.getBucketId());
for (; it != _bucketStates.rend(); ++it) {
if ((*it)->getBucketId() == bucketId) {
break;
@@ -807,7 +811,7 @@ Visitor::onCreateIteratorReply(
return;
}
std::shared_ptr<GetIterCommand> cmd(
- new GetIterCommand(std::move(token), bucketId,
+ new GetIterCommand(std::move(token), bucket,
bucketState.getIteratorId(),
_docBlockSize));
cmd->setLoadType(_initiatingCmd->getLoadType());
@@ -1229,7 +1233,7 @@ Visitor::getIterators()
}
std::shared_ptr<GetIterCommand> cmd(
new GetIterCommand(std::move(token),
- bucketState.getBucketId(),
+ bucketState.getBucket(),
bucketState.getIteratorId(),
_docBlockSize));
cmd->setLoadType(_initiatingCmd->getLoadType());
@@ -1257,11 +1261,11 @@ Visitor::getIterators()
_bucketStates.size() < _visitorOptions._maxPending &&
_currentBucket < _buckets.size())
{
- document::BucketId bucketId(_buckets[_currentBucket]);
+ document::Bucket bucket(_bucketSpace, _buckets[_currentBucket]);
std::unique_ptr<BucketIterationState> newBucketState(
- new BucketIterationState(*this, *_messageHandler, bucketId));
+ new BucketIterationState(*this, *_messageHandler, bucket));
LOG(debug, "Visitor '%s': Sending create iterator for bucket %s.",
- _id.c_str(), bucketId.toString().c_str());
+ _id.c_str(), bucket.getBucketId().toString().c_str());
spi::Selection selection
= spi::Selection(spi::DocumentSelection(_documentSelectionString));
@@ -1271,7 +1275,7 @@ Visitor::getIterators()
spi::Timestamp(_visitorOptions._toTime.getTime()));
std::shared_ptr<CreateIteratorCommand> cmd(
- new CreateIteratorCommand(bucketId,
+ new CreateIteratorCommand(bucket,
selection,
_visitorOptions._fieldSet,
_visitorOptions._visitRemoves ?
diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h
index d7d693e41fe..1c156ff187a 100644
--- a/storage/src/vespa/storage/visiting/visitor.h
+++ b/storage/src/vespa/storage/visiting/visitor.h
@@ -131,17 +131,17 @@ private:
Visitor& _visitor;
VisitorMessageHandler& _messageHandler;
public:
- document::BucketId _bucketId;
+ document::Bucket _bucket;
spi::IteratorId _iteratorId;
uint32_t _pendingIterators;
bool _completed;
BucketIterationState(Visitor& visitor,
VisitorMessageHandler& messageHandler,
- const document::BucketId& id)
+ const document::Bucket &bucket)
: _visitor(visitor),
_messageHandler(messageHandler),
- _bucketId(id),
+ _bucket(bucket),
_iteratorId(0),
_pendingIterators(0),
_completed(false)
@@ -153,7 +153,8 @@ private:
void setCompleted(bool completed = true) { _completed = completed; }
bool isCompleted() const { return _completed; }
- const document::BucketId& getBucketId() const { return _bucketId; }
+ document::Bucket getBucket() const { return _bucket; }
+ document::BucketId getBucketId() const { return _bucket.getBucketId(); }
void setIteratorId(spi::IteratorId iteratorId) {
_iteratorId = iteratorId;
@@ -172,7 +173,7 @@ private:
void print(std::ostream& out, bool, const std::string& ) const override {
out << "BucketIterationState("
- << _bucketId
+ << _bucket.getBucketId()
<< ", pending GetIters: " << _pendingIterators
<< ", iterator id: " << _iteratorId
<< ", completed: " << (_completed ? "yes" : "no")
@@ -279,6 +280,7 @@ private:
// The list of buckets to visit.
std::vector<document::BucketId> _buckets;
+ document::BucketSpace _bucketSpace;
// The iterator iterating the buckets to visit.
uint32_t _currentBucket;
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
index f03c59f0887..bfd657c2f05 100644
--- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
+++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
@@ -15,6 +15,7 @@
#include <vespa/document/document.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/update/fieldpathupdates.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/util/growablebytebuffer.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -28,21 +29,13 @@ using document::Document;
using document::DocumentId;
using document::DocumentType;
using document::DocumentTypeRepo;
+using document::test::makeDocumentBucket;
using storage::lib::ClusterState;
using vespalib::string;
namespace storage {
namespace api {
-namespace {
-
-document::Bucket makeDocumentBucket(document::BucketId bucketId)
-{
- return document::Bucket(BucketSpace::placeHolder(), bucketId);
-}
-
-}
-
struct StorageProtocolTest : public CppUnit::TestFixture {
document::TestDocMan _docMan;
document::Document::SP _testDoc;
diff --git a/storageapi/src/vespa/storageapi/message/datagram.cpp b/storageapi/src/vespa/storageapi/message/datagram.cpp
index c2fc347c597..66b753185a4 100644
--- a/storageapi/src/vespa/storageapi/message/datagram.cpp
+++ b/storageapi/src/vespa/storageapi/message/datagram.cpp
@@ -7,58 +7,11 @@ using document::BucketSpace;
namespace storage {
namespace api {
-IMPLEMENT_COMMAND(DocBlockCommand, DocBlockReply)
-IMPLEMENT_REPLY(DocBlockReply)
IMPLEMENT_COMMAND(MapVisitorCommand, MapVisitorReply)
IMPLEMENT_REPLY(MapVisitorReply)
-IMPLEMENT_COMMAND(DocumentListCommand, DocumentListReply)
-IMPLEMENT_REPLY(DocumentListReply)
IMPLEMENT_COMMAND(EmptyBucketsCommand, EmptyBucketsReply)
IMPLEMENT_REPLY(EmptyBucketsReply)
-DocBlockCommand::DocBlockCommand(const document::BucketId& bucketId,
- const vdslib::DocumentList& block,
- const std::shared_ptr<void>& buffer)
- : StorageCommand(MessageType::DOCBLOCK),
- _bucket(BucketSpace::placeHolder(), bucketId),
- _docBlock(block),
- _buffer(buffer),
- _keepTimeStamps(false)
-{
-}
-
-DocBlockCommand::~DocBlockCommand() {}
-
-void
-DocBlockCommand::print(std::ostream& out, bool verbose,
- const std::string& indent) const
-{
- out << "DocBlockCommand("
- << "size " << _docBlock.getBufferSize() << ", used space "
- << (_docBlock.getBufferSize() - _docBlock.countFree()) << ", doccount "
- << _docBlock.size() << ")";
- if (verbose) {
- out << " : ";
- StorageCommand::print(out, verbose, indent);
- }
-}
-
-DocBlockReply::DocBlockReply(const DocBlockCommand& cmd)
- : StorageReply(cmd)
-{
-}
-
-void
-DocBlockReply::print(std::ostream& out, bool verbose,
- const std::string& indent) const
-{
- out << "DocBlockReply()";
- if (verbose) {
- out << " : ";
- StorageReply::print(out, verbose, indent);
- }
-}
-
MapVisitorCommand::MapVisitorCommand()
: StorageCommand(MessageType::MAPVISITOR)
{
@@ -99,52 +52,6 @@ MapVisitorReply::print(std::ostream& out, bool verbose,
}
}
-DocumentListCommand::DocumentListCommand(const document::BucketId& bid)
- : StorageCommand(MessageType::DOCUMENTLIST),
- _bucket(BucketSpace::placeHolder(), bid),
- _documents()
-{
-}
-
-void
-DocumentListCommand::print(std::ostream& out, bool verbose,
- const std::string& indent) const
-{
- out << "DocumentList(" << _bucket.getBucketId();
- if (_documents.empty()) {
- out << ", empty";
- } else if (verbose) {
- out << ",";
- for (uint32_t i=0; i<_documents.size(); ++i) {
- out << "\n" << indent << " ";
- out << ":" << _documents[i];
- }
- } else {
- out << ", " << _documents.size() << " documents";
- }
- out << ")";
- if (verbose) {
- out << " : ";
- StorageCommand::print(out, verbose, indent);
- }
-}
-
-DocumentListReply::DocumentListReply(const DocumentListCommand& cmd)
- : StorageReply(cmd)
-{
-}
-
-void
-DocumentListReply::print(std::ostream& out, bool verbose,
- const std::string& indent) const
-{
- out << "DocumentListReply()";
- if (verbose) {
- out << " : ";
- StorageReply::print(out, verbose, indent);
- }
-}
-
EmptyBucketsCommand::EmptyBucketsCommand(
const std::vector<document::BucketId>& buckets)
: StorageCommand(MessageType::EMPTYBUCKETS),
@@ -188,13 +95,5 @@ EmptyBucketsReply::print(std::ostream& out, bool verbose,
}
}
-std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e)
-{
- out << e._doc->getId();
- if (e._removeEntry) out << " - removed";
- out << ", last modified at " << e._lastModified;
- return out;
-}
-
} // api
} // storage
diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h
index 272ba72364e..64649b43068 100644
--- a/storageapi/src/vespa/storageapi/message/datagram.h
+++ b/storageapi/src/vespa/storageapi/message/datagram.h
@@ -10,53 +10,6 @@
namespace storage::api {
/**
- * @class DocBlockCommand
- * @ingroup message
- *
- * @brief Sends a docblock to a visitor or subscriber.
- */
-class DocBlockCommand : public StorageCommand {
- document::Bucket _bucket;
- vdslib::DocumentList _docBlock;
- std::shared_ptr<void> _buffer; // Owns data in docblock
- bool _keepTimeStamps; // Used for recovery/synchronization where we want to
- // keep the timestamps of the origin.
-
-public:
- DocBlockCommand(const document::BucketId& bucketId,
- const vdslib::DocumentList& block,
- const std::shared_ptr<void>& buffer);
- ~DocBlockCommand();
-
- vdslib::DocumentList& getDocumentBlock()
- { assert(_docBlock.getBufferSize() > 0); return _docBlock; }
- const vdslib::DocumentList& getDocumentBlock() const
- { assert(_docBlock.getBufferSize() > 0); return _docBlock; }
- void setDocumentBlock(vdslib::DocumentList& block) { _docBlock = block; }
-
- document::Bucket getBucket() const override { return _bucket; }
- 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; }
-
- DECLARE_STORAGECOMMAND(DocBlockCommand, onDocBlock)
-};
-
-/**
- * @class DocBlockReply
- * @ingroup message
- *
- * @brief Confirm that a given docblock have been received.
- */
-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)
-};
-
-/**
* @class MapStorageCommand
* @ingroup message
*
@@ -90,58 +43,6 @@ public:
};
/**
- * @class DocumentListCommand
- * @ingroup message
- *
- * @brief Sends a list of documents to the visitor data handler.
- *
- * This is used in synchronization in order to transfer minimal amount of data
- * to the synchronization agent.
- */
-class DocumentListCommand : public StorageCommand {
-public:
- struct Entry {
- document::Document::SP _doc;
- int64_t _lastModified;
- bool _removeEntry;
-
- Entry() : _doc(), _lastModified(0), _removeEntry(false) {}
- Entry(const document::Document::SP& doc, int64_t lastModified,
- bool removeEntry)
- : _doc(doc),
- _lastModified(lastModified),
- _removeEntry(removeEntry)
- { }
- };
-
-private:
- document::Bucket _bucket;
- std::vector<Entry> _documents;
-public:
- DocumentListCommand(const document::BucketId& bid);
- document::Bucket getBucket() const override { return _bucket; }
- 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);
-
-/**
- * @class DocumentListReply
- * @ingroup message
- *
- * @brief Confirm that a given visitorstatisticscommand has been received.
- */
-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)
-};
-
-/**
* @class EmptyBucketsCommand
* @ingroup message
*
diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
index 8f571ff0f40..de8af718bcf 100644
--- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
+++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
@@ -32,7 +32,6 @@ class BatchDocumentUpdateCommand;
class CreateVisitorCommand; // Create a new visitor
class DestroyVisitorCommand; // Destroy a running visitor
class VisitorInfoCommand; // Sends visitor info to visitor controller
-class DocBlockCommand; // A block of documents visited
class MapVisitorCommand;
class SearchResultCommand;
class DocumentSummaryCommand;
@@ -73,7 +72,6 @@ class BatchDocumentUpdateReply;
class CreateVisitorReply;
class DestroyVisitorReply;
class VisitorInfoReply;
-class DocBlockReply;
class MapVisitorReply;
class SearchResultReply;
class DocumentSummaryReply;
@@ -105,9 +103,6 @@ class StatBucketReply;
class GetBucketListCommand;
class GetBucketListReply;
-class DocumentListCommand;
-class DocumentListReply;
-
class EmptyBucketsCommand;
class EmptyBucketsReply;
@@ -188,12 +183,6 @@ public:
virtual bool onVisitorInfoReply(
const std::shared_ptr<api::VisitorInfoReply>&)
{ return false; }
- virtual bool onDocBlock(
- const std::shared_ptr<api::DocBlockCommand>&)
- { return false; }
- virtual bool onDocBlockReply(
- const std::shared_ptr<api::DocBlockReply>&)
- { return false; }
virtual bool onMapVisitor(
const std::shared_ptr<api::MapVisitorCommand>&)
{ return false; }
@@ -218,12 +207,6 @@ public:
virtual bool onDocumentSummaryReply(
const std::shared_ptr<api::DocumentSummaryReply>&)
{ return false; }
- virtual bool onDocumentList(
- const std::shared_ptr<api::DocumentListCommand>&)
- { return false; }
- virtual bool onDocumentListReply(
- const std::shared_ptr<api::DocumentListReply>&)
- { return false; }
virtual bool onEmptyBuckets(
const std::shared_ptr<api::EmptyBucketsCommand>&)
{ return false; }
diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp
index 66f2c546a42..36d72bdc2b4 100644
--- a/storageserver/src/tests/storageservertest.cpp
+++ b/storageserver/src/tests/storageservertest.cpp
@@ -4,6 +4,7 @@
#include <vespa/storage/storageserver/distributornode.h>
#include <vespa/document/base/testdocman.h>
+#include <vespa/document/test/make_document_bucket.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/messagebus/rpcmessagebus.h>
#include <vespa/messagebus/network/rpcnetworkparams.h>
@@ -27,6 +28,8 @@
#include <vespa/log/log.h>
LOG_SETUP(".storageservertest");
+using document::test::makeDocumentBucket;
+
namespace storage {
namespace {
@@ -651,10 +654,6 @@ namespace {
return true;
}
- static document::Bucket makeDocumentBucket(document::BucketId bucketId) {
- return document::Bucket(document::BucketSpace::placeHolder(), bucketId);
- }
-
void run() override {
uint32_t seed = 0;
uint32_t maxDocSize = 65536;