summaryrefslogtreecommitdiffstats
path: root/storage/src/tests
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2017-10-17 01:19:04 +0200
committerTor Egge <Tor.Egge@oath.com>2017-10-17 12:02:29 +0000
commita110f409b9d56fc7542b110cd50956e3fefdb806 (patch)
tree567d9ad6afdb65c5ffe40dccb55cc1cedab06226 /storage/src/tests
parentdde45a05b010b6de1c62643cd9ecd37c091fdba9 (diff)
Take document::Bucket instead of document::BucketId as constructor
argument to storage commands that inherit from BucketCommand.
Diffstat (limited to 'storage/src/tests')
-rw-r--r--storage/src/tests/bucketdb/bucketmanagertest.cpp46
-rw-r--r--storage/src/tests/common/CMakeLists.txt1
-rw-r--r--storage/src/tests/common/make_document_bucket.cpp16
-rw-r--r--storage/src/tests/common/make_document_bucket.h13
-rw-r--r--storage/src/tests/common/storagelinktest.cpp5
-rw-r--r--storage/src/tests/distributor/bucketdbupdatertest.cpp18
-rw-r--r--storage/src/tests/distributor/distributortest.cpp17
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp15
-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.cpp17
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp6
-rw-r--r--storage/src/tests/distributor/removelocationtest.cpp5
-rw-r--r--storage/src/tests/distributor/removeoperationtest.cpp5
-rw-r--r--storage/src/tests/distributor/splitbuckettest.cpp4
-rw-r--r--storage/src/tests/distributor/statoperationtest.cpp7
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp5
-rw-r--r--storage/src/tests/distributor/updateoperationtest.cpp4
-rw-r--r--storage/src/tests/persistence/common/filestortestfixture.cpp8
-rw-r--r--storage/src/tests/persistence/filestorage/deletebuckettest.cpp5
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp130
-rw-r--r--storage/src/tests/persistence/filestorage/mergeblockingtest.cpp9
-rw-r--r--storage/src/tests/persistence/filestorage/operationabortingtest.cpp7
-rw-r--r--storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp6
-rw-r--r--storage/src/tests/persistence/filestorage/singlebucketjointest.cpp5
-rw-r--r--storage/src/tests/persistence/legacyoperationhandlertest.cpp12
-rw-r--r--storage/src/tests/persistence/mergehandlertest.cpp41
-rw-r--r--storage/src/tests/persistence/persistencequeuetest.cpp5
-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.cpp17
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp22
-rw-r--r--storage/src/tests/storageserver/bouncertest.cpp10
-rw-r--r--storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp17
-rw-r--r--storage/src/tests/storageserver/communicationmanagertest.cpp7
-rw-r--r--storage/src/tests/storageserver/documentapiconvertertest.cpp4
-rw-r--r--storage/src/tests/storageserver/mergethrottlertest.cpp70
-rw-r--r--storage/src/tests/visiting/visitormanagertest.cpp9
39 files changed, 354 insertions, 234 deletions
diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp
index b69415af756..9b3ef4bf2e8 100644
--- a/storage/src/tests/bucketdb/bucketmanagertest.cpp
+++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp
@@ -14,6 +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/vdslib/state/random.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/testkit/testapp.h>
@@ -29,6 +30,7 @@ using document::DocumenttypesConfig;
using config::FileSpec;
using document::DocumentType;
using document::DocumentTypeRepo;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -306,7 +308,7 @@ BucketManagerTest::wasBlockedDueToLastModified(api::StorageMessage* msg,
void BucketManagerTest::testRemoveLastModifiedOK()
{
CPPUNIT_ASSERT(!wasBlockedDueToLastModified(
- new api::RemoveCommand(document::BucketId(16, 1),
+ new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 1)),
document::DocumentId("userdoc:m:1:foo"),
api::Timestamp(1235)),
1235));
@@ -316,7 +318,7 @@ void BucketManagerTest::testRemoveLastModifiedOK()
void BucketManagerTest::testRemoveLastModifiedFailed()
{
CPPUNIT_ASSERT(wasBlockedDueToLastModified(
- new api::RemoveCommand(document::BucketId(16, 1),
+ new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 1)),
document::DocumentId("userdoc:m:1:foo"),
api::Timestamp(1233)),
1233));
@@ -344,7 +346,7 @@ void BucketManagerTest::testDistributionBitChangeOnCreateBucket()
CPPUNIT_ASSERT_EQUAL(16u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits());
std::shared_ptr<api::CreateBucketCommand> cmd(
- new api::CreateBucketCommand(document::BucketId(4, 5678)));
+ new api::CreateBucketCommand(makeDocumentBucket(document::BucketId(4, 5678))));
_top->sendDown(cmd);
CPPUNIT_ASSERT_EQUAL(4u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits());
}
@@ -367,7 +369,7 @@ void BucketManagerTest::testMinUsedBitsFromComponentIsHonored()
// 12 >= 10, so no update of reported state (left at 13; this should of
// course not happen in practice, but used for faking in the test)
std::shared_ptr<api::CreateBucketCommand> cmd(
- new api::CreateBucketCommand(document::BucketId(12, 5678)));
+ new api::CreateBucketCommand(makeDocumentBucket(document::BucketId(12, 5678))));
_top->sendDown(cmd);
CPPUNIT_ASSERT_EQUAL(13u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits());
}
@@ -593,7 +595,7 @@ BucketManagerTest::testSwallowNotifyBucketChangeReply()
_node->getDoneInitializeHandler().notifyDoneInitializing();
_top->doneInit();
- api::NotifyBucketChangeCommand cmd(document::BucketId(1, 16),
+ api::NotifyBucketChangeCommand cmd(makeDocumentBucket(document::BucketId(1, 16)),
api::BucketInfo());
std::shared_ptr<api::NotifyBucketChangeReply> reply(
new api::NotifyBucketChangeReply(cmd));
@@ -705,7 +707,7 @@ public:
// Note: this is a dummy message; its contained document ID will not
// map to the provided bucket ID (at least it's extremely unlikely..)
return std::make_shared<api::RemoveCommand>(
- bucket,
+ makeDocumentBucket(bucket),
document::DocumentId("id:foo:testdoctype1::bar"),
timestamp);
}
@@ -714,7 +716,7 @@ public:
auto doc = _self._node->getTestDocMan().createDocument(
"a foo walks into a bar", "id:foo:testdoctype1::bar1");
return std::make_shared<api::PutCommand>(
- bucket, std::move(doc), api::Timestamp(123456));
+ makeDocumentBucket(bucket), std::move(doc), api::Timestamp(123456));
}
auto createUpdateCommand(const document::BucketId& bucket) const {
@@ -723,7 +725,7 @@ public:
.getDocumentType("testdoctype1"),
document::DocumentId("id:foo:testdoctype1::bar2"));
return std::make_shared<api::UpdateCommand>(
- bucket, update, api::Timestamp(123456));
+ makeDocumentBucket(bucket), update, api::Timestamp(123456));
}
auto createFullFetchCommand() const {
@@ -817,7 +819,7 @@ BucketManagerTest::testSplitReplyOrderedAfterBucketReply()
// Split bucket A to model a concurrent modification to an already fetched
// bucket.
- auto splitCmd = std::make_shared<api::SplitBucketCommand>(bucketA);
+ auto splitCmd = std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(splitCmd);
fixture.bounceWithReply(*splitCmd);
// Let bucket manager breathe again.
@@ -839,7 +841,7 @@ BucketManagerTest::testJoinReplyOrderedAfterBucketReply()
.add(bucketB, api::BucketInfo(100, 200, 400)));
auto guard = fixture.acquireBucketLockAndSendInfoRequest(bucketB);
- auto joinCmd = std::make_shared<api::JoinBucketsCommand>(parent);
+ auto joinCmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(parent));
joinCmd->getSourceBuckets().assign({bucketA, bucketB});
_top->sendDown(joinCmd);
fixture.bounceWithReply(*joinCmd);
@@ -863,7 +865,7 @@ BucketManagerTest::testDeleteReplyOrderedAfterBucketReply()
.add(bucketB, api::BucketInfo(100, 200, 400)));
auto guard = fixture.acquireBucketLockAndSendInfoRequest(bucketB);
- auto deleteCmd = std::make_shared<api::DeleteBucketCommand>(bucketA);
+ auto deleteCmd = std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(deleteCmd);
fixture.bounceWithReply(*deleteCmd);
@@ -882,7 +884,7 @@ BucketManagerTest::testOnlyEnqueueWhenProcessingRequest()
.add(bucketA, api::BucketInfo(50, 100, 200)));
// Process delete command _before_ processing bucket requests.
- auto deleteCmd = std::make_shared<api::DeleteBucketCommand>(bucketA);
+ auto deleteCmd = std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(deleteCmd);
fixture.bounceWithReply(*deleteCmd);
// Should arrive happily on the top.
@@ -914,7 +916,7 @@ BucketManagerTest::testOrderRepliesAfterBucketSpecificRequest()
waitUntilRequestsAreProcessing();
// Barrier: roundtrip thread now blocked. Send a split whose reply shall
// be enqueued since there's a RequestBucketInfo currently doing its thing.
- auto splitCmd = std::make_shared<api::SplitBucketCommand>(bucketA);
+ auto splitCmd = std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(splitCmd);
// Enqueuing happens synchronously in this thread, so no need for further
// synchronization.
@@ -955,7 +957,7 @@ BucketManagerTest::testQueuedRepliesOnlyDispatchedWhenAllProcessingDone()
_top->waitForMessages(3, MESSAGE_WAIT_TIME);
});
waitUntilRequestsAreProcessing(2);
- auto splitCmd = std::make_shared<api::SplitBucketCommand>(bucketA);
+ auto splitCmd = std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(splitCmd);
fixture.bounceWithReply(*splitCmd);
@@ -1049,7 +1051,7 @@ BucketManagerTest::testMutationRepliesForSplitBucketAreEnqueued()
document::BucketId bucket(17, 0);
doTestConflictingReplyIsEnqueued(
bucket,
- std::make_shared<api::SplitBucketCommand>(bucket),
+ std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)),
api::MessageType::SPLITBUCKET_REPLY);
}
@@ -1059,7 +1061,7 @@ BucketManagerTest::testMutationRepliesForDeletedBucketAreEnqueued()
document::BucketId bucket(17, 0);
doTestConflictingReplyIsEnqueued(
bucket,
- std::make_shared<api::DeleteBucketCommand>(bucket),
+ std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket)),
api::MessageType::DELETEBUCKET_REPLY);
}
@@ -1072,7 +1074,7 @@ BucketManagerTest::testMutationRepliesForJoinedBucketAreEnqueued()
document::BucketId parent(16, 0);
// We only test for the parent bucket, since that's what queued operations
// will be remapped to after a successful join.
- auto joinCmd = std::make_shared<api::JoinBucketsCommand>(parent);
+ auto joinCmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(parent));
joinCmd->getSourceBuckets().assign({bucketA, bucketB});
auto params = TestParams()
@@ -1095,7 +1097,7 @@ BucketManagerTest::testConflictingPutRepliesAreEnqueued()
auto params = TestParams()
.bucket(bucket)
.documentMutation(fixture.createPutCommand(bucket))
- .treeMutation(std::make_shared<api::SplitBucketCommand>(bucket))
+ .treeMutation(std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)))
.expectedOrdering({&api::MessageType::REQUESTBUCKETINFO_REPLY,
&api::MessageType::SPLITBUCKET_REPLY,
&api::MessageType::PUT_REPLY});
@@ -1112,7 +1114,7 @@ BucketManagerTest::testConflictingUpdateRepliesAreEnqueued()
auto params = TestParams()
.bucket(bucket)
.documentMutation(fixture.createUpdateCommand(bucket))
- .treeMutation(std::make_shared<api::SplitBucketCommand>(bucket))
+ .treeMutation(std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)))
.expectedOrdering({&api::MessageType::REQUESTBUCKETINFO_REPLY,
&api::MessageType::SPLITBUCKET_REPLY,
&api::MessageType::UPDATE_REPLY});
@@ -1137,7 +1139,7 @@ BucketManagerTest::testRemappedMutationIsCheckedAgainstOriginalBucket()
.bucket(bucket)
.documentMutation(fixture.createRemoveCommand(bucket))
.remappedTo(remappedToBucket)
- .treeMutation(std::make_shared<api::SplitBucketCommand>(bucket))
+ .treeMutation(std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)))
.expectedOrdering({&api::MessageType::REQUESTBUCKETINFO_REPLY,
&api::MessageType::SPLITBUCKET_REPLY,
&api::MessageType::REMOVE_REPLY});
@@ -1159,7 +1161,7 @@ BucketManagerTest::scheduleBucketInfoRequestWithConcurrentOps(
bucketForRemove);
auto conflictingOp(
- std::make_shared<api::SplitBucketCommand>(bucketForSplit));
+ std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketForSplit)));
_top->sendDown(conflictingOp);
fixture.bounceWithReply(*conflictingOp);
fixture.bounceWithReply(*mutation);
@@ -1242,7 +1244,7 @@ BucketManagerTest::testConflictSetOnlyClearedAfterAllBucketRequestsDone()
// guards holding their desired bucket locks.
waitUntilRequestsAreProcessing(2);
- auto conflictingOp = std::make_shared<api::SplitBucketCommand>(bucketA);
+ auto conflictingOp = std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketA));
_top->sendDown(conflictingOp);
fixture.bounceWithReply(*conflictingOp);
// Releasing guard A (and allowing the request for A to go through) should
diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt
index c7243e68146..dc322c345e3 100644
--- a/storage/src/tests/common/CMakeLists.txt
+++ b/storage/src/tests/common/CMakeLists.txt
@@ -3,6 +3,7 @@ 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/make_document_bucket.cpp b/storage/src/tests/common/make_document_bucket.cpp
new file mode 100644
index 00000000000..cef33c515ee
--- /dev/null
+++ b/storage/src/tests/common/make_document_bucket.cpp
@@ -0,0 +1,16 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "make_document_bucket.h"
+
+using document::Bucket;
+using document::BucketId;
+using document::BucketSpace;
+
+namespace storage::test {
+
+Bucket makeDocumentBucket(BucketId bucketId)
+{
+ return Bucket(BucketSpace::placeHolder(), bucketId);
+}
+
+}
diff --git a/storage/src/tests/common/make_document_bucket.h b/storage/src/tests/common/make_document_bucket.h
new file mode 100644
index 00000000000..a95bc501c65
--- /dev/null
+++ b/storage/src/tests/common/make_document_bucket.h
@@ -0,0 +1,13 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/document/bucket/bucket.h>
+
+namespace storage::test {
+
+// Helper function used by unit tests
+
+document::Bucket makeDocumentBucket(document::BucketId bucketId);
+
+}
diff --git a/storage/src/tests/common/storagelinktest.cpp b/storage/src/tests/common/storagelinktest.cpp
index 88b66339127..0490581d7ff 100644
--- a/storage/src/tests/common/storagelinktest.cpp
+++ b/storage/src/tests/common/storagelinktest.cpp
@@ -1,10 +1,13 @@
// 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 <iostream>
#include <string>
#include <vespa/storageapi/message/stat.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
CPPUNIT_TEST_SUITE_REGISTRATION(StorageLinkTest);
@@ -41,7 +44,7 @@ void StorageLinkTest::testNotImplemented() {
// Test that a message that nobody handles fails with NOT_IMPLEMENTED
_replier->setIgnore(true);
_feeder->sendDown(api::StorageCommand::SP(
- new api::StatBucketCommand(document::BucketId(0), "")));
+ new api::StatBucketCommand(makeDocumentBucket(document::BucketId(0)), "")));
_feeder->close();
_feeder->flush();
CPPUNIT_ASSERT_EQUAL((size_t) 1, _feeder->getNumReplies());
diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp
index e4b23f9d46d..54a5f3ec4b1 100644
--- a/storage/src/tests/distributor/bucketdbupdatertest.cpp
+++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp
@@ -8,12 +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/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;
namespace storage {
namespace distributor {
@@ -1102,7 +1104,7 @@ BucketDBUpdaterTest::testNotifyBucketChange()
{
api::BucketInfo info(1, 2, 3, 4, 5, true, true);
auto cmd(std::make_shared<api::NotifyBucketChangeCommand>(
- document::BucketId(16, 1), info));
+ makeDocumentBucket(document::BucketId(16, 1)), info));
cmd->setSourceIndex(0);
getBucketDBUpdater().onNotifyBucketChange(cmd);
}
@@ -1110,7 +1112,7 @@ BucketDBUpdaterTest::testNotifyBucketChange()
{
api::BucketInfo info(10, 11, 12, 13, 14, false, false);
auto cmd(std::make_shared<api::NotifyBucketChangeCommand>(
- document::BucketId(16, 2), info));
+ makeDocumentBucket(document::BucketId(16, 2)), info));
cmd->setSourceIndex(0);
getBucketDBUpdater().onNotifyBucketChange(cmd);
}
@@ -1173,7 +1175,7 @@ BucketDBUpdaterTest::testNotifyBucketChangeFromNodeDown()
{
api::BucketInfo info(8999, 300, 3000, 500, 5000, false, false);
auto cmd(std::make_shared<api::NotifyBucketChangeCommand>(
- document::BucketId(16, 1), info));
+ makeDocumentBucket(document::BucketId(16, 1)), info));
cmd->setSourceIndex(0);
getBucketDBUpdater().onNotifyBucketChange(cmd);
}
@@ -1230,7 +1232,7 @@ BucketDBUpdaterTest::testNotifyChangeWithPendingStateQueuesBucketInfoRequests()
{
api::BucketInfo info(8999, 300, 3000, 500, 5000, false, false);
auto cmd(std::make_shared<api::NotifyBucketChangeCommand>(
- document::BucketId(16, 1), info));
+ makeDocumentBucket(document::BucketId(16, 1)), info));
cmd->setSourceIndex(0);
getBucketDBUpdater().onNotifyBucketChange(cmd);
}
@@ -1279,7 +1281,7 @@ BucketDBUpdaterTest::testMergeReply()
nodes.push_back(api::MergeBucketCommand::Node(1));
nodes.push_back(api::MergeBucketCommand::Node(2));
- api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0);
+ api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0);
auto reply(std::make_shared<api::MergeBucketReply>(cmd));
@@ -1325,7 +1327,7 @@ BucketDBUpdaterTest::testMergeReplyNodeDown()
nodes.push_back(api::MergeBucketCommand::Node(i));
}
- api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0);
+ api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0);
auto reply(std::make_shared<api::MergeBucketReply>(cmd));
@@ -1372,7 +1374,7 @@ BucketDBUpdaterTest::testMergeReplyNodeDownAfterRequestSent()
nodes.push_back(api::MergeBucketCommand::Node(i));
}
- api::MergeBucketCommand cmd(document::BucketId(16, 1234), nodes, 0);
+ api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)), nodes, 0);
auto reply(std::make_shared<api::MergeBucketReply>(cmd));
@@ -1421,7 +1423,7 @@ BucketDBUpdaterTest::testFlush()
nodes.push_back(api::MergeBucketCommand::Node(i));
}
- api::MergeBucketCommand cmd(document::BucketId(16, 1234),
+ api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 1234)),
nodes,
0);
diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp
index d0941571a6a..e40add9b76d 100644
--- a/storage/src/tests/distributor/distributortest.cpp
+++ b/storage/src/tests/distributor/distributortest.cpp
@@ -9,11 +9,14 @@
#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/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;
+
namespace storage {
namespace distributor {
@@ -202,7 +205,7 @@ Distributor_Test::testOperationGeneration()
CPPUNIT_ASSERT_EQUAL(std::string("Remove"),
testOp(new api::RemoveCommand(
- bid,
+ makeDocumentBucket(bid),
document::DocumentId("userdoc:m:1:foo"),
api::Timestamp(1234))));
@@ -285,7 +288,7 @@ Distributor_Test::testHandleUnknownMaintenanceReply()
{
api::SplitBucketCommand::SP cmd(
- new api::SplitBucketCommand(document::BucketId(16, 1234)));
+ new api::SplitBucketCommand(makeDocumentBucket(document::BucketId(16, 1234))));
api::SplitBucketReply::SP reply(new api::SplitBucketReply(*cmd));
CPPUNIT_ASSERT(_distributor->handleReply(reply));
@@ -295,7 +298,7 @@ Distributor_Test::testHandleUnknownMaintenanceReply()
// RemoveLocationReply must be treated as a maintenance reply since
// it's what GC is currently built around.
auto cmd = std::make_shared<api::RemoveLocationCommand>(
- "false", document::BucketId(30, 1234));
+ "false", makeDocumentBucket(document::BucketId(30, 1234)));
auto reply = std::shared_ptr<api::StorageReply>(cmd->makeReply());
CPPUNIT_ASSERT(_distributor->handleReply(reply));
}
@@ -733,7 +736,7 @@ namespace {
auto makeDummyRemoveCommand() {
return std::make_shared<api::RemoveCommand>(
- document::BucketId(0),
+ makeDocumentBucket(document::BucketId(0)),
document::DocumentId("id:foo:testdoctype1:n=1:foo"),
api::Timestamp(0));
}
@@ -881,7 +884,7 @@ void Distributor_Test::external_client_requests_are_handled_individually_in_prio
document::DocumentId id("id:foo:testdoctype1:n=1:foo");
vespalib::stringref field_set = "";
for (auto pri : priorities) {
- auto cmd = std::make_shared<api::GetCommand>(document::BucketId(), id, field_set);
+ auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId()), id, field_set);
cmd->setPriority(pri);
// onDown appends to internal message FIFO queue, awaiting hand-off.
_distributor->onDown(cmd);
@@ -912,7 +915,7 @@ void Distributor_Test::internal_messages_are_started_in_fifo_order_batch() {
std::vector<api::StorageMessage::Priority> priorities({50, 255, 10, 40, 1});
for (auto pri : priorities) {
api::BucketInfo fake_info(pri, pri, pri);
- auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(bucket, fake_info);
+ auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(makeDocumentBucket(bucket), fake_info);
cmd->setSourceIndex(0);
cmd->setPriority(pri);
_distributor->onDown(cmd);
@@ -937,7 +940,7 @@ void Distributor_Test::closing_aborts_priority_queued_client_requests() {
document::DocumentId id("id:foo:testdoctype1:n=1:foo");
vespalib::stringref field_set = "";
for (int i = 0; i < 10; ++i) {
- auto cmd = std::make_shared<api::GetCommand>(document::BucketId(), id, field_set);
+ auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId()), id, field_set);
_distributor->onDown(cmd);
}
tickDistributorNTimes(1);
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index 73b1ff7d356..a66a22c7eb1 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -5,6 +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>
+
+using storage::test::makeDocumentBucket;
namespace storage {
namespace distributor {
@@ -177,13 +180,13 @@ ExternalOperationHandlerTest::findOwned1stNotOwned2ndInStates(
std::shared_ptr<api::GetCommand>
ExternalOperationHandlerTest::makeGetCommand(const vespalib::string& id) const {
- return std::make_shared<api::GetCommand>(document::BucketId(0), DocumentId(id), "[all]");
+ return std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)), DocumentId(id), "[all]");
}
std::shared_ptr<api::GetCommand>
ExternalOperationHandlerTest::makeGetCommandForUser(uint64_t id) const {
DocumentId docId(document::UserDocIdString(vespalib::make_string("userdoc:foo:%lu:bar", id)));
- return std::make_shared<api::GetCommand>(document::BucketId(0), docId, "[all]");
+ return std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)), docId, "[all]");
}
std::shared_ptr<api::UpdateCommand> ExternalOperationHandlerTest::makeUpdateCommand(
@@ -193,7 +196,7 @@ std::shared_ptr<api::UpdateCommand> ExternalOperationHandlerTest::makeUpdateComm
*_testDocMan.getTypeRepo().getDocumentType(doc_type),
document::DocumentId(id));
return std::make_shared<api::UpdateCommand>(
- document::BucketId(0), std::move(update), api::Timestamp(0));
+ makeDocumentBucket(document::BucketId(0)), std::move(update), api::Timestamp(0));
}
std::shared_ptr<api::UpdateCommand>
@@ -206,11 +209,11 @@ std::shared_ptr<api::PutCommand> ExternalOperationHandlerTest::makePutCommand(
const vespalib::string& id) const {
auto doc = _testDocMan.createDocument(doc_type, id);
return std::make_shared<api::PutCommand>(
- document::BucketId(0), std::move(doc), api::Timestamp(0));
+ makeDocumentBucket(document::BucketId(0)), std::move(doc), api::Timestamp(0));
}
std::shared_ptr<api::RemoveCommand> ExternalOperationHandlerTest::makeRemoveCommand(const vespalib::string& id) const {
- return std::make_shared<api::RemoveCommand>(document::BucketId(0), DocumentId(id), api::Timestamp(0));
+ return std::make_shared<api::RemoveCommand>(makeDocumentBucket(document::BucketId(0)), DocumentId(id), api::Timestamp(0));
}
void
@@ -331,7 +334,7 @@ void ExternalOperationHandlerTest::mutation_not_rejected_when_safe_point_reached
DocumentId id("id:foo:testdoctype1::bar");
getExternalOperationHandler().handleMessage(
std::make_shared<api::RemoveCommand>(
- document::BucketId(0), id, api::Timestamp(0)),
+ makeDocumentBucket(document::BucketId(0)), id, api::Timestamp(0)),
generated);
CPPUNIT_ASSERT(generated.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(size_t(0), _sender.replies.size());
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index f9040df0ec2..315152e4683 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -8,6 +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/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/config/helper/configgetter.hpp>
@@ -20,6 +21,7 @@ using std::shared_ptr;
using config::ConfigGetter;
using document::DocumenttypesConfig;
using config::FileSpec;
+using storage::test::makeDocumentBucket;
namespace storage {
namespace distributor {
@@ -70,7 +72,7 @@ public:
void sendGet() {
std::shared_ptr<api::GetCommand> msg(
- new api::GetCommand(document::BucketId(0), docId, "[all]"));
+ new api::GetCommand(makeDocumentBucket(document::BucketId(0)), docId, "[all]"));
op.reset(new GetOperation(getExternalOperationHandler(),
msg,
diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp
index 83b147f4125..8f4b99d9d7f 100644
--- a/storage/src/tests/distributor/idealstatemanagertest.cpp
+++ b/storage/src/tests/distributor/idealstatemanagertest.cpp
@@ -9,7 +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>
+using storage::test::makeDocumentBucket;
namespace storage {
namespace distributor {
@@ -240,7 +242,7 @@ IdealStateManagerTest::testBlockCheckForAllOperationsToSpecificBucket()
document::BucketId bid(16, 1234);
{
- auto msg = std::make_shared<api::JoinBucketsCommand>(bid);
+ auto msg = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(bid));
msg->setAddress(
api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 4));
tracker.insert(msg);
diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp
index 7e7ca52635e..d33ee64a883 100644
--- a/storage/src/tests/distributor/mergeoperationtest.cpp
+++ b/storage/src/tests/distributor/mergeoperationtest.cpp
@@ -8,10 +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/storage/distributor/distributor.h>
#include <vespa/vespalib/text/stringtokenizer.h>
using std::shared_ptr;
+using storage::test::makeDocumentBucket;
namespace storage {
namespace distributor {
@@ -320,7 +322,7 @@ MergeOperationTest::doNotRemoveCopiesWithPendingMessages() {
// Removes are blocked by all and any operation types, so can just choose
// at will.
api::StorageMessage::SP msg(
- new api::SetBucketStateCommand(bucket, api::SetBucketStateCommand::ACTIVE));
+ new api::SetBucketStateCommand(makeDocumentBucket(bucket), api::SetBucketStateCommand::ACTIVE));
msg->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1));
_pendingTracker->insert(msg);
diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
index fa36b4e6305..1fc12821e1d 100644
--- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp
+++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
@@ -7,9 +7,12 @@
#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/vdslib/state/random.h>
#include <vespa/vdstestlib/cppunit/macros.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace distributor {
@@ -185,7 +188,7 @@ private:
std::shared_ptr<api::PutCommand> createPutToNode(uint16_t node) const {
document::BucketId bucket(16, 1234);
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket,
+ new api::PutCommand(makeDocumentBucket(bucket),
createDummyDocumentForBucket(bucket),
api::Timestamp(123456)));
cmd->setAddress(makeStorageAddress(node));
@@ -197,7 +200,7 @@ private:
{
document::BucketId bucket(16, 1234);
std::shared_ptr<api::RemoveCommand> cmd(
- new api::RemoveCommand(bucket,
+ new api::RemoveCommand(makeDocumentBucket(bucket),
document::DocumentId(
createDummyIdString(bucket)),
api::Timestamp(123456)));
@@ -239,7 +242,7 @@ PendingMessageTrackerTest::testSimple()
std::shared_ptr<api::RemoveCommand> remove(
new api::RemoveCommand(
- document::BucketId(16, 1234),
+ makeDocumentBucket(document::BucketId(16, 1234)),
document::DocumentId("userdoc:footype:1234:foo"), 1001));
remove->setAddress(
api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0));
@@ -280,7 +283,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker)
ost << "userdoc:footype:1234:" << i;
std::shared_ptr<api::RemoveCommand> remove(
new api::RemoveCommand(
- document::BucketId(16, 1234),
+ makeDocumentBucket(document::BucketId(16, 1234)),
document::DocumentId(ost.str()), 1000 + i));
remove->setAddress(
api::StorageMessageAddress("storage",
@@ -291,7 +294,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker)
for (uint32_t i = 0; i < 4; i++) {
std::ostringstream ost;
ost << "userdoc:footype:4567:" << i;
- std::shared_ptr<api::RemoveCommand> remove(new api::RemoveCommand(document::BucketId(16, 4567), document::DocumentId(ost.str()), 2000 + i));
+ std::shared_ptr<api::RemoveCommand> remove(new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 4567)), document::DocumentId(ost.str()), 2000 + i));
remove->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, i % 2));
tracker.insert(remove);
}
@@ -434,7 +437,7 @@ PendingMessageTrackerTest::testGetPendingMessageTypes()
std::shared_ptr<api::RemoveCommand> remove(
new api::RemoveCommand(
- bid,
+ makeDocumentBucket(bid),
document::DocumentId("userdoc:footype:1234:foo"), 1001));
remove->setAddress(
api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0));
@@ -474,7 +477,7 @@ PendingMessageTrackerTest::testHasPendingMessage()
{
std::shared_ptr<api::RemoveCommand> remove(
new api::RemoveCommand(
- bid,
+ makeDocumentBucket(bid),
document::DocumentId("userdoc:footype:1234:foo"), 1001));
remove->setAddress(
api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1));
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index bec07c299d9..156fc2fc8ca 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -10,6 +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/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/testkit/test_kit.h>
@@ -26,6 +27,7 @@ using namespace storage;
using namespace storage::api;
using namespace storage::lib;
using namespace std::literals::string_literals;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -148,7 +150,7 @@ public:
const Document::SP doc) const
{
return std::shared_ptr<api::PutCommand>(
- new api::PutCommand(document::BucketId(0), doc, 100));
+ new api::PutCommand(makeDocumentBucket(document::BucketId(0)), doc, 100));
}
};
@@ -164,7 +166,7 @@ PutOperationTest::createAndSendSampleDocument(uint32_t timeout) {
addIdealNodes(id);
std::shared_ptr<api::PutCommand> msg(
- new api::PutCommand(document::BucketId(0),
+ new api::PutCommand(makeDocumentBucket(document::BucketId(0)),
doc,
0));
msg->setTimestamp(100);
diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp
index 28283b62120..975d77d870f 100644
--- a/storage/src/tests/distributor/removelocationtest.cpp
+++ b/storage/src/tests/distributor/removelocationtest.cpp
@@ -6,8 +6,11 @@
#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/storage/distributor/distributor.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace distributor {
@@ -34,7 +37,7 @@ public:
void sendRemoveLocation(const std::string& selection) {
std::shared_ptr<api::RemoveLocationCommand> msg(
- new api::RemoveLocationCommand(selection, document::BucketId(0)));
+ new api::RemoveLocationCommand(selection, makeDocumentBucket(document::BucketId(0))));
op.reset(new RemoveLocationOperation(getExternalOperationHandler(),
msg,
diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp
index ae4feb0d03a..013d62bac14 100644
--- a/storage/src/tests/distributor/removeoperationtest.cpp
+++ b/storage/src/tests/distributor/removeoperationtest.cpp
@@ -6,8 +6,11 @@
#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/storage/distributor/operations/external/removeoperation.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace distributor {
@@ -52,7 +55,7 @@ public:
void sendRemove(document::DocumentId dId) {
std::shared_ptr<api::RemoveCommand> msg(
- new api::RemoveCommand(document::BucketId(0), dId, 100));
+ new api::RemoveCommand(makeDocumentBucket(document::BucketId(0)), dId, 100));
op.reset(new RemoveOperation(getExternalOperationHandler(),
msg,
diff --git a/storage/src/tests/distributor/splitbuckettest.cpp b/storage/src/tests/distributor/splitbuckettest.cpp
index 17a59b620a2..e4c90dcbbe3 100644
--- a/storage/src/tests/distributor/splitbuckettest.cpp
+++ b/storage/src/tests/distributor/splitbuckettest.cpp
@@ -9,10 +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/storage/distributor/distributor.h>
using std::shared_ptr;
using namespace document;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -317,7 +319,7 @@ SplitOperationTest::testOperationBlockedByPendingJoin()
std::vector<document::BucketId> joinSources = {
document::BucketId(3, 1), document::BucketId(3, 5)
};
- auto joinCmd = std::make_shared<api::JoinBucketsCommand>(joinTarget);
+ auto joinCmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(joinTarget));
joinCmd->getSourceBuckets() = joinSources;
joinCmd->setAddress(
api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0));
diff --git a/storage/src/tests/distributor/statoperationtest.cpp b/storage/src/tests/distributor/statoperationtest.cpp
index bbfac1e69fd..e9364b06085 100644
--- a/storage/src/tests/distributor/statoperationtest.cpp
+++ b/storage/src/tests/distributor/statoperationtest.cpp
@@ -4,10 +4,13 @@
#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/storage/distributor/operations/external/statbucketoperation.h>
#include <vespa/storage/distributor/operations/external/statbucketlistoperation.h>
#include <vespa/storage/distributor/distributor.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace distributor {
@@ -44,7 +47,7 @@ StatOperationTest::testBucketInfo()
StatBucketOperation op(
getExternalOperationHandler(),
std::shared_ptr<api::StatBucketCommand>(
- new api::StatBucketCommand(document::BucketId(16, 5), "")));
+ new api::StatBucketCommand(makeDocumentBucket(document::BucketId(16, 5)), "")));
op.start(_sender, framework::MilliSecTime(0));
@@ -84,7 +87,7 @@ StatOperationTest::testBucketList() {
}
std::shared_ptr<api::GetBucketListCommand> msg(
- new api::GetBucketListCommand(document::BucketId(16, 5)));
+ new api::GetBucketListCommand(makeDocumentBucket(document::BucketId(16, 5))));
StatBucketListOperation op(
getExternalOperationHandler().getBucketDatabase(),
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 9df7888a3d0..7d3c61d5674 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -13,8 +13,11 @@
#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/storage/distributor/distributor.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace distributor {
@@ -321,7 +324,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState,
}
auto msg(std::make_shared<api::UpdateCommand>(
- document::BucketId(0), update, api::Timestamp(0)));
+ makeDocumentBucket(document::BucketId(0)), update, api::Timestamp(0)));
// Misc settings for checking that propagation works.
msg->getTrace().setLevel(6);
msg->setTimeout(6789);
diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp
index fdb6012800f..425751ee0d0 100644
--- a/storage/src/tests/distributor/updateoperationtest.cpp
+++ b/storage/src/tests/distributor/updateoperationtest.cpp
@@ -7,6 +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/storage/distributor/operations/external/updateoperation.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/storage/distributor/distributor.h>
@@ -22,6 +23,7 @@ using namespace storage::lib;
using config::ConfigGetter;
using config::FileSpec;
using vespalib::string;
+using storage::test::makeDocumentBucket;
class UpdateOperation_Test : public CppUnit::TestFixture,
public DistributorTestUtil
@@ -84,7 +86,7 @@ UpdateOperation_Test::sendUpdate(const std::string& bucketState)
addNodesToBucketDB(_bId, bucketState);
std::shared_ptr<api::UpdateCommand> msg(
- new api::UpdateCommand(document::BucketId(0),
+ new api::UpdateCommand(makeDocumentBucket(document::BucketId(0)),
update,
100));
diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp
index b0225992a20..2fd070de394 100644
--- a/storage/src/tests/persistence/common/filestortestfixture.cpp
+++ b/storage/src/tests/persistence/common/filestortestfixture.cpp
@@ -4,10 +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/persistence/spi/test.h>
#include <sstream>
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -99,7 +101,7 @@ FileStorTestFixture::TestFileStorComponents::sendDummyGet(
std::ostringstream id;
id << "id:foo:testdoctype1:n=" << bid.getId() << ":0";
std::shared_ptr<api::GetCommand> cmd(
- new api::GetCommand(bid, document::DocumentId(id.str()), "[all]"));
+ new api::GetCommand(makeDocumentBucket(bid), document::DocumentId(id.str()), "[all]"));
cmd->setAddress(makeSelfAddress());
cmd->setPriority(255);
top.sendDown(cmd);
@@ -113,7 +115,7 @@ FileStorTestFixture::TestFileStorComponents::sendDummyGetDiff(
nodes.push_back(0);
nodes.push_back(1);
std::shared_ptr<api::GetBucketDiffCommand> cmd(
- new api::GetBucketDiffCommand(bid, nodes, 12345));
+ new api::GetBucketDiffCommand(makeDocumentBucket(bid), nodes, 12345));
cmd->setAddress(makeSelfAddress());
cmd->setPriority(255);
top.sendDown(cmd);
@@ -130,7 +132,7 @@ FileStorTestFixture::TestFileStorComponents::sendPut(
document::Document::SP doc(
_fixture._node->getTestDocMan().createDocument("foobar", id.str()));
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, timestamp));
+ new api::PutCommand(makeDocumentBucket(bid), doc, timestamp));
cmd->setAddress(makeSelfAddress());
top.sendDown(cmd);
}
diff --git a/storage/src/tests/persistence/filestorage/deletebuckettest.cpp b/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
index 4aad3f5c41b..e6da51e103a 100644
--- a/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
+++ b/storage/src/tests/persistence/filestorage/deletebuckettest.cpp
@@ -4,11 +4,14 @@
#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/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
LOG_SETUP(".deletebuckettest");
+using storage::test::makeDocumentBucket;
+
namespace storage {
class DeleteBucketTest : public FileStorTestFixture
@@ -38,7 +41,7 @@ DeleteBucketTest::testDeleteAbortsOperationsForBucket()
// Put will be queued since thread now must know it's paused.
c.sendPut(bucket, DocumentIndex(1), PutTimestamp(1000));
- auto deleteMsg = std::make_shared<api::DeleteBucketCommand>(bucket);
+ auto deleteMsg = std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket));
c.top.sendDown(deleteMsg);
// We should now have two put replies. The first one will either be OK
// or BUCKET_DELETED depending on whether it raced. The second (which is
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 0b8ee0113ea..87655d8bd35 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -4,6 +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/storage/storageserver/statemanager.h>
#include <vespa/storage/bucketdb/bucketmanager.h>
#include <vespa/storage/persistence/persistencethread.h>
@@ -40,6 +41,7 @@ using std::unique_ptr;
using document::Document;
using namespace storage::api;
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
#define ASSERT_SINGLE_REPLY(replytype, reply, link, time) \
reply = 0; \
@@ -342,7 +344,7 @@ FileStorManagerTest::testHeaderOnlyPut()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -359,7 +361,7 @@ FileStorManagerTest::testHeaderOnlyPut()
// Putting it again, this time with header only
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 124));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 124));
cmd->setUpdateTimestamp(105);
cmd->setAddress(address);
top.sendDown(cmd);
@@ -375,7 +377,7 @@ FileStorManagerTest::testHeaderOnlyPut()
// Getting it
{
std::shared_ptr<api::GetCommand> cmd(new api::GetCommand(
- bid, doc->getId(), "[all]"));
+ makeDocumentBucket(bid), doc->getId(), "[all]"));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -422,7 +424,7 @@ FileStorManagerTest::testPut()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -460,7 +462,7 @@ FileStorManagerTest::testDiskMove()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -558,7 +560,7 @@ FileStorManagerTest::testRepairNotifiesDistributorOnChange()
document::DocumentId docId(vespalib::make_string("userdoc:ns:1:%d", i));
Document::SP doc(new Document(*_testdoctype1, docId));
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(document::BucketId(16, 1), doc, i + 1));
+ new api::PutCommand(makeDocumentBucket(document::BucketId(16, 1)), doc, i + 1));
cmd->setAddress(address);
top.sendDown(cmd);
}
@@ -606,7 +608,7 @@ FileStorManagerTest::testFlush()
std::vector<std::shared_ptr<api::StorageCommand> > _commands;
for (uint32_t i=0; i<msgCount; ++i) {
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, i+1));
+ new api::PutCommand(makeDocumentBucket(bid), doc, i+1));
cmd->setAddress(address);
_commands.push_back(cmd);
}
@@ -653,7 +655,7 @@ FileStorManagerTest::testHandlerPriority()
// Populate bucket with the given data
for (uint32_t i = 1; i < 6; i++) {
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -689,7 +691,7 @@ public:
_doc->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, _doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), _doc, 100));
_handler.schedule(cmd, 0);
FastOS_Thread::Sleep(1);
}
@@ -822,7 +824,7 @@ FileStorManagerTest::testHandlerPause()
// Populate bucket with the given data
for (uint32_t i = 1; i < 6; i++) {
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -890,9 +892,9 @@ FileStorManagerTest::testRemapSplit()
// Populate bucket with the given data
for (uint32_t i = 1; i < 4; i++) {
filestorHandler.schedule(
- api::StorageMessage::SP(new api::PutCommand(bucket1, doc1, i)), 0);
+ api::StorageMessage::SP(new api::PutCommand(makeDocumentBucket(bucket1), doc1, i)), 0);
filestorHandler.schedule(
- api::StorageMessage::SP(new api::PutCommand(bucket2, doc2, i + 10)), 0);
+ api::StorageMessage::SP(new api::PutCommand(makeDocumentBucket(bucket2), doc2, i + 10)), 0);
}
CPPUNIT_ASSERT_EQUAL(std::string("BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), userdoc:footype:1234:bar, timestamp 1, size 108) (priority: 127)\n"
@@ -958,9 +960,9 @@ FileStorManagerTest::testHandlerMulti()
// Populate bucket with the given data
for (uint32_t i = 1; i < 10; i++) {
filestorHandler.schedule(
- api::StorageMessage::SP(new api::PutCommand(bucket1, doc1, i)), 0);
+ api::StorageMessage::SP(new api::PutCommand(makeDocumentBucket(bucket1), doc1, i)), 0);
filestorHandler.schedule(
- api::StorageMessage::SP(new api::PutCommand(bucket2, doc2, i + 10)), 0);
+ api::StorageMessage::SP(new api::PutCommand(makeDocumentBucket(bucket2), doc2, i + 10)), 0);
}
{
@@ -1019,7 +1021,7 @@ FileStorManagerTest::testHandlerTimeout()
// Populate bucket with the given data
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1031,7 +1033,7 @@ FileStorManagerTest::testHandlerTimeout()
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1089,7 +1091,7 @@ FileStorManagerTest::testHandlerPriorityBlocking()
document::BucketId bucket(16, factory.getBucketId(
doc->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1117,7 +1119,7 @@ FileStorManagerTest::testHandlerPriorityBlocking()
document::BucketId bucket(16, factory.getBucketId(
doc->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1204,7 +1206,7 @@ FileStorManagerTest::testHandlerPriorityPreempt()
document::BucketId bucket(16, factory.getBucketId(
doc->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1226,7 +1228,7 @@ FileStorManagerTest::testHandlerPriorityPreempt()
document::BucketId bucket(16, factory.getBucketId(
doc->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bucket), doc, 100));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1317,7 +1319,7 @@ FileStorManagerTest::testPriority()
documents[i]->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, documents[i], 100 + i));
+ new api::PutCommand(makeDocumentBucket(bucket), documents[i], 100 + i));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1400,7 +1402,7 @@ FileStorManagerTest::testSplit1()
makeBucket(bucket), context);
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, documents[i], 100 + i));
+ new api::PutCommand(makeDocumentBucket(bucket), documents[i], 100 + i));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1423,7 +1425,7 @@ FileStorManagerTest::testSplit1()
if (i % 5 == 0) {
std::shared_ptr<api::RemoveCommand> rcmd(
new api::RemoveCommand(
- bucket, documents[i]->getId(), 1000000 + 100 + i));
+ makeDocumentBucket(bucket), documents[i]->getId(), 1000000 + 100 + i));
rcmd->setAddress(*address);
filestorHandler.schedule(rcmd, 0);
filestorHandler.flush(true);
@@ -1442,7 +1444,7 @@ FileStorManagerTest::testSplit1()
// Perform a split, check that locations are split
{
std::shared_ptr<api::SplitBucketCommand> cmd(
- new api::SplitBucketCommand(document::BucketId(16, 1)));
+ new api::SplitBucketCommand(makeDocumentBucket(document::BucketId(16, 1))));
cmd->setSourceIndex(0);
filestorHandler.schedule(cmd, 0);
filestorHandler.flush(true);
@@ -1461,7 +1463,7 @@ FileStorManagerTest::testSplit1()
document::BucketId bucket(
17, i % 3 == 0 ? 0x10001 : 0x0100001);
std::shared_ptr<api::GetCommand> cmd(
- new api::GetCommand(bucket, documents[i]->getId(), "[all]"));
+ new api::GetCommand(makeDocumentBucket(bucket), documents[i]->getId(), "[all]"));
api::StorageMessageAddress address(
"storage", lib::NodeType::STORAGE, 3);
cmd->setAddress(address);
@@ -1480,7 +1482,7 @@ FileStorManagerTest::testSplit1()
for (int i=17; i<=32; ++i) {
std::shared_ptr<api::SplitBucketCommand> cmd(
new api::SplitBucketCommand(
- document::BucketId(i, 0x0100001)));
+ makeDocumentBucket(document::BucketId(i, 0x0100001))));
cmd->setSourceIndex(0);
filestorHandler.schedule(cmd, 0);
filestorHandler.flush(true);
@@ -1504,7 +1506,7 @@ FileStorManagerTest::testSplit1()
documents[i]->getId()).getRawId());
}
std::shared_ptr<api::GetCommand> cmd(
- new api::GetCommand(bucket, documents[i]->getId(), "[all]"));
+ new api::GetCommand(makeDocumentBucket(bucket), documents[i]->getId(), "[all]"));
api::StorageMessageAddress address(
"storage", lib::NodeType::STORAGE, 3);
cmd->setAddress(address);
@@ -1575,7 +1577,7 @@ FileStorManagerTest::testSplitSingleGroup()
makeBucket(bucket), context);
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, documents[i], 100 + i));
+ new api::PutCommand(makeDocumentBucket(bucket), documents[i], 100 + i));
api::StorageMessageAddress address(
"storage", lib::NodeType::STORAGE, 3);
cmd->setAddress(address);
@@ -1593,7 +1595,7 @@ FileStorManagerTest::testSplitSingleGroup()
// Perform a split, check that locations are split
{
std::shared_ptr<api::SplitBucketCommand> cmd(
- new api::SplitBucketCommand(document::BucketId(16, 1)));
+ new api::SplitBucketCommand(makeDocumentBucket(document::BucketId(16, 1))));
cmd->setSourceIndex(0);
filestorHandler.schedule(cmd, 0);
filestorHandler.flush(true);
@@ -1612,7 +1614,7 @@ FileStorManagerTest::testSplitSingleGroup()
for (uint32_t i=0; i<documents.size(); ++i) {
document::BucketId bucket(17, state ? 0x10001 : 0x00001);
std::shared_ptr<api::GetCommand> cmd(
- new api::GetCommand(bucket, documents[i]->getId(), "[all]"));
+ new api::GetCommand(makeDocumentBucket(bucket), documents[i]->getId(), "[all]"));
api::StorageMessageAddress address(
"storage", lib::NodeType::STORAGE, 3);
cmd->setAddress(address);
@@ -1650,7 +1652,7 @@ FileStorManagerTest::putDoc(DummyStorageLink& top,
makeBucket(target), context);
Document::SP doc(new Document(*_testdoctype1, docId));
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(target, doc, docNum+1));
+ new api::PutCommand(makeDocumentBucket(target), doc, docNum+1));
cmd->setAddress(address);
cmd->setPriority(120);
filestorHandler.schedule(cmd, 0);
@@ -1704,7 +1706,7 @@ FileStorManagerTest::testSplitEmptyTargetWithRemappedOps()
new ResumeGuard(filestorHandler.pause()));
std::shared_ptr<api::SplitBucketCommand> splitCmd(
- new api::SplitBucketCommand(source));
+ new api::SplitBucketCommand(makeDocumentBucket(source)));
splitCmd->setPriority(120);
splitCmd->setSourceIndex(0);
@@ -1712,7 +1714,7 @@ FileStorManagerTest::testSplitEmptyTargetWithRemappedOps()
vespalib::make_string("userdoc:ns:%d:1234", 0x100001));
Document::SP doc(new Document(*_testdoctype1, docId));
std::shared_ptr<api::PutCommand> putCmd(
- new api::PutCommand(source, doc, 1001));
+ new api::PutCommand(makeDocumentBucket(source), doc, 1001));
putCmd->setAddress(address);
putCmd->setPriority(120);
@@ -1771,7 +1773,7 @@ FileStorManagerTest::testNotifyOnSplitSourceOwnershipChanged()
}
std::shared_ptr<api::SplitBucketCommand> splitCmd(
- new api::SplitBucketCommand(source));
+ new api::SplitBucketCommand(makeDocumentBucket(source)));
splitCmd->setPriority(120);
splitCmd->setSourceIndex(0); // Source not owned by this distributor.
@@ -1836,7 +1838,7 @@ FileStorManagerTest::testJoin()
document::BucketId bucket(17, factory.getBucketId(
documents[i]->getId()).getRawId());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bucket, documents[i], 100 + i));
+ new api::PutCommand(makeDocumentBucket(bucket), documents[i], 100 + i));
std::unique_ptr<api::StorageMessageAddress> address(
new api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 3));
@@ -1855,7 +1857,7 @@ FileStorManagerTest::testJoin()
if (i % 5 == 0) {
std::shared_ptr<api::RemoveCommand> rcmd(
new api::RemoveCommand(
- bucket, documents[i]->getId(), 1000000 + 100 + i));
+ makeDocumentBucket(bucket), documents[i]->getId(), 1000000 + 100 + i));
rcmd->setAddress(*address);
filestorHandler.schedule(rcmd, 0);
filestorHandler.flush(true);
@@ -1874,7 +1876,7 @@ FileStorManagerTest::testJoin()
// Perform a join, check that other files are gone
{
std::shared_ptr<api::JoinBucketsCommand> cmd(
- new api::JoinBucketsCommand(document::BucketId(16, 1)));
+ new api::JoinBucketsCommand(makeDocumentBucket(document::BucketId(16, 1))));
cmd->getSourceBuckets().push_back(document::BucketId(17, 0x00001));
cmd->getSourceBuckets().push_back(document::BucketId(17, 0x10001));
filestorHandler.schedule(cmd, 0);
@@ -1892,7 +1894,7 @@ FileStorManagerTest::testJoin()
for (uint32_t i=0; i<documents.size(); ++i) {
document::BucketId bucket(16, 1);
std::shared_ptr<api::GetCommand> cmd(
- new api::GetCommand(bucket, documents[i]->getId(), "[all]"));
+ new api::GetCommand(makeDocumentBucket(bucket), documents[i]->getId(), "[all]"));
api::StorageMessageAddress address(
"storage", lib::NodeType::STORAGE, 3);
cmd->setAddress(address);
@@ -1985,7 +1987,7 @@ FileStorManagerTest::testVisiting()
document::StringFieldValue("Jane Doe"));
}
std::shared_ptr<api::PutCommand> cmd(new api::PutCommand(
- ids[i < 3 ? 0 : 1], doc, i+1));
+ makeDocumentBucket(ids[i < 3 ? 0 : 1]), doc, i+1));
top.sendDown(cmd);
}
top.waitForMessages(docCount, _waitTime);
@@ -2135,7 +2137,7 @@ FileStorManagerTest::testRemoveLocation()
Document::SP doc(createDocument(
"some content", docid.str()).release());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 1000 + i));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 1000 + i));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2151,7 +2153,7 @@ FileStorManagerTest::testRemoveLocation()
// Issuing remove location command
{
std::shared_ptr<api::RemoveLocationCommand> cmd(
- new api::RemoveLocationCommand("id.user % 512 == 0", bid));
+ new api::RemoveLocationCommand("id.user % 512 == 0", makeDocumentBucket(bid)));
//new api::RemoveLocationCommand("id.user == 1", bid));
cmd->setAddress(address);
top.sendDown(cmd);
@@ -2189,7 +2191,7 @@ void FileStorManagerTest::testDeleteBucket()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2208,7 +2210,7 @@ void FileStorManagerTest::testDeleteBucket()
// Delete bucket
{
std::shared_ptr<api::DeleteBucketCommand> cmd(
- new api::DeleteBucketCommand(bid));
+ new api::DeleteBucketCommand(makeDocumentBucket(bid)));
cmd->setAddress(address);
cmd->setBucketInfo(bucketInfo);
top.sendDown(cmd);
@@ -2246,7 +2248,7 @@ FileStorManagerTest::testDeleteBucketRejectOutdatedBucketInfo()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2265,7 +2267,7 @@ FileStorManagerTest::testDeleteBucketRejectOutdatedBucketInfo()
// Attempt to delete bucket, but with non-matching bucketinfo
{
std::shared_ptr<api::DeleteBucketCommand> cmd(
- new api::DeleteBucketCommand(bid));
+ new api::DeleteBucketCommand(makeDocumentBucket(bid)));
cmd->setBucketInfo(api::BucketInfo(0xf000baaa, 1, 123, 1, 456));
cmd->setAddress(address);
top.sendDown(cmd);
@@ -2308,7 +2310,7 @@ FileStorManagerTest::testDeleteBucketWithInvalidBucketInfo()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 105));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 105));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2325,7 +2327,7 @@ FileStorManagerTest::testDeleteBucketWithInvalidBucketInfo()
// Attempt to delete bucket with invalid bucketinfo
{
std::shared_ptr<api::DeleteBucketCommand> cmd(
- new api::DeleteBucketCommand(bid));
+ new api::DeleteBucketCommand(makeDocumentBucket(bid)));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2488,7 +2490,7 @@ FileStorManagerTest::testNoTimestamps()
// Putting it
{
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 0));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 0));
cmd->setAddress(address);
CPPUNIT_ASSERT_EQUAL((api::Timestamp)0, cmd->getTimestamp());
top.sendDown(cmd);
@@ -2505,7 +2507,7 @@ FileStorManagerTest::testNoTimestamps()
// Removing it
{
std::shared_ptr<api::RemoveCommand> cmd(
- new api::RemoveCommand(bid, doc->getId(), 0));
+ new api::RemoveCommand(makeDocumentBucket(bid), doc->getId(), 0));
cmd->setAddress(address);
CPPUNIT_ASSERT_EQUAL((api::Timestamp)0, cmd->getTimestamp());
top.sendDown(cmd);
@@ -2544,7 +2546,7 @@ FileStorManagerTest::testEqualTimestamps()
"some content", "userdoc:crawler:4000:http://www.ntnu.no/")
.release());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 100));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2565,7 +2567,7 @@ FileStorManagerTest::testEqualTimestamps()
"some content", "userdoc:crawler:4000:http://www.ntnu.no/")
.release());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 100));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2584,7 +2586,7 @@ FileStorManagerTest::testEqualTimestamps()
"some content", "userdoc:crawler:4000:http://www.ntnu.nu/")
.release());
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, doc, 100));
+ new api::PutCommand(makeDocumentBucket(bid), doc, 100));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2623,7 +2625,7 @@ FileStorManagerTest::testMultiOp()
doc->set("headerval", (int) i);
doc->set("content", "some content");
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(document::BucketId(16, 0), doc, 100 + i));
+ new api::PutCommand(makeDocumentBucket(document::BucketId(16, 0)), doc, 100 + i));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2686,7 +2688,7 @@ FileStorManagerTest::testMultiOp()
{
std::shared_ptr<api::MultiOperationCommand> cmd(
new api::MultiOperationCommand(
- repo, document::BucketId(16, 0), buffer));
+ repo, makeDocumentBucket(document::BucketId(16, 0)), buffer));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2705,7 +2707,7 @@ FileStorManagerTest::testMultiOp()
std::ostringstream did;
did << "userdoc:crawler:0:http://www.ntnu.no/" << i;
std::shared_ptr<api::GetCommand> cmd(new api::GetCommand(
- document::BucketId(16, 0), document::DocumentId(did.str()),
+ makeDocumentBucket(document::BucketId(16, 0)), document::DocumentId(did.str()),
"[all]"));
cmd->setAddress(address);
top.sendDown(cmd);
@@ -2781,7 +2783,7 @@ FileStorManagerTest::testGetIter()
// Putting all docs to have something to visit
for (uint32_t i=0; i<docs.size(); ++i) {
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, docs[i], 100 + i));
+ new api::PutCommand(makeDocumentBucket(bid), docs[i], 100 + i));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2822,7 +2824,7 @@ FileStorManagerTest::testGetIter()
// Testing specific situation where file is deleted while visiting here
{
std::shared_ptr<api::DeleteBucketCommand> cmd(
- new api::DeleteBucketCommand(bid));
+ new api::DeleteBucketCommand(makeDocumentBucket(bid)));
cmd->setBucketInfo(bucketInfo);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2884,7 +2886,7 @@ FileStorManagerTest::testSetBucketActiveState()
{
std::shared_ptr<api::SetBucketStateCommand> cmd(
new api::SetBucketStateCommand(
- bid, api::SetBucketStateCommand::ACTIVE));
+ makeDocumentBucket(bid), api::SetBucketStateCommand::ACTIVE));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2928,7 +2930,7 @@ FileStorManagerTest::testSetBucketActiveState()
{
std::shared_ptr<api::SetBucketStateCommand> cmd(
new api::SetBucketStateCommand(
- bid, api::SetBucketStateCommand::INACTIVE));
+ makeDocumentBucket(bid), api::SetBucketStateCommand::INACTIVE));
cmd->setAddress(address);
top.sendDown(cmd);
top.waitForMessages(1, _waitTime);
@@ -2971,7 +2973,7 @@ FileStorManagerTest::testNotifyOwnerDistributorOnOutdatedSetBucketState()
std::shared_ptr<api::SetBucketStateCommand> cmd(
new api::SetBucketStateCommand(
- bid, api::SetBucketStateCommand::ACTIVE));
+ makeDocumentBucket(bid), api::SetBucketStateCommand::ACTIVE));
cmd->setAddress(api::StorageMessageAddress(
"cluster", lib::NodeType::STORAGE, 1));
cmd->setSourceIndex(0);
@@ -3024,7 +3026,7 @@ FileStorManagerTest::testGetBucketDiffImplicitCreateBucket()
nodes.push_back(0);
std::shared_ptr<api::GetBucketDiffCommand> cmd(
- new api::GetBucketDiffCommand(bid, nodes, Timestamp(1000)));
+ new api::GetBucketDiffCommand(makeDocumentBucket(bid), nodes, Timestamp(1000)));
cmd->setAddress(api::StorageMessageAddress(
"cluster", lib::NodeType::STORAGE, 1));
cmd->setSourceIndex(0);
@@ -3064,7 +3066,7 @@ FileStorManagerTest::testMergeBucketImplicitCreateBucket()
nodes.push_back(2);
std::shared_ptr<api::MergeBucketCommand> cmd(
- new api::MergeBucketCommand(bid, nodes, Timestamp(1000)));
+ new api::MergeBucketCommand(makeDocumentBucket(bid), nodes, Timestamp(1000)));
cmd->setAddress(api::StorageMessageAddress(
"cluster", lib::NodeType::STORAGE, 1));
cmd->setSourceIndex(0);
@@ -3098,7 +3100,7 @@ FileStorManagerTest::testNewlyCreatedBucketIsReady()
document::BucketId bid(16, 4000);
std::shared_ptr<api::CreateBucketCommand> cmd(
- new api::CreateBucketCommand(bid));
+ new api::CreateBucketCommand(makeDocumentBucket(bid)));
cmd->setAddress(api::StorageMessageAddress(
"cluster", lib::NodeType::STORAGE, 1));
cmd->setSourceIndex(0);
@@ -3126,7 +3128,7 @@ FileStorManagerTest::testCreateBucketSetsActiveFlagInDatabaseAndReply()
document::BucketId bid(16, 4000);
std::shared_ptr<api::CreateBucketCommand> cmd(
- new api::CreateBucketCommand(bid));
+ new api::CreateBucketCommand(makeDocumentBucket(bid)));
cmd->setAddress(api::StorageMessageAddress(
"cluster", lib::NodeType::STORAGE, 1));
cmd->setSourceIndex(0);
diff --git a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
index ea2f56a7d4f..8bf8ac087b9 100644
--- a/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
+++ b/storage/src/tests/persistence/filestorage/mergeblockingtest.cpp
@@ -6,6 +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>
+
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -82,7 +85,7 @@ getNodesWithForwarding() {
std::shared_ptr<api::MergeBucketCommand>
createMerge(const document::BucketId& bucket) {
std::shared_ptr<api::MergeBucketCommand> cmd(
- new api::MergeBucketCommand(bucket, getNodes(), api::Timestamp(1000)));
+ new api::MergeBucketCommand(makeDocumentBucket(bucket), getNodes(), api::Timestamp(1000)));
assignCommandMeta(*cmd);
return cmd;
}
@@ -92,7 +95,7 @@ createGetDiff(const document::BucketId& bucket,
const std::vector<api::MergeBucketCommand::Node>& nodes)
{
std::shared_ptr<api::GetBucketDiffCommand> cmd(
- new api::GetBucketDiffCommand(bucket, nodes, api::Timestamp(1000)));
+ new api::GetBucketDiffCommand(makeDocumentBucket(bucket), nodes, api::Timestamp(1000)));
assignCommandMeta(*cmd);
return cmd;
}
@@ -101,7 +104,7 @@ std::shared_ptr<api::ApplyBucketDiffCommand>
createApplyDiff(const document::BucketId& bucket,
const std::vector<api::MergeBucketCommand::Node>& nodes) {
std::shared_ptr<api::ApplyBucketDiffCommand> cmd(
- new api::ApplyBucketDiffCommand(bucket, nodes, 1024*1024));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(bucket), nodes, 1024*1024));
assignCommandMeta(*cmd);
return cmd;
}
diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
index a62c7b00a34..9a71fe16a15 100644
--- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
+++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp
@@ -5,6 +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/vespalib/util/barrier.h>
#include <vespa/vespalib/util/thread.h>
#include <vespa/vespalib/stllike/hash_set_insert.hpp>
@@ -12,6 +13,8 @@
#include <vespa/log/log.h>
LOG_SETUP(".operationabortingtest");
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace {
@@ -335,7 +338,7 @@ OperationAbortingTest::testDoNotAbortCreateBucketCommands()
{
document::BucketId bucket(16, 1);
std::vector<api::StorageMessage::SP> msgs;
- msgs.push_back(api::StorageMessage::SP(new api::CreateBucketCommand(bucket)));
+ msgs.push_back(api::StorageMessage::SP(new api::CreateBucketCommand(makeDocumentBucket(bucket))));
bool shouldCreateBucketInitially(false);
doTestSpecificOperationsNotAborted(
@@ -373,7 +376,7 @@ OperationAbortingTest::testDoNotAbortDeleteBucketCommands()
{
document::BucketId bucket(16, 1);
std::vector<api::StorageMessage::SP> msgs;
- api::DeleteBucketCommand::SP cmd(new api::DeleteBucketCommand(bucket));
+ api::DeleteBucketCommand::SP cmd(new api::DeleteBucketCommand(makeDocumentBucket(bucket)));
msgs.push_back(cmd);
bool shouldCreateBucketInitially(true);
diff --git a/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp b/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
index ef49f7cd5dd..cbb1cb48f3e 100644
--- a/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
+++ b/storage/src/tests/persistence/filestorage/sanitycheckeddeletetest.cpp
@@ -4,10 +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/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -47,7 +49,7 @@ void SanityCheckedDeleteTest::delete_bucket_fails_when_provider_out_of_sync() {
entry.write();
}
- auto cmd = std::make_shared<api::DeleteBucketCommand>(bucket);
+ auto cmd = std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket));
cmd->setBucketInfo(serviceLayerInfo);
c.top.sendDown(cmd);
@@ -90,7 +92,7 @@ void SanityCheckedDeleteTest::differing_document_sizes_not_considered_out_of_syn
// Expect 1 byte of reported size, which will mismatch with the actually put document.
api::BucketInfo info_with_size_diff(info_before.getChecksum(), info_before.getDocumentCount(), 1u);
- auto delete_cmd = std::make_shared<api::DeleteBucketCommand>(bucket);
+ auto delete_cmd = std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket));
delete_cmd->setBucketInfo(info_with_size_diff);
c.top.sendDown(delete_cmd);
diff --git a/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp b/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
index a71362878df..83d79ab4d77 100644
--- a/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
+++ b/storage/src/tests/persistence/filestorage/singlebucketjointest.cpp
@@ -7,9 +7,12 @@
#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>
LOG_SETUP(".singlebucketjointest");
+using storage::test::makeDocumentBucket;
+
namespace storage {
class SingleBucketJoinTest : public FileStorTestFixture
@@ -37,7 +40,7 @@ SingleBucketJoinTest::testPersistenceCanHandleSingleBucketJoin()
expectOkReply<api::PutReply>(c.top);
c.top.getRepliesOnce();
- auto cmd = std::make_shared<api::JoinBucketsCommand>(targetBucket);
+ auto cmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(targetBucket));
cmd->getSourceBuckets().push_back(sourceBucket);
cmd->getSourceBuckets().push_back(sourceBucket);
diff --git a/storage/src/tests/persistence/legacyoperationhandlertest.cpp b/storage/src/tests/persistence/legacyoperationhandlertest.cpp
index 6ceff0661b1..ff331d44ecd 100644
--- a/storage/src/tests/persistence/legacyoperationhandlertest.cpp
+++ b/storage/src/tests/persistence/legacyoperationhandlertest.cpp
@@ -8,10 +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>
using document::DocumentTypeRepo;
using document::TestDocRepo;
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -62,7 +64,7 @@ LegacyOperationHandlerTest::testMultioperationSingleBodyPut()
vdslib::WritableDocumentList block(getTypeRepo(), &buffer[0], buffer.size());
block.addPut(*doc, api::Timestamp(1234));
- api::MultiOperationCommand cmd(getTypeRepo(), bucketId, 0);
+ api::MultiOperationCommand cmd(getTypeRepo(), makeDocumentBucket(bucketId), 0);
cmd.setOperations(block);
thread->handleMultiOperation(cmd);
@@ -83,7 +85,7 @@ LegacyOperationHandlerTest::testMultioperationSingleRemove()
vdslib::WritableDocumentList block(getTypeRepo(), &buffer[0], buffer.size());
block.addRemove(doc->getId(), spi::Timestamp(1235));
- api::MultiOperationCommand cmd(getTypeRepo(), bucketId, 0);
+ api::MultiOperationCommand cmd(getTypeRepo(), makeDocumentBucket(bucketId), 0);
cmd.setOperations(block);
thread->handleMultiOperation(cmd);
@@ -110,7 +112,7 @@ LegacyOperationHandlerTest::testMultioperationSingleUpdate()
vdslib::WritableDocumentList block(getTypeRepo(), &buffer[0], buffer.size());
block.addUpdate(*update, api::Timestamp(1235));
- api::MultiOperationCommand cmd(getTypeRepo(), bucketId, 0);
+ api::MultiOperationCommand cmd(getTypeRepo(), makeDocumentBucket(bucketId), 0);
cmd.setOperations(block);
thread->handleMultiOperation(cmd);
@@ -135,7 +137,7 @@ LegacyOperationHandlerTest::testMultioperationUpdateNotFound()
vdslib::WritableDocumentList block(getTypeRepo(), &buffer[0], buffer.size());
block.addUpdate(*update, api::Timestamp(1235));
- api::MultiOperationCommand cmd(getTypeRepo(), bucketId, 0);
+ api::MultiOperationCommand cmd(getTypeRepo(), makeDocumentBucket(bucketId), 0);
cmd.setOperations(block);
thread->handleMultiOperation(cmd);
@@ -171,7 +173,7 @@ LegacyOperationHandlerTest::testMultioperationMixedOperations()
api::Timestamp(4568));
block.addPut(*putDoc, api::Timestamp(5678));
- api::MultiOperationCommand cmd(getTypeRepo(), bucketId, 0);
+ api::MultiOperationCommand cmd(getTypeRepo(), makeDocumentBucket(bucketId), 0);
cmd.setOperations(block);
thread->handleMultiOperation(cmd);
diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp
index 0720504f140..3c00a7796ba 100644
--- a/storage/src/tests/persistence/mergehandlertest.cpp
+++ b/storage/src/tests/persistence/mergehandlertest.cpp
@@ -6,12 +6,15 @@
#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/vespalib/objects/nbostream.h>
#include <cmath>
#include <vespa/log/log.h>
LOG_SETUP(".test.persistence.handler.merge");
+using storage::test::makeDocumentBucket;
+
namespace storage {
struct MergeHandlerTest : public SingleDiskPersistenceTestUtils
@@ -264,7 +267,7 @@ MergeHandlerTest::testMergeBucketCommand()
MergeHandler handler(getPersistenceProvider(), getEnv());
LOG(info, "Handle a merge bucket command");
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
cmd.setSourceIndex(1234);
MessageTracker::UP tracker = handler.handleMergeBucket(cmd, *_context);
@@ -291,7 +294,7 @@ MergeHandlerTest::testGetBucketDiffChain(bool midChain)
MergeHandler handler(getPersistenceProvider(), getEnv());
LOG(info, "Verifying that get bucket diff is sent on");
- api::GetBucketDiffCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::GetBucketDiffCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
MessageTracker::UP tracker1 = handler.handleGetBucketDiff(cmd, *_context);
api::StorageMessage::SP replySent = tracker1->getReply();
@@ -335,7 +338,7 @@ MergeHandlerTest::testApplyBucketDiffChain(bool midChain)
MergeHandler handler(getPersistenceProvider(), getEnv());
LOG(info, "Verifying that apply bucket diff is sent on");
- api::ApplyBucketDiffCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::ApplyBucketDiffCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
MessageTracker::UP tracker1 = handler.handleApplyBucketDiff(cmd, *_context);
api::StorageMessage::SP replySent = tracker1->getReply();
@@ -379,7 +382,7 @@ MergeHandlerTest::testMasterMessageFlow()
MergeHandler handler(getPersistenceProvider(), getEnv());
LOG(info, "Handle a merge bucket command");
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
LOG(info, "Check state");
@@ -641,7 +644,7 @@ MergeHandlerTest::testChunkedApplyBucketDiff()
MergeHandler handler(getPersistenceProvider(), getEnv(), maxChunkSize);
LOG(info, "Handle a merge bucket command");
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
std::shared_ptr<api::GetBucketDiffCommand> getBucketDiffCmd(
@@ -729,7 +732,7 @@ MergeHandlerTest::testChunkLimitPartiallyFilledDiff()
setUpChain(MIDDLE);
std::shared_ptr<api::ApplyBucketDiffCommand> applyBucketDiffCmd(
- new api::ApplyBucketDiffCommand(_bucket, _nodes, maxChunkSize));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(_bucket), _nodes, maxChunkSize));
applyBucketDiffCmd->getDiff() = applyDiff;
MergeHandler handler(
@@ -750,7 +753,7 @@ MergeHandlerTest::testMaxTimestamp()
MergeHandler handler(getPersistenceProvider(), getEnv());
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
std::shared_ptr<api::GetBucketDiffCommand> getCmd(
@@ -817,7 +820,7 @@ MergeHandlerTest::createDummyApplyDiff(int timestampOffset,
}
std::shared_ptr<api::ApplyBucketDiffCommand> applyBucketDiffCmd(
- new api::ApplyBucketDiffCommand(_bucket, _nodes, 1024*1024));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(_bucket), _nodes, 1024*1024));
applyBucketDiffCmd->getDiff() = applyDiff;
return applyBucketDiffCmd;
}
@@ -853,7 +856,7 @@ MergeHandlerTest::createDummyGetBucketDiff(int timestampOffset,
}
std::shared_ptr<api::GetBucketDiffCommand> getBucketDiffCmd(
- new api::GetBucketDiffCommand(_bucket, _nodes, 1024*1024));
+ new api::GetBucketDiffCommand(makeDocumentBucket(_bucket), _nodes, 1024*1024));
getBucketDiffCmd->getDiff() = diff;
return getBucketDiffCmd;
}
@@ -895,7 +898,7 @@ MergeHandlerTest::testBucketNotFoundInDb()
{
MergeHandler handler(getPersistenceProvider(), getEnv());
// Send merge for unknown bucket
- api::MergeBucketCommand cmd(document::BucketId(16, 6789), _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(document::BucketId(16, 6789)), _nodes, _maxTimestamp);
MessageTracker::UP tracker = handler.handleMergeBucket(cmd, *_context);
CPPUNIT_ASSERT(tracker->getResult().isBucketDisappearance());
}
@@ -904,7 +907,7 @@ void
MergeHandlerTest::testMergeProgressSafeGuard()
{
MergeHandler handler(getPersistenceProvider(), getEnv());
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
std::shared_ptr<api::GetBucketDiffCommand> getBucketDiffCmd(
@@ -940,7 +943,7 @@ MergeHandlerTest::testSafeGuardNotInvokedWhenHasMaskChanges()
_nodes.push_back(api::MergeBucketCommand::Node(0, false));
_nodes.push_back(api::MergeBucketCommand::Node(1, false));
_nodes.push_back(api::MergeBucketCommand::Node(2, false));
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
std::shared_ptr<api::GetBucketDiffCommand> getBucketDiffCmd(
@@ -988,7 +991,7 @@ MergeHandlerTest::testEntryRemovedAfterGetBucketDiff()
}
setUpChain(BACK);
std::shared_ptr<api::ApplyBucketDiffCommand> applyBucketDiffCmd(
- new api::ApplyBucketDiffCommand(_bucket, _nodes, 1024*1024));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(_bucket), _nodes, 1024*1024));
applyBucketDiffCmd->getDiff() = applyDiff;
MessageTracker::UP tracker = handler.handleApplyBucketDiff(*applyBucketDiffCmd, *_context);
@@ -1083,7 +1086,7 @@ MergeHandlerTest::HandleMergeBucketInvoker::invoke(
MergeHandler& handler,
spi::Context& context)
{
- api::MergeBucketCommand cmd(test._bucket, test._nodes, test._maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(test._bucket), test._nodes, test._maxTimestamp);
handler.handleMergeBucket(cmd, context);
}
@@ -1123,7 +1126,7 @@ MergeHandlerTest::HandleGetBucketDiffInvoker::invoke(
MergeHandler& handler,
spi::Context& context)
{
- api::GetBucketDiffCommand cmd(test._bucket, test._nodes, test._maxTimestamp);
+ api::GetBucketDiffCommand cmd(makeDocumentBucket(test._bucket), test._nodes, test._maxTimestamp);
handler.handleGetBucketDiff(cmd, context);
}
@@ -1212,7 +1215,7 @@ MergeHandlerTest::HandleGetBucketDiffReplyInvoker::beforeInvoke(
MergeHandler& handler,
spi::Context& context)
{
- api::MergeBucketCommand cmd(test._bucket, test._nodes, test._maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(test._bucket), test._nodes, test._maxTimestamp);
handler.handleMergeBucket(cmd, context);
_diffCmd = test.fetchSingleMessage<api::GetBucketDiffCommand>();
}
@@ -1284,7 +1287,7 @@ MergeHandlerTest::HandleApplyBucketDiffReplyInvoker::beforeInvoke(
++_counter;
_stub.clear();
if (getChainPos() == FRONT) {
- api::MergeBucketCommand cmd(test._bucket, test._nodes, test._maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(test._bucket), test._nodes, test._maxTimestamp);
handler.handleMergeBucket(cmd, context);
std::shared_ptr<api::GetBucketDiffCommand> diffCmd(
test.fetchSingleMessage<api::GetBucketDiffCommand>());
@@ -1467,7 +1470,7 @@ MergeHandlerTest::testRemovePutOnExistingTimestamp()
}
std::shared_ptr<api::ApplyBucketDiffCommand> applyBucketDiffCmd(
- new api::ApplyBucketDiffCommand(_bucket, _nodes, 1024*1024));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(_bucket), _nodes, 1024*1024));
applyBucketDiffCmd->getDiff() = applyDiff;
MessageTracker::UP tracker = handler.handleApplyBucketDiff(*applyBucketDiffCmd, *_context);
@@ -1477,7 +1480,7 @@ MergeHandlerTest::testRemovePutOnExistingTimestamp()
tracker->getReply()));
CPPUNIT_ASSERT(applyBucketDiffReply.get());
- api::MergeBucketCommand cmd(_bucket, _nodes, _maxTimestamp);
+ api::MergeBucketCommand cmd(makeDocumentBucket(_bucket), _nodes, _maxTimestamp);
handler.handleMergeBucket(cmd, *_context);
std::shared_ptr<api::GetBucketDiffCommand> getBucketDiffCmd(
diff --git a/storage/src/tests/persistence/persistencequeuetest.cpp b/storage/src/tests/persistence/persistencequeuetest.cpp
index c01a5df22e2..a86cfd38cda 100644
--- a/storage/src/tests/persistence/persistencequeuetest.cpp
+++ b/storage/src/tests/persistence/persistencequeuetest.cpp
@@ -7,9 +7,12 @@
#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>
LOG_SETUP(".persistencequeuetest");
+using storage::test::makeDocumentBucket;
+
namespace storage {
class PersistenceQueueTest : public FileStorTestFixture
@@ -53,7 +56,7 @@ PersistenceQueueTest::createPut(uint64_t bucket, uint64_t docIdx)
document::Document::SP doc(
_node->getTestDocMan().createDocument("foobar", id.str()));
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(document::BucketId(16, bucket), doc, 1234));
+ new api::PutCommand(makeDocumentBucket(document::BucketId(16, bucket)), doc, 1234));
cmd->setAddress(api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 0));
return cmd;
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index 6be021a549c..d8df03602ef 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -3,6 +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/persistence/dummyimpl/dummypersistence.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/document/update/assignvalueupdate.h>
@@ -12,6 +13,7 @@
using document::DocumentType;
using storage::framework::defaultimplementation::AllocationLogic;
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -113,7 +115,7 @@ PersistenceTestUtils::schedulePut(
location, timestamp, minSize, maxSize));
std::shared_ptr<api::StorageMessage> msg(
new api::PutCommand(
- document::BucketId(16, location), doc, timestamp));
+ makeDocumentBucket(document::BucketId(16, location)), doc, timestamp));
fsHandler().schedule(msg, disk);
return doc;
}
diff --git a/storage/src/tests/persistence/persistencethread_splittest.cpp b/storage/src/tests/persistence/persistencethread_splittest.cpp
index df43b714dcb..50fedee1d0a 100644
--- a/storage/src/tests/persistence/persistencethread_splittest.cpp
+++ b/storage/src/tests/persistence/persistencethread_splittest.cpp
@@ -5,8 +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>
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
namespace {
@@ -201,7 +203,7 @@ PersistenceThread_SplitTest::doTest(SplitCase splitCase)
getNode().getStateUpdater().setClusterState(
lib::ClusterState::CSP(
new lib::ClusterState("distributor:1 storage:1")));
- api::SplitBucketCommand cmd(document::BucketId(currentSplitLevel, 1));
+ api::SplitBucketCommand cmd(makeDocumentBucket(document::BucketId(currentSplitLevel, 1)));
cmd.setMaxSplitBits(maxBits);
cmd.setMinSplitBits(minBits);
cmd.setMinByteSize(maxSize);
diff --git a/storage/src/tests/persistence/processalltest.cpp b/storage/src/tests/persistence/processalltest.cpp
index e38505c2768..4b300c12dd3 100644
--- a/storage/src/tests/persistence/processalltest.cpp
+++ b/storage/src/tests/persistence/processalltest.cpp
@@ -6,6 +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>
+
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -41,7 +44,7 @@ ProcessAllHandlerTest::testRemoveLocation()
doPut(4, spi::Timestamp(1234));
doPut(4, spi::Timestamp(2345));
- api::RemoveLocationCommand removeLocation("id.user == 4", bucketId);
+ api::RemoveLocationCommand removeLocation("id.user == 4", makeDocumentBucket(bucketId));
ProcessAllHandler handler(getEnv(), getPersistenceProvider());
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
handler.handleRemoveLocation(removeLocation, context);
@@ -67,7 +70,7 @@ ProcessAllHandlerTest::testRemoveLocationDocumentSubset()
}
api::RemoveLocationCommand
- removeLocation("testdoctype1.headerval % 2 == 0", bucketId);
+ removeLocation("testdoctype1.headerval % 2 == 0", makeDocumentBucket(bucketId));
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
handler.handleRemoveLocation(removeLocation, context);
@@ -92,7 +95,7 @@ ProcessAllHandlerTest::testRemoveLocationUnknownDocType()
doPut(4, spi::Timestamp(1234));
api::RemoveLocationCommand
- removeLocation("unknowndoctype.headerval % 2 == 0", bucketId);
+ removeLocation("unknowndoctype.headerval % 2 == 0", makeDocumentBucket(bucketId));
bool gotException = false;
try {
@@ -115,7 +118,7 @@ ProcessAllHandlerTest::testRemoveLocationBogusSelection()
document::BucketId bucketId(16, 4);
doPut(4, spi::Timestamp(1234));
- api::RemoveLocationCommand removeLocation("id.bogus != badgers", bucketId);
+ api::RemoveLocationCommand removeLocation("id.bogus != badgers", makeDocumentBucket(bucketId));
bool gotException = false;
try {
@@ -145,7 +148,7 @@ ProcessAllHandlerTest::testStat()
doPut(doc, bucketId, spi::Timestamp(100 + i), 0);
}
- api::StatBucketCommand statBucket(bucketId,
+ api::StatBucketCommand statBucket(makeDocumentBucket(bucketId),
"testdoctype1.headerval % 2 == 0");
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
MessageTracker::UP tracker = handler.handleStatBucket(statBucket, context);
@@ -184,7 +187,7 @@ ProcessAllHandlerTest::testStatWithRemove()
true);
}
- api::StatBucketCommand statBucket(bucketId, "true");
+ api::StatBucketCommand statBucket(makeDocumentBucket(bucketId), "true");
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
MessageTracker::UP tracker = handler.handleStatBucket(statBucket, context);
@@ -233,7 +236,7 @@ ProcessAllHandlerTest::testStatWholeBucket()
doPut(doc, bucketId, spi::Timestamp(100 + i), 0);
}
- api::StatBucketCommand statBucket(bucketId, "true");
+ api::StatBucketCommand statBucket(makeDocumentBucket(bucketId), "true");
spi::Context context(documentapi::LoadType::DEFAULT, 0, 0);
MessageTracker::UP tracker = handler.handleStatBucket(statBucket, context);
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 2c1c15dee87..2332596263b 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -3,6 +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/documentapi/messagebus/messages/testandsetcondition.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/document/update/assignvalueupdate.h>
@@ -14,6 +15,7 @@ using std::shared_ptr;
using namespace std::string_literals;
using storage::spi::test::makeBucket;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -109,7 +111,7 @@ void TestAndSetTest::conditional_put_not_executed_on_condition_mismatch()
// Conditionally replace document, but fail due to lack of woofy dog
api::Timestamp timestampTwo = 1;
- api::PutCommand putTwo(BUCKET_ID, testDoc, timestampTwo);
+ api::PutCommand putTwo(makeDocumentBucket(BUCKET_ID), testDoc, timestampTwo);
setTestCondition(putTwo);
CPPUNIT_ASSERT(thread->handlePut(putTwo)->getResult() == api::ReturnCode::Result::TEST_AND_SET_CONDITION_FAILED);
@@ -129,7 +131,7 @@ void TestAndSetTest::conditional_put_executed_on_condition_match()
// Conditionally replace document with updated version, succeed in doing so
api::Timestamp timestampTwo = 1;
- api::PutCommand putTwo(BUCKET_ID, testDoc, timestampTwo);
+ api::PutCommand putTwo(makeDocumentBucket(BUCKET_ID), testDoc, timestampTwo);
setTestCondition(putTwo);
CPPUNIT_ASSERT(thread->handlePut(putTwo)->getResult() == api::ReturnCode::Result::OK);
@@ -150,7 +152,7 @@ void TestAndSetTest::conditional_remove_not_executed_on_condition_mismatch()
// Conditionally remove document, fail in doing so
api::Timestamp timestampTwo = 1;
- api::RemoveCommand remove(BUCKET_ID, testDocId, timestampTwo);
+ api::RemoveCommand remove(makeDocumentBucket(BUCKET_ID), testDocId, timestampTwo);
setTestCondition(remove);
CPPUNIT_ASSERT(thread->handleRemove(remove)->getResult() == api::ReturnCode::Result::TEST_AND_SET_CONDITION_FAILED);
@@ -170,7 +172,7 @@ void TestAndSetTest::conditional_remove_executed_on_condition_match()
// Conditionally remove document, succeed in doing so
api::Timestamp timestampTwo = 1;
- api::RemoveCommand remove(BUCKET_ID, testDocId, timestampTwo);
+ api::RemoveCommand remove(makeDocumentBucket(BUCKET_ID), testDocId, timestampTwo);
setTestCondition(remove);
CPPUNIT_ASSERT(thread->handleRemove(remove)->getResult() == api::ReturnCode::Result::OK);
@@ -191,7 +193,7 @@ std::unique_ptr<api::UpdateCommand> TestAndSetTest::conditional_update_test(
fieldUpdate.addUpdate(document::AssignValueUpdate(NEW_CONTENT));
docUpdate->addUpdate(fieldUpdate);
- auto updateUp = std::make_unique<api::UpdateCommand>(BUCKET_ID, docUpdate, timestampTwo);
+ auto updateUp = std::make_unique<api::UpdateCommand>(makeDocumentBucket(BUCKET_ID), docUpdate, timestampTwo);
setTestCondition(*updateUp);
return updateUp;
}
@@ -228,7 +230,7 @@ void TestAndSetTest::invalid_document_selection_should_fail()
// Conditionally replace nonexisting document
// Fail early since document selection is invalid
api::Timestamp timestamp = 0;
- api::PutCommand put(BUCKET_ID, testDoc, timestamp);
+ api::PutCommand put(makeDocumentBucket(BUCKET_ID), testDoc, timestamp);
put.setCondition(documentapi::TestAndSetCondition("bjarne"));
CPPUNIT_ASSERT(thread->handlePut(put)->getResult() == api::ReturnCode::Result::ILLEGAL_PARAMETERS);
@@ -240,7 +242,7 @@ void TestAndSetTest::non_existing_document_should_fail()
// Conditionally replace nonexisting document
// Fail since no document exists to match with test and set
api::Timestamp timestamp = 0;
- api::PutCommand put(BUCKET_ID, testDoc, timestamp);
+ api::PutCommand put(makeDocumentBucket(BUCKET_ID), testDoc, timestamp);
setTestCondition(put);
thread->handlePut(put);
@@ -254,7 +256,7 @@ void TestAndSetTest::document_with_no_type_should_fail()
// Fail since no document exists to match with test and set
api::Timestamp timestamp = 0;
document::DocumentId legacyDocId("doc:mail:3619.html");
- api::RemoveCommand remove(BUCKET_ID, legacyDocId, timestamp);
+ api::RemoveCommand remove(makeDocumentBucket(BUCKET_ID), legacyDocId, timestamp);
setTestCondition(remove);
auto code = thread->handleRemove(remove)->getResult();
@@ -281,7 +283,7 @@ TestAndSetTest::createTestDocument()
document::Document::SP TestAndSetTest::retrieveTestDocument()
{
- api::GetCommand get(BUCKET_ID, testDocId, "[all]");
+ api::GetCommand get(makeDocumentBucket(BUCKET_ID), testDocId, "[all]");
auto tracker = thread->handleGet(get);
CPPUNIT_ASSERT(tracker->getResult() == api::ReturnCode::Result::OK);
@@ -301,7 +303,7 @@ void TestAndSetTest::putTestDocument(bool matchingHeader, api::Timestamp timesta
testDoc->setValue(testDoc->getField("hstringval"), MATCHING_HEADER);
}
- api::PutCommand put(BUCKET_ID, testDoc, timestamp);
+ api::PutCommand put(makeDocumentBucket(BUCKET_ID), testDoc, timestamp);
thread->handlePut(put);
}
diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp
index 7a668971857..44d2dc889ab 100644
--- a/storage/src/tests/storageserver/bouncertest.cpp
+++ b/storage/src/tests/storageserver/bouncertest.cpp
@@ -8,9 +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/storageapi/message/persistence.h>
#include <vespa/config/common/exceptions.h>
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -110,7 +112,7 @@ BouncerTest::createDummyFeedMessage(api::Timestamp timestamp,
api::StorageMessage::Priority priority)
{
auto cmd = std::make_shared<api::RemoveCommand>(
- document::BucketId(0),
+ makeDocumentBucket(document::BucketId(0)),
document::DocumentId("doc:foo:bar"),
timestamp);
cmd->setPriority(priority);
@@ -165,7 +167,7 @@ BouncerTest::testAllowNotifyBucketChangeEvenWhenDistributorDown()
document::BucketId bucket(16, 1234);
api::BucketInfo info(0x1, 0x2, 0x3);
- auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(bucket, info);
+ auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(makeDocumentBucket(bucket), info);
_upper->sendDown(cmd);
CPPUNIT_ASSERT_EQUAL(size_t(0), _upper->getNumReplies());
@@ -246,7 +248,7 @@ BouncerTest::readOnlyOperationsAreNotRejected()
// StatBucket is an external operation, but it's not a mutating operation
// and should therefore not be blocked.
auto cmd = std::make_shared<api::StatBucketCommand>(
- document::BucketId(16, 5), "");
+ makeDocumentBucket(document::BucketId(16, 5)), "");
cmd->setPriority(Priority(2));
_upper->sendDown(cmd);
assertMessageNotBounced();
@@ -258,7 +260,7 @@ BouncerTest::internalOperationsAreNotRejected()
configureRejectionThreshold(Priority(1));
document::BucketId bucket(16, 1234);
api::BucketInfo info(0x1, 0x2, 0x3);
- auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(bucket, info);
+ auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(makeDocumentBucket(bucket), info);
cmd->setPriority(Priority(2));
_upper->sendDown(cmd);
assertMessageNotBounced();
diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
index e99e97a1e88..53d41051fae 100644
--- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
+++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
@@ -13,8 +13,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/storage/storageserver/changedbucketownershiphandler.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
class ChangedBucketOwnershipHandlerTest : public CppUnit::TestFixture
@@ -79,8 +82,8 @@ class ChangedBucketOwnershipHandlerTest : public CppUnit::TestFixture
const lib::ClusterState& state,
const document::BucketId& lastId) const;
- document::BucketId getBucketToAbort() const;
- document::BucketId getBucketToAllow() const;
+ document::Bucket getBucketToAbort() const;
+ document::Bucket getBucketToAllow() const;
void sendAndExpectAbortedCreateBucket(uint16_t fromDistributorIndex);
@@ -383,7 +386,7 @@ ChangedBucketOwnershipHandlerTest::sendAndExpectAbortedCreateBucket(
uint16_t fromDistributorIndex)
{
document::BucketId bucket(16, 6786);
- auto msg = std::make_shared<api::CreateBucketCommand>(bucket);
+ auto msg = std::make_shared<api::CreateBucketCommand>(makeDocumentBucket(bucket));
msg->setSourceIndex(fromDistributorIndex);
_top->sendDown(msg);
@@ -450,22 +453,22 @@ ChangedBucketOwnershipHandlerTest::changeAbortsMessage(MsgParams&&... params)
* Returns a bucket that is not owned by the sending distributor (1). More
* specifically, it returns a bucket that is owned by distributor 2.
*/
-document::BucketId
+document::Bucket
ChangedBucketOwnershipHandlerTest::getBucketToAbort() const
{
lib::ClusterState state(getDefaultTestClusterState());
- return nextOwnedBucket(2, state, document::BucketId());
+ return makeDocumentBucket(nextOwnedBucket(2, state, document::BucketId()));
}
/**
* Returns a bucket that _is_ owned by distributor 1 and should thus be
* allowed through.
*/
-document::BucketId
+document::Bucket
ChangedBucketOwnershipHandlerTest::getBucketToAllow() const
{
lib::ClusterState state(getDefaultTestClusterState());
- return nextOwnedBucket(1, state, document::BucketId());
+ return makeDocumentBucket(nextOwnedBucket(1, state, document::BucketId()));
}
void
diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp
index c9b3dfeb229..4f9a68a69c2 100644
--- a/storage/src/tests/storageserver/communicationmanagertest.cpp
+++ b/storage/src/tests/storageserver/communicationmanagertest.cpp
@@ -10,8 +10,11 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
#include <tests/common/testhelper.h>
+#include <tests/common/make_document_bucket.h>
#include <vespa/vdstestlib/cppunit/macros.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
struct CommunicationManagerTest : public CppUnit::TestFixture {
@@ -28,7 +31,7 @@ struct CommunicationManagerTest : public CppUnit::TestFixture {
std::shared_ptr<api::StorageCommand> createDummyCommand(
api::StorageMessage::Priority priority)
{
- auto cmd = std::make_shared<api::GetCommand>(document::BucketId(0),
+ auto cmd = std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)),
document::DocumentId("doc::mydoc"),
"[all]");
cmd->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1));
@@ -78,7 +81,7 @@ void CommunicationManagerTest::testSimple()
// Send a message through from distributor to storage
std::shared_ptr<api::StorageCommand> cmd(
new api::GetCommand(
- document::BucketId(0), document::DocumentId("doc::mydoc"), "[all]"));
+ makeDocumentBucket(document::BucketId(0)), document::DocumentId("doc::mydoc"), "[all]"));
cmd->setAddress(api::StorageMessageAddress(
"storage", lib::NodeType::STORAGE, 1));
distributorLink->sendUp(cmd);
diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp
index 3830d3b71cb..ff261e88922 100644
--- a/storage/src/tests/storageserver/documentapiconvertertest.cpp
+++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp
@@ -13,6 +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>
using document::DataType;
using document::DocIdString;
@@ -20,6 +21,7 @@ using document::Document;
using document::DocumentId;
using document::DocumentTypeRepo;
using document::readDocumenttypesConfig;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -374,7 +376,7 @@ DocumentApiConverterTest::testMultiOperation()
}
{
- api::MultiOperationCommand mocmd(_repo, bucketId, 10000, false);
+ api::MultiOperationCommand mocmd(_repo, makeDocumentBucket(bucketId), 10000, false);
mocmd.getOperations().addPut(*doc, 100);
// Convert it to documentapi
diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp
index aa0c0667b0d..17503200d10 100644
--- a/storage/src/tests/storageserver/mergethrottlertest.cpp
+++ b/storage/src/tests/storageserver/mergethrottlertest.cpp
@@ -6,6 +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/storage/storageserver/mergethrottler.h>
#include <vespa/storage/persistence/messages.h>
#include <vespa/storageapi/message/bucket.h>
@@ -21,6 +22,7 @@
using namespace document;
using namespace storage::api;
+using storage::test::makeDocumentBucket;
namespace storage {
@@ -99,7 +101,7 @@ struct MergeBuilder {
n.emplace_back(node, source_only);
}
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(_bucket, n, _maxTimestamp,
+ new MergeBucketCommand(makeDocumentBucket(_bucket), n, _maxTimestamp,
_clusterStateVersion, _chain));
StorageMessageAddress address("storage", lib::NodeType::STORAGE, _nodes[0]);
cmd->setAddress(address);
@@ -327,7 +329,7 @@ MergeThrottlerTest::testChain()
}
//std::cout << "\n";
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, UINT_MAX, 123));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, UINT_MAX, 123));
cmd->setPriority(7);
cmd->setTimeout(54321);
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 0);
@@ -486,7 +488,7 @@ MergeThrottlerTest::testWithSourceOnlyNode()
nodes.push_back(2);
nodes.push_back(MergeBucketCommand::Node(1, true));
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, UINT_MAX, 123));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, UINT_MAX, 123));
cmd->setAddress(address);
_topLinks[0]->sendDown(cmd);
@@ -536,7 +538,7 @@ MergeThrottlerTest::test42DistributorBehavior()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, 1234));
// Send to node 1, which is not the lowest index
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 1);
@@ -579,7 +581,7 @@ MergeThrottlerTest::test42DistributorBehaviorDoesNotTakeOwnership()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, 1234));
// Send to node 1, which is not the lowest index
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 1);
@@ -637,7 +639,7 @@ MergeThrottlerTest::testEndOfChainExecutionDoesNotTakeOwnership()
chain.push_back(0);
chain.push_back(1);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, 1234, 1, chain));
// Send to last node, which is not the lowest index
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 3);
@@ -692,7 +694,7 @@ MergeThrottlerTest::testResendHandling()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, 1234));
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 1);
@@ -753,7 +755,7 @@ MergeThrottlerTest::testPriorityQueuing()
CPPUNIT_ASSERT(maxPending >= 4u);
for (std::size_t i = 0; i < maxPending; ++i) {
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234));
cmd->setPriority(100);
_topLinks[0]->sendDown(cmd);
}
@@ -767,7 +769,7 @@ MergeThrottlerTest::testPriorityQueuing()
int sortedPris[4] = { 120, 150, 200, 240 };
for (int i = 0; i < 4; ++i) {
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, i), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, i)), nodes, 1234));
cmd->setPriority(priorities[i]);
_topLinks[0]->sendDown(cmd);
}
@@ -815,7 +817,7 @@ MergeThrottlerTest::testCommandInQueueDuplicateOfKnownMerge()
nodes.push_back(2 + i);
nodes.push_back(5 + i);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234));
cmd->setPriority(100 - i);
_topLinks[0]->sendDown(cmd);
}
@@ -831,7 +833,7 @@ MergeThrottlerTest::testCommandInQueueDuplicateOfKnownMerge()
nodes.push_back(12);
nodes.push_back(123);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf000feee), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf000feee)), nodes, 1234));
_topLinks[0]->sendDown(cmd);
}
{
@@ -840,7 +842,7 @@ MergeThrottlerTest::testCommandInQueueDuplicateOfKnownMerge()
nodes.push_back(124); // Different node set doesn't matter
nodes.push_back(14);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf000feee), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf000feee)), nodes, 1234));
_topLinks[0]->sendDown(cmd);
}
@@ -901,7 +903,7 @@ MergeThrottlerTest::testInvalidReceiverNode()
nodes.push_back(5);
nodes.push_back(9);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baaaa), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baaaa)), nodes, 1234));
// Send to node with index 0
_topLinks[0]->sendDown(cmd);
@@ -930,7 +932,7 @@ MergeThrottlerTest::testForwardQueuedMerge()
nodes.push_back(2 + i);
nodes.push_back(5 + i);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234));
cmd->setPriority(100 - i);
_topLinks[0]->sendDown(cmd);
}
@@ -1003,7 +1005,7 @@ MergeThrottlerTest::testExecuteQueuedMerge()
nodes.push_back(5 + i);
nodes.push_back(7 + i);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234, 1));
cmd->setPriority(250 - i + 5);
topLink.sendDown(cmd);
}
@@ -1021,7 +1023,7 @@ MergeThrottlerTest::testExecuteQueuedMerge()
std::vector<uint16_t> chain;
chain.push_back(0);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0x1337), nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0x1337)), nodes, 1234, 1, chain));
cmd->setPriority(0);
topLink.sendDown(cmd);
}
@@ -1092,7 +1094,7 @@ MergeThrottlerTest::testFlush()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234, 1));
_topLinks[0]->sendDown(cmd);
}
@@ -1138,7 +1140,7 @@ MergeThrottlerTest::testUnseenMergeWithNodeInChain()
chain.push_back(5);
chain.push_back(9);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xdeadbeef), nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xdeadbeef)), nodes, 1234, 1, chain));
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 9);
@@ -1162,7 +1164,7 @@ MergeThrottlerTest::testUnseenMergeWithNodeInChain()
_throttlers[0]->getThrottlePolicy().getMaxPendingCount());
for (std::size_t i = 0; i < maxPending; ++i) {
std::shared_ptr<MergeBucketCommand> fillCmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234));
_topLinks[0]->sendDown(fillCmd);
}
}
@@ -1190,7 +1192,7 @@ MergeThrottlerTest::testMergeWithNewerClusterStateFlushesOutdatedQueued()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234, 1));
ids.push_back(cmd->getMsgId());
_topLinks[0]->sendDown(cmd);
}
@@ -1206,7 +1208,7 @@ MergeThrottlerTest::testMergeWithNewerClusterStateFlushesOutdatedQueued()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0x12345678), nodes, 1234, 2));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0x12345678)), nodes, 1234, 2));
ids.push_back(cmd->getMsgId());
_topLinks[0]->sendDown(cmd);
}
@@ -1241,7 +1243,7 @@ MergeThrottlerTest::testUpdatedClusterStateFlushesOutdatedQueued()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234, 2));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234, 2));
ids.push_back(cmd->getMsgId());
_topLinks[0]->sendDown(cmd);
}
@@ -1284,7 +1286,7 @@ MergeThrottlerTest::test42MergesDoNotTriggerFlush()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00baa00 + i), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00baa00 + i)), nodes, 1234, 1));
_topLinks[0]->sendDown(cmd);
}
@@ -1307,7 +1309,7 @@ MergeThrottlerTest::test42MergesDoNotTriggerFlush()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xbaaadbed), nodes, 1234, 0));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xbaaadbed)), nodes, 1234, 0));
_topLinks[0]->sendDown(cmd);
}
@@ -1334,7 +1336,7 @@ MergeThrottlerTest::testOutdatedClusterStateMergesAreRejectedOnArrival()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xfeef00), nodes, 1234, 9));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xfeef00)), nodes, 1234, 9));
_topLinks[0]->sendDown(cmd);
}
@@ -1364,7 +1366,7 @@ MergeThrottlerTest::testUnknownMergeWithSelfInChain()
std::vector<uint16_t> chain;
chain.push_back(0);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(bid, nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(bid), nodes, 1234, 1, chain));
StorageMessageAddress address("storage", lib::NodeType::STORAGE, 1);
@@ -1391,7 +1393,7 @@ MergeThrottlerTest::testBusyReturnedOnFullQueue()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf00000 + i), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf00000 + i)), nodes, 1234, 1));
_topLinks[0]->sendDown(cmd);
}
@@ -1408,7 +1410,7 @@ MergeThrottlerTest::testBusyReturnedOnFullQueue()
nodes.push_back(1);
nodes.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xf000baaa), nodes, 1234, 1));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xf000baaa)), nodes, 1234, 1));
_topLinks[0]->sendDown(cmd);
}
_topLinks[0]->waitForMessage(MessageType::MERGEBUCKET_REPLY, _messageWaitTime);
@@ -1441,7 +1443,7 @@ MergeThrottlerTest::testBrokenCycle()
std::vector<uint16_t> chain;
chain.push_back(0);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xfeef00), nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xfeef00)), nodes, 1234, 1, chain));
_topLinks[1]->sendDown(cmd);
}
@@ -1456,7 +1458,7 @@ MergeThrottlerTest::testBrokenCycle()
chain.push_back(1);
chain.push_back(2);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xfeef00), nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xfeef00)), nodes, 1234, 1, chain));
_topLinks[1]->sendDown(cmd);
}
@@ -1491,7 +1493,7 @@ MergeThrottlerTest::testBrokenCycle()
std::vector<uint16_t> chain;
chain.push_back(0);
std::shared_ptr<MergeBucketCommand> cmd(
- new MergeBucketCommand(BucketId(32, 0xfeef00), nodes, 1234, 1, chain));
+ new MergeBucketCommand(makeDocumentBucket(BucketId(32, 0xfeef00)), nodes, 1234, 1, chain));
_topLinks[1]->sendDown(cmd);
}
@@ -1521,7 +1523,7 @@ MergeThrottlerTest::testGetBucketDiffCommandNotInActiveSetIsRejected()
document::BucketId bucket(16, 1234);
std::vector<api::GetBucketDiffCommand::Node> nodes;
std::shared_ptr<api::GetBucketDiffCommand> getDiffCmd(
- new api::GetBucketDiffCommand(bucket, nodes, api::Timestamp(1234)));
+ new api::GetBucketDiffCommand(makeDocumentBucket(bucket), nodes, api::Timestamp(1234)));
sendAndExpectReply(getDiffCmd,
api::MessageType::GETBUCKETDIFF_REPLY,
@@ -1535,7 +1537,7 @@ MergeThrottlerTest::testApplyBucketDiffCommandNotInActiveSetIsRejected()
document::BucketId bucket(16, 1234);
std::vector<api::GetBucketDiffCommand::Node> nodes;
std::shared_ptr<api::ApplyBucketDiffCommand> applyDiffCmd(
- new api::ApplyBucketDiffCommand(bucket, nodes, api::Timestamp(1234)));
+ new api::ApplyBucketDiffCommand(makeDocumentBucket(bucket), nodes, api::Timestamp(1234)));
sendAndExpectReply(applyDiffCmd,
api::MessageType::APPLYBUCKETDIFF_REPLY,
@@ -1571,7 +1573,7 @@ MergeThrottlerTest::testNewClusterStateAbortsAllOutdatedActiveMerges()
// Trying to diff the bucket should now fail
{
std::shared_ptr<api::GetBucketDiffCommand> getDiffCmd(
- new api::GetBucketDiffCommand(bucket, {}, api::Timestamp(123)));
+ new api::GetBucketDiffCommand(makeDocumentBucket(bucket), {}, api::Timestamp(123)));
sendAndExpectReply(getDiffCmd,
api::MessageType::GETBUCKETDIFF_REPLY,
diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp
index 3f1e9b69963..017da4e4904 100644
--- a/storage/src/tests/visiting/visitormanagertest.cpp
+++ b/storage/src/tests/visiting/visitormanagertest.cpp
@@ -12,6 +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 <tests/storageserver/testvisitormessagesession.h>
#include <vespa/documentapi/messagebus/messages/multioperationmessage.h>
#include <vespa/documentapi/messagebus/messages/putdocumentmessage.h>
@@ -19,6 +20,8 @@
#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/util/exceptions.h>
+using storage::test::makeDocumentBucket;
+
namespace storage {
namespace {
typedef std::vector<api::StorageMessage::SP> msg_ptr_vector;
@@ -182,7 +185,7 @@ VisitorManagerTest::initializeTest()
document::BucketId bid(16, i);
std::shared_ptr<api::CreateBucketCommand> cmd(
- new api::CreateBucketCommand(bid));
+ new api::CreateBucketCommand(makeDocumentBucket(bid)));
cmd->setAddress(address);
cmd->setSourceIndex(0);
_top->sendDown(cmd);
@@ -199,7 +202,7 @@ VisitorManagerTest::initializeTest()
document::BucketId bid(16, i);
std::shared_ptr<api::PutCommand> cmd(
- new api::PutCommand(bid, _documents[i], i+1));
+ new api::PutCommand(makeDocumentBucket(bid), _documents[i], i+1));
cmd->setAddress(address);
_top->sendDown(cmd);
_top->waitForMessages(1, 60);
@@ -224,7 +227,7 @@ VisitorManagerTest::addSomeRemoves(bool removeAll)
document::BucketId bid(16, i % 10);
std::shared_ptr<api::RemoveCommand> cmd(
new api::RemoveCommand(
- bid, _documents[i]->getId(), clock.getTimeInMicros().getTime() + docCount + i + 1));
+ makeDocumentBucket(bid), _documents[i]->getId(), clock.getTimeInMicros().getTime() + docCount + i + 1));
cmd->setAddress(address);
_top->sendDown(cmd);
_top->waitForMessages(1, 60);