summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-09 12:24:58 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-09 12:24:58 +0000
commitb8d01612189d2627c21f838a756340c610a3f728 (patch)
tree4a44db5bdf600d19cf1f670e0b21833e89a4ffe8 /storage
parentf4be22bb9c8dd210e4b4e3ffd7c167751a4c5700 (diff)
Remove the use and testing of legacy groupdoc/userdoc/orderdoc document ids.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/bucketdb/bucketmanagertest.cpp4
-rw-r--r--storage/src/tests/distributor/distributortest.cpp2
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp14
-rw-r--r--storage/src/tests/distributor/pendingmessagetrackertest.cpp10
-rw-r--r--storage/src/tests/distributor/putoperationtest.cpp4
-rw-r--r--storage/src/tests/distributor/visitoroperationtest.cpp251
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp84
-rw-r--r--storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp6
-rw-r--r--storage/src/tests/visiting/visitormanagertest.cpp25
-rw-r--r--storage/src/tests/visiting/visitortest.cpp2
10 files changed, 64 insertions, 338 deletions
diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp
index e05648c62a2..11f5ec70014 100644
--- a/storage/src/tests/bucketdb/bucketmanagertest.cpp
+++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp
@@ -255,7 +255,7 @@ BucketManagerTest::wasBlockedDueToLastModified(api::StorageMessage* msg,
TEST_F(BucketManagerTest, remove_last_modified_ok) {
EXPECT_FALSE(wasBlockedDueToLastModified(
new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 1)),
- document::DocumentId("userdoc:m:1:foo"),
+ document::DocumentId("id:m:test:n=1:foo"),
api::Timestamp(1235)),
1235));
}
@@ -264,7 +264,7 @@ TEST_F(BucketManagerTest, remove_last_modified_ok) {
TEST_F(BucketManagerTest, remove_last_modified_failed) {
EXPECT_TRUE(wasBlockedDueToLastModified(
new api::RemoveCommand(makeDocumentBucket(document::BucketId(16, 1)),
- document::DocumentId("userdoc:m:1:foo"),
+ document::DocumentId("id:m:test:n=1:foo"),
api::Timestamp(1233)),
1233));
}
diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp
index dfc67fd6f5a..637c214033d 100644
--- a/storage/src/tests/distributor/distributortest.cpp
+++ b/storage/src/tests/distributor/distributortest.cpp
@@ -193,7 +193,7 @@ TEST_F(DistributorTest, operation_generation) {
EXPECT_EQ("Remove", testOp(std::make_shared<api::RemoveCommand>(
makeDocumentBucket(bid),
- document::DocumentId("userdoc:m:1:foo"),
+ document::DocumentId("id:m:test:n=1:foo"),
api::Timestamp(1234))));
auto cmd = std::make_shared<api::CreateVisitorCommand>(makeBucketSpace(), "foo", "bar", "");
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index 88e133cc010..600e56faf31 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -92,19 +92,19 @@ TEST_F(ExternalOperationHandlerTest, bucket_split_mask) {
EXPECT_EQ(document::BucketId(16, 0xffff),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0xffff))
+ vespalib::make_string("id:ns:test:n=%d::", 0xffff))
).stripUnused());
EXPECT_EQ(document::BucketId(16, 0),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0x10000))
+ vespalib::make_string("id:ns:test:n=%d::", 0x10000))
).stripUnused());
EXPECT_EQ(document::BucketId(16, 0xffff),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0xffff))
+ vespalib::make_string("id:ns:test:n=%d::", 0xffff))
).stripUnused());
EXPECT_EQ(document::BucketId(16, 0x100),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0x100))
+ vespalib::make_string("id:ns:test:n=%d::", 0x100))
).stripUnused());
close();
}
@@ -113,11 +113,11 @@ TEST_F(ExternalOperationHandlerTest, bucket_split_mask) {
createLinks();
EXPECT_EQ(document::BucketId(20, 0x11111),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0x111111))
+ vespalib::make_string("id:ns:test:n=%d::", 0x111111))
).stripUnused());
EXPECT_EQ(document::BucketId(20, 0x22222),
getExternalOperationHandler().getBucketId(document::DocumentId(
- vespalib::make_string("userdoc:ns:%d::", 0x222222))
+ vespalib::make_string("id:ns:test:n=%d::", 0x222222))
).stripUnused());
}
}
@@ -161,7 +161,7 @@ ExternalOperationHandlerTest::makeGetCommand(const vespalib::string& id) const {
std::shared_ptr<api::GetCommand>
ExternalOperationHandlerTest::makeGetCommandForUser(uint64_t id) const {
- DocumentId docId(document::UserDocIdString(vespalib::make_string("userdoc:foo:%" PRIu64 ":bar", id)));
+ DocumentId docId(vespalib::make_string("id:foo:test:n=%" PRIu64 ":bar", id));
return std::make_shared<api::GetCommand>(makeDocumentBucket(document::BucketId(0)), docId, "[all]");
}
diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
index f79b809de65..a4a883d7059 100644
--- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp
+++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp
@@ -150,7 +150,7 @@ TEST_F(PendingMessageTrackerTest, simple) {
auto remove = std::make_shared<api::RemoveCommand>(
makeDocumentBucket(document::BucketId(16, 1234)),
- document::DocumentId("userdoc:footype:1234:foo"), 1001);
+ document::DocumentId("id:footype:testdoc:n=1234:foo"), 1001);
remove->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0));
tracker.insert(remove);
@@ -182,7 +182,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker)
{
for (uint32_t i = 0; i < 4; i++) {
std::ostringstream ost;
- ost << "userdoc:footype:1234:" << i;
+ ost << "id:footype:testdoc:n=1234:" << i;
auto remove = std::make_shared<api::RemoveCommand>(
makeDocumentBucket(document::BucketId(16, 1234)),
document::DocumentId(ost.str()), 1000 + i);
@@ -192,7 +192,7 @@ PendingMessageTrackerTest::insertMessages(PendingMessageTracker& tracker)
for (uint32_t i = 0; i < 4; i++) {
std::ostringstream ost;
- ost << "userdoc:footype:4567:" << i;
+ ost << "id:footype:testdoc:n=4567:" << i;
auto remove = std::make_shared<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);
@@ -322,7 +322,7 @@ TEST_F(PendingMessageTrackerTest, get_pending_message_types) {
document::BucketId bid(16, 1234);
auto remove = std::make_shared<api::RemoveCommand>(makeDocumentBucket(bid),
- document::DocumentId("userdoc:footype:1234:foo"), 1001);
+ document::DocumentId("id:footype:testdoc:n=1234:foo"), 1001);
remove->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 0));
tracker.insert(remove);
@@ -357,7 +357,7 @@ TEST_F(PendingMessageTrackerTest, has_pending_message) {
{
auto remove = std::make_shared<api::RemoveCommand>(makeDocumentBucket(bid),
- document::DocumentId("userdoc:footype:1234:foo"), 1001);
+ document::DocumentId("id:footype:testdoc:n=1234:foo"), 1001);
remove->setAddress(api::StorageMessageAddress("storage", lib::NodeType::STORAGE, 1));
tracker.insert(remove);
}
diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp
index d56ca69d52f..99c6ec3d71e 100644
--- a/storage/src/tests/distributor/putoperationtest.cpp
+++ b/storage/src/tests/distributor/putoperationtest.cpp
@@ -414,7 +414,7 @@ TEST_F(PutOperationTest, no_storage_nodes) {
TEST_F(PutOperationTest, update_correct_bucket_on_remapped_put) {
setupDistributor(2, 2, "storage:2 distributor:1");
- auto doc = std::make_shared<Document>(doc_type(), DocumentId(UserDocIdString("userdoc:test:13:uri")));
+ auto doc = std::make_shared<Document>(doc_type(), DocumentId("id:test:testdoctype1:n=13:uri"));
addNodesToBucketDB(document::BucketId(16,13), "0=0,1=0");
sendPut(createPut(doc));
@@ -431,7 +431,7 @@ TEST_F(PutOperationTest, update_correct_bucket_on_remapped_put) {
sendReply(1);
- ASSERT_EQ("PutReply(userdoc:test:13:uri, "
+ ASSERT_EQ("PutReply(id:test:testdoctype1:n=13:uri, "
"BucketId(0x0000000000000000), "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp
index 7819b0ed5dc..3bb86eaebd9 100644
--- a/storage/src/tests/distributor/visitoroperationtest.cpp
+++ b/storage/src/tests/distributor/visitoroperationtest.cpp
@@ -51,8 +51,6 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
bool visitInconsistentBuckets = false,
bool visitRemoves = false,
std::string libraryName = "dumpvisitor",
- document::OrderingSpecification::Order visitorOrdering =
- document::OrderingSpecification::ASCENDING,
const std::string& docSelection = "")
{
auto cmd = std::make_shared<api::CreateVisitorCommand>(
@@ -75,7 +73,6 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
if (visitInconsistentBuckets) {
cmd->setVisitInconsistentBuckets();
}
- cmd->setVisitorOrdering(visitorOrdering);
return cmd;
}
@@ -141,7 +138,6 @@ struct VisitorOperationTest : Test, DistributorTestUtil {
document::BucketId lastId,
uint32_t maxBuckets);
- void doOrderedVisitor(document::BucketId startBucket, std::string& out);
void doStandardVisitTest(const std::string& clusterState);
@@ -313,27 +309,6 @@ TEST_F(VisitorOperationTest, distributor_not_ready) {
runEmptyVisitor(createVisitorCommand("notready", id, nullId)));
}
-// Distributor only parses selection if in the order doc case (which is detected
-// by first checking if string contains "order" which it must to refer to
-// "id.order" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-TEST_F(VisitorOperationTest, invalid_order_doc_selection) {
- enableDistributorClusterState("distributor:1 storage:1");
- document::BucketId id(0x400000000000007b);
- addNodesToBucketDB(id, "0=1/1/1/t");
-
- auto res = runEmptyVisitor(
- createVisitorCommand("invalidOrderDoc", id, nullId, 8, 500,
- false, false, "dumpvisitor",
- document::OrderingSpecification::ASCENDING,
- "id.order(10,3)=1 and dummy"));
- EXPECT_EQ("CreateVisitorReply(last=BucketId(0x0000000000000000)) "
- "ReturnCode(ILLEGAL_PARAMETERS, Failed to parse document select "
- "string 'id.order(10,3)=1 and dummy': Document type 'dummy' not "
- "found at column 22 when parsing selection 'id.order(10,3)=1 and dummy')",
- res);
-
-}
-
TEST_F(VisitorOperationTest, non_existing_bucket) {
document::BucketId id(uint64_t(0x400000000000007b));
enableDistributorClusterState("distributor:1 storage:1");
@@ -360,7 +335,6 @@ TEST_F(VisitorOperationTest, user_single_bucket) {
false,
false,
"dumpvisitor",
- document::OrderingSpecification::ASCENDING,
"true"));
op->start(_sender, framework::MilliSecTime(0));
@@ -386,7 +360,6 @@ VisitorOperationTest::runVisitor(document::BucketId id,
false,
false,
"dumpvisitor",
- document::OrderingSpecification::ASCENDING,
"true"));
op->start(_sender, framework::MilliSecTime(0));
@@ -638,7 +611,6 @@ TEST_F(VisitorOperationTest, bucket_high_bit_count) {
false,
false,
"dumpvisitor",
- document::OrderingSpecification::ASCENDING,
"true"));
op->start(_sender, framework::MilliSecTime(0));
@@ -665,7 +637,6 @@ TEST_F(VisitorOperationTest, bucket_low_bit_count) {
false,
false,
"dumpvisitor",
- document::OrderingSpecification::ASCENDING,
"true"));
op->start(_sender, framework::MilliSecTime(0));
@@ -959,43 +930,6 @@ TEST_F(VisitorOperationTest, failure_on_all_nodes) {
// client, not the ones sent from the content nodes to the distributor.
}
-TEST_F(VisitorOperationTest, visit_order) {
- std::vector<document::BucketId> buckets;
-
- document::BucketId id000(35, 0x0000004d2);
- buckets.push_back(id000);
- document::BucketId id001(35, 0x4000004d2);
- buckets.push_back(id001);
- document::BucketId id01(34, 0x2000004d2);
- buckets.push_back(id01);
- document::BucketId id1(33, 0x1000004d2);
- buckets.push_back(id1);
-
- std::sort(buckets.begin(),
- buckets.end(),
- VisitorOrder(document::OrderingSpecification(
- document::OrderingSpecification::ASCENDING, 0x0, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(id000, id001, id01, id1));
-
- std::sort(buckets.begin(),
- buckets.end(),
- VisitorOrder(document::OrderingSpecification(
- document::OrderingSpecification::DESCENDING, 0xFF, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(id1, id01, id001, id000));
-
- std::sort(buckets.begin(),
- buckets.end(),
- VisitorOrder(document::OrderingSpecification(
- document::OrderingSpecification::ASCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(id01, id1, id000, id001));
-
- std::sort(buckets.begin(),
- buckets.end(),
- VisitorOrder(document::OrderingSpecification(
- document::OrderingSpecification::DESCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(id01, id001, id000, id1));
-}
-
TEST_F(VisitorOperationTest, visit_in_chunks) {
enableDistributorClusterState("distributor:1 storage:1");
@@ -1039,191 +973,6 @@ TEST_F(VisitorOperationTest, visit_in_chunks) {
val.second);
}
-TEST_F(VisitorOperationTest, visit_order_split_past_order_bits) {
- std::vector<document::BucketId> buckets;
-
- document::BucketId max(INT_MAX);
- buckets.push_back(max);
- document::BucketId id1(33, 0x1000004d2);
- buckets.push_back(id1);
- document::BucketId id01(34, 0x2000004d2);
- buckets.push_back(id01);
- document::BucketId id00001(37, 0x10000004d2);
- buckets.push_back(id00001);
- document::BucketId id00000(37, 0x00000004d2);
- buckets.push_back(id00000);
- document::BucketId id0000(36, 0x0000004d2);
- buckets.push_back(id0000);
- document::BucketId null(0, 0);
- buckets.push_back(null);
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::ASCENDING, 0x0, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, id0000, id00000, id00001, id01, id1, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::DESCENDING, 0xFF, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, id1, id01, id0000, id00000, id00001, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::ASCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, id01, id1, id0000, id00000, id00001, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::DESCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, id01, id0000, id00000, id00001, id1, max));
-}
-
-TEST_F(VisitorOperationTest, visit_order_inconsistently_split) {
- std::vector<document::BucketId> buckets;
-
- document::BucketId max(INT_MAX);
- buckets.push_back(max);
- document::BucketId id000(35, 0x0000004d2);
- buckets.push_back(id000);
- document::BucketId id001(35, 0x4000004d2);
- buckets.push_back(id001);
- document::BucketId id01(34, 0x2000004d2);
- buckets.push_back(id01);
- document::BucketId id1(33, 0x1000004d2);
- buckets.push_back(id1);
- document::BucketId idsuper(16, 0x04d2);
- buckets.push_back(idsuper);
- document::BucketId null(0, 0);
- buckets.push_back(null);
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::ASCENDING, 0x0, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, idsuper, id000, id001, id01, id1, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::DESCENDING, 0xFF, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, idsuper, id1, id01, id001, id000, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::ASCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, idsuper, id01, id1, id000, id001, max));
-
- std::sort(buckets.begin(), buckets.end(), VisitorOrder(
- document::OrderingSpecification(document::OrderingSpecification::DESCENDING, 0x14, 6, 2)));
- EXPECT_THAT(buckets, ElementsAre(null, idsuper, id01, id001, id000, id1, max));
-}
-
-void
-VisitorOperationTest::doOrderedVisitor(document::BucketId startBucket, std::string& out)
-{
- std::vector<document::BucketId> buckets;
-
- while (true) {
- _sender.clear();
-
- auto op = createOpWithDefaultConfig(
- createVisitorCommand(
- "uservisitororder",
- startBucket,
- buckets.size() ? buckets[buckets.size() - 1] :
- nullId,
- 1,
- 500,
- false,
- false,
- "dumpvisitor",
- document::OrderingSpecification::DESCENDING,
- "id.order(6,2)<= 20"));
-
- op->start(_sender, framework::MilliSecTime(0));
-
- ASSERT_EQ("Visitor Create => 0", _sender.getCommands(true));
-
- for (uint32_t i = 0; i < _sender.commands().size(); ++i) {
- const api::CreateVisitorCommand cmd(
- static_cast<const api::CreateVisitorCommand&>(
- *_sender.command(i)));
-
- for (uint32_t j = 0; j < cmd.getBuckets().size(); ++j) {
- buckets.push_back(cmd.getBuckets()[j]);
- }
- }
-
- sendReply(*op);
-
- ASSERT_EQ(1, _sender.replies().size());
-
- auto& reply = dynamic_cast<const api::CreateVisitorReply&>(*_sender.reply(0));
-
- if (reply.getLastBucket() == document::BucketId(0x000000007fffffff)) {
- break;
- }
- }
-
- std::ostringstream ost;
- for (uint32_t i = 0; i < buckets.size(); ++i) {
- ost << buckets[i] << "\n";
- }
-
- out = ost.str();
-}
-
-TEST_F(VisitorOperationTest, user_visitor_order) {
- enableDistributorClusterState("distributor:1 storage:1");
-
- // Create buckets in bucketdb
- std::vector<document::BucketId> buckets;
- document::BucketId id000(35, 0x0000004d2);
- buckets.push_back(id000);
- document::BucketId id001(35, 0x4000004d2);
- buckets.push_back(id001);
- document::BucketId id01(34, 0x2000004d2);
- buckets.push_back(id01);
- document::BucketId id1(33, 0x1000004d2);
- buckets.push_back(id1);
-
- for (uint32_t i=0; i<buckets.size(); i++) {
- addNodesToBucketDB(buckets[i], "0=1/1/1/t");
- }
-
- document::BucketId id(16, 0x04d2);
-
- std::string res;
- ASSERT_NO_FATAL_FAILURE(doOrderedVisitor(id, res));
- EXPECT_EQ("BucketId(0x88000002000004d2)\n"
- "BucketId(0x8c000004000004d2)\n"
- "BucketId(0x8c000000000004d2)\n"
- "BucketId(0x84000001000004d2)\n",
- res);
-}
-
-TEST_F(VisitorOperationTest, user_visitor_order_split_past_order_bits) {
- enableDistributorClusterState("distributor:1 storage:1");
-
- // Create buckets in bucketdb
- std::vector<document::BucketId> buckets;
- document::BucketId id1(33, 0x1000004d2);
- buckets.push_back(id1);
- document::BucketId id01(34, 0x2000004d2);
- buckets.push_back(id01);
- document::BucketId id00001(37, 0x10000004d2);
- buckets.push_back(id00001);
- document::BucketId id00000(37, 0x00000004d2);
- buckets.push_back(id00000);
- document::BucketId id0000(36, 0x0000004d2);
- buckets.push_back(id0000);
- for (uint32_t i=0; i<buckets.size(); i++) {
- addNodesToBucketDB(buckets[i], "0=1/1/1/t");
- }
-
- document::BucketId id(16, 0x04d2);
-
- std::string res;
- ASSERT_NO_FATAL_FAILURE(doOrderedVisitor(id, res));
- EXPECT_EQ("BucketId(0x88000002000004d2)\n"
- "BucketId(0x90000000000004d2)\n"
- "BucketId(0x94000000000004d2)\n"
- "BucketId(0x94000010000004d2)\n"
- "BucketId(0x84000001000004d2)\n",
- res);
-}
-
std::unique_ptr<VisitorOperation>
VisitorOperationTest::startOperationWith2StorageNodeVisitors(bool inconsistent)
{
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 7db47572e22..2a3e72b48b7 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -248,7 +248,7 @@ TEST_F(FileStorManagerTest, header_only_put) {
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 3);
// Creating a document to test with
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:foo").release());
+ "some content", "id:crawler:testdoctype1:n=4000:foo").release());
document::BucketId bid(16, 4000);
@@ -315,7 +315,7 @@ TEST_F(FileStorManagerTest, put) {
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 3);
// Creating a document to test with
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:foo").release());
+ "some content", "id:crawler:testdoctype1:n=4000:foo").release());
document::BucketId bid(16, 4000);
@@ -348,7 +348,7 @@ TEST_F(FileStorManagerTest, disk_move) {
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 3);
// Creating a document to test with
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:foo").release());
+ "some content", "id:crawler:testdoctype1:n=4000:foo").release());
document::BucketId bid(16, 4000);
@@ -375,7 +375,7 @@ TEST_F(FileStorManagerTest, disk_move) {
EXPECT_EQ(0, entry->disk);
EXPECT_EQ(
vespalib::string(
- "BucketInfo(crc 0x28cc441f, docCount 1, totDocSize 114, "
+ "BucketInfo(crc 0x3538028e, docCount 1, totDocSize 124, "
"ready true, active false)"),
entry->getBucketInfo().toString());
}
@@ -400,7 +400,7 @@ TEST_F(FileStorManagerTest, disk_move) {
EXPECT_EQ(1, entry->disk);
EXPECT_EQ(
vespalib::string(
- "BucketInfo(crc 0x28cc441f, docCount 1, totDocSize 114, "
+ "BucketInfo(crc 0x3538028e, docCount 1, totDocSize 124, "
"ready true, active false)"),
entry->getBucketInfo().toString());
}
@@ -439,7 +439,7 @@ TEST_F(FileStorManagerTest, repair_notifies_distributor_on_change) {
// Creating a document to test with
for (uint32_t i = 0; i < 3; ++i) {
- document::DocumentId docId(vespalib::make_string("userdoc:ns:1:%d", i));
+ document::DocumentId docId(vespalib::make_string("id:ns:testdoctype1:n=1:%d", i));
auto doc = std::make_shared<Document>(*_testdoctype1, docId);
auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(document::BucketId(16, 1)), doc, i + 1);
cmd->setAddress(address);
@@ -458,7 +458,7 @@ TEST_F(FileStorManagerTest, repair_notifies_distributor_on_change) {
EXPECT_EQ(
std::string("NotifyBucketChangeCommand(BucketId(0x4000000000000001), "
- "BucketInfo(crc 0x2625a314, docCount 2, totDocSize 154, "
+ "BucketInfo(crc 0xa14e7e3f, docCount 2, totDocSize 174, "
"ready true, active false))"), top.getReply(0)->toString());
top.close();
@@ -518,7 +518,7 @@ TEST_F(FileStorManagerTest, handler_priority) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- Document::SP doc(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
document::BucketIdFactory factory;
document::BucketId bucket(16, factory.getBucketId(doc->getId()).getRawId());
@@ -624,7 +624,7 @@ TEST_F(FileStorManagerTest, handler_paused_multi_thread) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- Document::SP doc(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
FastOS_ThreadPool pool(512 * 1024);
MessagePusherThread pushthread(filestorHandler, doc);
@@ -671,7 +671,7 @@ TEST_F(FileStorManagerTest, handler_pause) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- Document::SP doc(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
document::BucketIdFactory factory;
document::BucketId bucket(16, factory.getBucketId(doc->getId()).getRawId());
@@ -728,9 +728,9 @@ TEST_F(FileStorManagerTest, remap_split) {
std::string content("Here is some content which is in all documents");
- Document::SP doc1(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc1(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
- Document::SP doc2(createDocument(content, "userdoc:footype:4567:bar").release());
+ Document::SP doc2(createDocument(content, "id:footype:testdoctype1:n=4567:bar").release());
document::BucketIdFactory factory;
document::BucketId bucket1(16, 1234);
@@ -742,12 +742,12 @@ TEST_F(FileStorManagerTest, remap_split) {
filestorHandler.schedule(std::make_shared<api::PutCommand>(makeDocumentBucket(bucket2), doc2, i + 10), 0);
}
- EXPECT_EQ("BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), userdoc:footype:1234:bar, timestamp 1, size 108) (priority: 127)\n"
- "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 11, size 108) (priority: 127)\n"
- "BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), userdoc:footype:1234:bar, timestamp 2, size 108) (priority: 127)\n"
- "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 12, size 108) (priority: 127)\n"
- "BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), userdoc:footype:1234:bar, timestamp 3, size 108) (priority: 127)\n"
- "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 13, size 108) (priority: 127)\n",
+ EXPECT_EQ("BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 1, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 11, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 2, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 12, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000004d2): Put(BucketId(0x40000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 3, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 13, size 118) (priority: 127)\n",
filestorHandler.dumpQueue(0));
FileStorHandler::RemapInfo a(makeDocumentBucket(document::BucketId(17, 1234)), 0);
@@ -757,12 +757,12 @@ TEST_F(FileStorManagerTest, remap_split) {
ASSERT_TRUE(a.foundInQueue);
ASSERT_FALSE(b.foundInQueue);
- EXPECT_EQ("BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 11, size 108) (priority: 127)\n"
- "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 12, size 108) (priority: 127)\n"
- "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), userdoc:footype:4567:bar, timestamp 13, size 108) (priority: 127)\n"
- "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), userdoc:footype:1234:bar, timestamp 1, size 108) (priority: 127)\n"
- "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), userdoc:footype:1234:bar, timestamp 2, size 108) (priority: 127)\n"
- "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), userdoc:footype:1234:bar, timestamp 3, size 108) (priority: 127)\n",
+ EXPECT_EQ("BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 11, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 12, size 118) (priority: 127)\n"
+ "BucketId(0x40000000000011d7): Put(BucketId(0x40000000000011d7), id:footype:testdoctype1:n=4567:bar, timestamp 13, size 118) (priority: 127)\n"
+ "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 1, size 118) (priority: 127)\n"
+ "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 2, size 118) (priority: 127)\n"
+ "BucketId(0x44000000000004d2): Put(BucketId(0x44000000000004d2), id:footype:testdoctype1:n=1234:bar, timestamp 3, size 118) (priority: 127)\n",
filestorHandler.dumpQueue(0));
}
@@ -787,9 +787,9 @@ TEST_F(FileStorManagerTest, handler_multi) {
std::string content("Here is some content which is in all documents");
- Document::SP doc1(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc1(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
- Document::SP doc2(createDocument(content, "userdoc:footype:4567:bar").release());
+ Document::SP doc2(createDocument(content, "id:footype:testdoctype1:n=4567:bar").release());
document::BucketIdFactory factory;
document::BucketId bucket1(16, factory.getBucketId(doc1->getId()).getRawId());
@@ -845,7 +845,7 @@ TEST_F(FileStorManagerTest, handler_timeout) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- Document::SP doc(createDocument(content, "userdoc:footype:1234:bar").release());
+ Document::SP doc(createDocument(content, "id:footype:testdoctype1:n=1234:bar").release());
document::BucketIdFactory factory;
document::BucketId bucket(16, factory.getBucketId(doc->getId()).getRawId());
@@ -912,7 +912,7 @@ TEST_F(FileStorManagerTest, priority) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- uri << "userdoc:footype:" << (i % 3 == 0 ? 0x10001 : 0x0100001)<< ":mydoc-" << i;
+ uri << "id:footype:testdoctype1:n=" << (i % 3 == 0 ? 0x10001 : 0x0100001)<< ":mydoc-" << i;
Document::SP doc(createDocument(content, uri.str()).release());
documents.push_back(doc);
}
@@ -988,7 +988,7 @@ TEST_F(FileStorManagerTest, split1) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- uri << "userdoc:footype:" << (i % 3 == 0 ? 0x10001 : 0x0100001)
+ uri << "id:footype:testdoctype1:n=" << (i % 3 == 0 ? 0x10001 : 0x0100001)
<< ":mydoc-" << i;
Document::SP doc(createDocument(
content, uri.str()).release());
@@ -1135,7 +1135,7 @@ TEST_F(FileStorManagerTest, split_single_group) {
std::string content("Here is some content for all documents");
std::ostringstream uri;
- uri << "userdoc:footype:" << (state ? 0x10001 : 0x0100001)
+ uri << "id:footype:testdoctype1:n=" << (state ? 0x10001 : 0x0100001)
<< ":mydoc-" << i;
documents.emplace_back(createDocument(content, uri.str()));
}
@@ -1203,7 +1203,7 @@ FileStorManagerTest::putDoc(DummyStorageLink& top,
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
document::BucketIdFactory factory;
- document::DocumentId docId(vespalib::make_string("userdoc:ns:%" PRIu64 ":%d", target.getId(), docNum));
+ document::DocumentId docId(vespalib::make_string("id:ns:testdoctype1:n=%" PRIu64 ":%d", target.getId(), docNum));
document::BucketId bucket(16, factory.getBucketId(docId).getRawId());
//std::cerr << "doc bucket is " << bucket << " vs source " << source << "\n";
_node->getPersistenceProvider().createBucket(
@@ -1261,7 +1261,7 @@ TEST_F(FileStorManagerTest, split_empty_target_with_remapped_ops) {
splitCmd->setSourceIndex(0);
document::DocumentId docId(
- vespalib::make_string("userdoc:ns:%d:1234", 0x100001));
+ vespalib::make_string("id:ns:testdoctype1:n=%d:1234", 0x100001));
auto doc = std::make_shared<Document>(*_testdoctype1, docId);
auto putCmd = std::make_shared<api::PutCommand>(makeDocumentBucket(source), doc, 1001);
putCmd->setAddress(address);
@@ -1350,7 +1350,7 @@ TEST_F(FileStorManagerTest, join) {
for (uint32_t i=0; i<20; ++i) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- uri << "userdoc:footype:" << (i % 3 == 0 ? 0x10001 : 0x0100001) << ":mydoc-" << i;
+ uri << "id:footype:testdoctype1:n=" << (i % 3 == 0 ? 0x10001 : 0x0100001) << ":mydoc-" << i;
documents.emplace_back(createDocument(content, uri.str()));
}
document::BucketIdFactory factory;
@@ -1476,7 +1476,7 @@ TEST_F(FileStorManagerTest, visiting) {
std::string content("Here is some content which is in all documents");
std::ostringstream uri;
- uri << "userdoc:crawler:" << (i < 3 ? 1 : 2) << ":"
+ uri << "id:crawler:testdoctype1:n=" << (i < 3 ? 1 : 2) << ":"
<< randomizer.nextUint32() << ".html";
Document::SP doc(createDocument(content, uri.str()));
const document::DocumentType& type(doc->getType());
@@ -1587,7 +1587,7 @@ TEST_F(FileStorManagerTest, remove_location) {
// Adding some documents to be removed later
for (uint32_t i=0; i<=10; ++i) {
std::ostringstream docid;
- docid << "userdoc:ns:" << (i << 8) << ":foo";
+ docid << "id:ns:testdoctype1:n=" << (i << 8) << ":foo";
Document::SP doc(createDocument("some content", docid.str()));
auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), doc, 1000 + i);
cmd->setAddress(address);
@@ -1624,7 +1624,7 @@ TEST_F(FileStorManagerTest, delete_bucket) {
top.open();
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 2);
// Creating a document to test with
- document::DocumentId docId("userdoc:crawler:4000:http://www.ntnu.no/");
+ document::DocumentId docId("id:crawler:testdoctype1:n=4000:http://www.ntnu.no/");
auto doc = std::make_shared<Document>(*_testdoctype1, docId);
document::BucketId bid(16, 4000);
@@ -1670,7 +1670,7 @@ TEST_F(FileStorManagerTest, delete_bucket_rejects_outdated_bucket_info) {
top.open();
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 2);
// Creating a document to test with
- document::DocumentId docId("userdoc:crawler:4000:http://www.ntnu.no/");
+ document::DocumentId docId("id:crawler:testdoctype1:n=4000:http://www.ntnu.no/");
Document::SP doc(new Document(*_testdoctype1, docId));
document::BucketId bid(16, 4000);
@@ -1722,7 +1722,7 @@ TEST_F(FileStorManagerTest, delete_bucket_with_invalid_bucket_info){
top.open();
api::StorageMessageAddress address("storage", lib::NodeType::STORAGE, 2);
// Creating a document to test with
- document::DocumentId docId("userdoc:crawler:4000:http://www.ntnu.no/");
+ document::DocumentId docId("id:crawler:testdoctype1:n=4000:http://www.ntnu.no/");
auto doc = std::make_shared<Document>(*_testdoctype1, docId);
document::BucketId bid(16, 4000);
@@ -1816,7 +1816,7 @@ TEST_F(FileStorManagerTest, equal_timestamps) {
// Putting it
{
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:http://www.ntnu.no/"));
+ "some content", "id:crawler:testdoctype1:n=4000:http://www.ntnu.no/"));
auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), doc, 100);
cmd->setAddress(address);
top.sendDown(cmd);
@@ -1833,7 +1833,7 @@ TEST_F(FileStorManagerTest, equal_timestamps) {
// have to accept this)
{
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:http://www.ntnu.no/"));
+ "some content", "id:crawler:testdoctype1:n=4000:http://www.ntnu.no/"));
auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), doc, 100);
cmd->setAddress(address);
top.sendDown(cmd);
@@ -1848,7 +1848,7 @@ TEST_F(FileStorManagerTest, equal_timestamps) {
// Putting the doc with other id. Now we should fail
{
Document::SP doc(createDocument(
- "some content", "userdoc:crawler:4000:http://www.ntnu.nu/"));
+ "some content", "id:crawler:testdoctype1:n=4000:http://www.ntnu.nu/"));
auto cmd = std::make_shared<api::PutCommand>(makeDocumentBucket(bid), doc, 100);
cmd->setAddress(address);
top.sendDown(cmd);
@@ -1878,7 +1878,7 @@ TEST_F(FileStorManagerTest, get_iter) {
// Creating some documents to test with
for (uint32_t i=0; i<10; ++i) {
std::ostringstream id;
- id << "userdoc:crawler:4000:http://www.ntnu.no/" << i;
+ id << "id:crawler:testdoctype1:n=4000:http://www.ntnu.no/" << i;
docs.emplace_back(
Document::SP(
_node->getTestDocMan().createRandomDocumentAtLocation(
diff --git a/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp b/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
index 5797074f892..e0f85142d7d 100644
--- a/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
+++ b/storage/src/tests/storageserver/configurable_bucket_resolver_test.cpp
@@ -99,11 +99,5 @@ TEST_F(ConfigurableBucketResolverTest, can_create_resolver_from_bucket_space_con
resolver->bucketFromId(DocumentId("id::baz::xyz")).getBucketSpace());
}
-TEST_F(ConfigurableBucketResolverTest, legacy_document_id_without_document_type_maps_to_default_space) {
- auto resolver = create_simple_resolver();
- EXPECT_EQ(document::FixedBucketSpaces::default_space(),
- resolver.bucketFromId(DocumentId("userdoc:baz:1234:baz")).getBucketSpace());
-}
-
}
diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp
index 1f2782de456..1275372b73b 100644
--- a/storage/src/tests/visiting/visitormanagertest.cpp
+++ b/storage/src/tests/visiting/visitormanagertest.cpp
@@ -139,14 +139,13 @@ VisitorManagerTest::initializeTest()
"Be all my sins remember'd.\n");
for (uint32_t i=0; i<docCount; ++i) {
std::ostringstream uri;
- uri << "userdoc:test:" << i % 10 << ":http://www.ntnu.no/"
+ uri << "id:test:testdoctype1:n=" << i % 10 << ":http://www.ntnu.no/"
<< i << ".html";
_documents.push_back(document::Document::SP(
_node->getTestDocMan().createDocument(content, uri.str())));
const document::DocumentType& type(_documents.back()->getType());
- _documents.back()->setValue(type.getField("headerval"),
- document::IntFieldValue(i % 4));
+ _documents.back()->setValue(type.getField("headerval"), document::IntFieldValue(i % 4));
}
for (uint32_t i=0; i<10; ++i) {
document::BucketId bid(16, i);
@@ -332,22 +331,6 @@ VisitorManagerTest::getMatchingDocuments(std::vector<document::Document::SP >& d
return equalCount;
}
-TEST_F(VisitorManagerTest, hit_counter) {
- document::OrderingSpecification spec(document::OrderingSpecification::ASCENDING, 42, 7, 2);
- Visitor::HitCounter hitCounter(&spec);
-
- hitCounter.addHit(document::DocumentId("orderdoc(7,2):mail:1234:42:foo"), 450);
- hitCounter.addHit(document::DocumentId("orderdoc(7,2):mail:1234:49:foo"), 450);
- hitCounter.addHit(document::DocumentId("orderdoc(7,2):mail:1234:60:foo"), 450);
- hitCounter.addHit(document::DocumentId("orderdoc(7,2):mail:1234:10:foo"), 450);
- hitCounter.addHit(document::DocumentId("orderdoc(7,2):mail:1234:21:foo"), 450);
-
- EXPECT_EQ(3, hitCounter.getFirstPassHits());
- EXPECT_EQ(1350, hitCounter.getFirstPassBytes());
- EXPECT_EQ(2, hitCounter.getSecondPassHits());
- EXPECT_EQ(900, hitCounter.getSecondPassBytes());
-}
-
namespace {
int getTotalSerializedSize(const std::vector<document::Document::SP>& docs)
@@ -532,8 +515,8 @@ TEST_F(VisitorManagerTest, visit_with_timeframe_and_selection) {
ASSERT_EQ(2, docs.size());
std::set<std::string> expected;
- expected.insert("userdoc:test:4:http://www.ntnu.no/4.html");
- expected.insert("userdoc:test:5:http://www.ntnu.no/5.html");
+ expected.insert("id:test:testdoctype1:n=4:http://www.ntnu.no/4.html");
+ expected.insert("id:test:testdoctype1:n=5:http://www.ntnu.no/5.html");
std::set<std::string> actual;
for (uint32_t i=0; i<docs.size(); ++i) {
actual.insert(docs[i]->getId().toString());
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index 3d37bbe434b..16b2fca77ae 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -211,7 +211,7 @@ VisitorTest::initializeTest(const TestParams& params)
_documents.clear();
for (uint32_t i=0; i<docCount; ++i) {
std::ostringstream uri;
- uri << "userdoc:test:" << i % 10 << ":http://www.ntnu.no/"
+ uri << "id:test:testdoctype1:n=" << i % 10 << ":http://www.ntnu.no/"
<< i << ".html";
_documents.push_back(document::Document::SP(