summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-19 06:39:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-19 06:39:38 +0000
commit875a4b8525e00ff4fffd7f6721ffa4375877bc5b (patch)
treeadb08659cb0cd44cb212d73d329f3dbff77eb189 /storage
parent224b5fbe12ecab75beee6efe24068a9ce7092110 (diff)
Remove DocIdString outside of document
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/bucketdb/bucketmanagertest.cpp6
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp54
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp129
-rw-r--r--storage/src/tests/distributor/updateoperationtest.cpp10
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp14
-rw-r--r--storage/src/tests/storageserver/documentapiconvertertest.cpp3
-rw-r--r--storage/src/vespa/storage/visiting/countvisitor.cpp5
7 files changed, 92 insertions, 129 deletions
diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp
index 11f5ec70014..ad46d494d11 100644
--- a/storage/src/tests/bucketdb/bucketmanagertest.cpp
+++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp
@@ -171,10 +171,8 @@ void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer,
_top->push_back(std::move(bottom));
}
// Generate a doc to use for testing..
- const DocumentType &type(*_node->getTypeRepo()
- ->getDocumentType("text/html"));
- _document = std::make_shared<document::Document>(
- type, document::DocumentId(document::DocIdString("test", "ntnu")));
+ const DocumentType &type(*_node->getTypeRepo()->getDocumentType("text/html"));
+ _document = std::make_shared<document::Document>(type, document::DocumentId("id:ns:text/html::ntnu"));
}
void BucketManagerTest::addBucketsToDB(uint32_t count)
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index 4b67cf1963d..ab11e3ab8fa 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -40,7 +40,7 @@ struct GetOperationTest : Test, DistributorTestUtil {
FileSpec("../config-doctypes.cfg"))));
createLinks();
- docId = document::DocumentId(document::DocIdString("test", "uri"));
+ docId = document::DocumentId("id:ns:text/html::uri");
bucketId = getExternalOperationHandler().getBucketId(docId);
};
@@ -133,7 +133,7 @@ TEST_F(GetOperationTest, simple) {
ASSERT_NO_FATAL_FAILURE(replyWithDocument());
- EXPECT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ EXPECT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -149,7 +149,7 @@ TEST_F(GetOperationTest, ask_trusted_node_if_bucket_is_inconsistent) {
ASSERT_NO_FATAL_FAILURE(replyWithDocument());
- EXPECT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ EXPECT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -166,7 +166,7 @@ TEST_F(GetOperationTest, ask_all_nodes_if_bucket_is_inconsistent) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 2));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "oldauthor", 1));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
@@ -185,7 +185,7 @@ TEST_F(GetOperationTest, send_to_all_invalid_copies) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 2));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "oldauthor", 1));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
@@ -207,7 +207,7 @@ TEST_F(GetOperationTest, send_to_all_invalid_nodes_when_inconsistent) {
ASSERT_NO_FATAL_FAILURE(sendReply(2, api::ReturnCode::OK, "oldauthor", 1));
ASSERT_NO_FATAL_FAILURE(sendReply(3, api::ReturnCode::OK, "oldauthor", 1));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
@@ -217,8 +217,8 @@ TEST_F(GetOperationTest, send_to_all_invalid_nodes_when_inconsistent) {
TEST_F(GetOperationTest, inconsistent_split) {
setClusterState("distributor:1 storage:4");
- addNodesToBucketDB(document::BucketId(16, 0x2a52), "0=100");
- addNodesToBucketDB(document::BucketId(17, 0x2a52), "1=200");
+ addNodesToBucketDB(document::BucketId(16, 0x0593), "0=100");
+ addNodesToBucketDB(document::BucketId(17, 0x0593), "1=200");
sendGet();
@@ -227,7 +227,7 @@ TEST_F(GetOperationTest, inconsistent_split) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 2));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "oldauthor", 1));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
@@ -246,7 +246,7 @@ TEST_F(GetOperationTest, multi_inconsistent_bucket_not_found) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 2));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "", 0));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -265,7 +265,7 @@ TEST_F(GetOperationTest, multi_inconsistent_bucket_not_found_deleted) {
// at timestamp 3.
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "", 3));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 3) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -282,7 +282,7 @@ TEST_F(GetOperationTest, multi_inconsistent_bucket) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 2));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "oldauthor", 1));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 2) ReturnCode(NONE)",
_sender.getLastReply());
@@ -301,12 +301,12 @@ TEST_F(GetOperationTest, multi_inconsistent_bucket_fail) {
ASSERT_NO_FATAL_FAILURE(sendReply(0, api::ReturnCode::OK, "newauthor", 1));
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::DISK_FAILURE, "", 0));
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 3",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 3",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithDocument());
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -316,7 +316,7 @@ TEST_F(GetOperationTest, return_not_found_when_bucket_not_in_db) {
sendGet();
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 0) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -328,12 +328,12 @@ TEST_F(GetOperationTest, not_found) {
sendGet();
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 0",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 0",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithNotFound());
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 0) ReturnCode(NONE)",
_sender.getLastReply());
@@ -350,17 +350,17 @@ TEST_F(GetOperationTest, resend_on_storage_failure) {
sendGet();
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 1",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 1",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithFailure());
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 2",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 2",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithDocument());
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -374,17 +374,17 @@ TEST_F(GetOperationTest, resend_on_storage_failure_all_fail) {
sendGet();
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 1",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 1",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithFailure());
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 2",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 2",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithFailure());
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 0) ReturnCode(IO_FAILURE)",
_sender.getLastReply());
}
@@ -397,12 +397,12 @@ TEST_F(GetOperationTest, send_to_ideal_copy_if_bucket_in_sync) {
sendGet();
// Should always send to node 1 (follow bucket db order)
- ASSERT_EQ("Get(BucketId(0x4000000000002a52), doc:test:uri) => 1",
+ ASSERT_EQ("Get(BucketId(0x4000000000000593), id:ns:text/html::uri) => 1",
_sender.getLastCommand());
ASSERT_NO_FATAL_FAILURE(replyWithDocument());
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 100) ReturnCode(NONE)",
_sender.getLastReply());
}
@@ -412,7 +412,7 @@ TEST_F(GetOperationTest, multiple_copies_with_failure_on_local_node) {
// Node 0 is local copy to distributor 0 and will be preferred when
// sending initially.
- addNodesToBucketDB(document::BucketId(16, 0x2a52), "2=100,0=100");
+ addNodesToBucketDB(document::BucketId(16, 0x0593), "2=100,0=100");
sendGet();
@@ -427,7 +427,7 @@ TEST_F(GetOperationTest, multiple_copies_with_failure_on_local_node) {
ASSERT_NO_FATAL_FAILURE(sendReply(1, api::ReturnCode::OK, "newestauthor", 3));
- ASSERT_EQ("GetReply(BucketId(0x0000000000000000), doc:test:uri, "
+ ASSERT_EQ("GetReply(BucketId(0x0000000000000000), id:ns:text/html::uri, "
"timestamp 3) ReturnCode(NONE)",
_sender.getLastReply());
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index edb5261fbfa..df9bf683326 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -197,8 +197,7 @@ TwoPhaseUpdateOperationTest::replyToGet(
std::shared_ptr<api::StorageReply> reply;
if (haveDocument) {
- auto doc(std::make_shared<Document>(
- *_doc_type, DocumentId(DocIdString("test", "test"))));
+ auto doc(std::make_shared<Document>(*_doc_type, DocumentId("id:ns:" + _doc_type->getName() + "::1")));
doc->setValue("headerval", IntFieldValue(oldTimestamp));
reply = std::make_shared<api::GetReply>(get, doc, oldTimestamp);
@@ -229,7 +228,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState,
if (!options._withError) {
update = std::make_shared<document::DocumentUpdate>(
*_repo, *_doc_type,
- document::DocumentId(document::DocIdString("test", "test")));
+ document::DocumentId("id:ns:" + _doc_type->getName() + "::1"));
document::FieldUpdate fup(_doc_type->getField("headerval"));
fup.addUpdate(ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 10));
update->addUpdate(fup);
@@ -239,7 +238,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState,
auto* badDocType = _repo->getDocumentType("testdoctype2");
update = std::make_shared<document::DocumentUpdate>(
*_repo, *badDocType,
- document::DocumentId(document::DocIdString("test", "test")));
+ document::DocumentId("id:ns:" + _doc_type->getName() + "::1"));
document::FieldUpdate fup(badDocType->getField("onlyinchild"));
fup.addUpdate(ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 10));
update->addUpdate(fup);
@@ -285,7 +284,7 @@ TEST_F(TwoPhaseUpdateOperationTest, simple) {
replyToMessage(*cb, sender, 0, 90);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 90) ReturnCode(NONE)",
sender.getLastReply(true));
}
@@ -297,7 +296,7 @@ TEST_F(TwoPhaseUpdateOperationTest, non_existing) {
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) ReturnCode(NONE)",
sender.getLastReply(true));
}
@@ -313,7 +312,7 @@ TEST_F(TwoPhaseUpdateOperationTest, update_failed) {
replyToMessage(*cb, sender, 0, 90, api::ReturnCode::INTERNAL_FAILURE);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(INTERNAL_FAILURE)",
sender.getLastReply(true));
@@ -331,20 +330,18 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps) {
replyToMessage(*cb, sender, 0, 90);
replyToMessage(*cb, sender, 1, 110);
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 1",
- sender.getLastCommand(true));
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 1", sender.getLastCommand(true));
replyToGet(*cb, sender, 2, 110);
- ASSERT_EQ("Update => 0,Update => 1,Get => 1,Put => 1,Put => 0",
- sender.getCommands(true));
+ ASSERT_EQ("Update => 0,Update => 1,Get => 1,Put => 1,Put => 0", sender.getCommands(true));
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 3);
replyToPut(*cb, sender, 4);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 110 Was inconsistent "
"(best node 1)) ReturnCode(NONE)",
sender.getLastReply(true));
@@ -362,13 +359,12 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_not_found)
replyToMessage(*cb, sender, 0, 90);
replyToMessage(*cb, sender, 1, 110);
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 1",
- sender.getLastCommand(true));
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 1", sender.getLastCommand(true));
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 2, 110, false);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 110 Was inconsistent "
"(best node 1)) ReturnCode(INTERNAL_FAILURE)",
sender.getLastReply(true));
@@ -387,7 +383,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_update_err
ASSERT_TRUE(sender.replies().empty());
replyToMessage(*cb, sender, 1, 110, api::ReturnCode::IO_FAILURE);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 90) "
"ReturnCode(IO_FAILURE)",
sender.getLastReply(true));
@@ -405,13 +401,13 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_get_error)
replyToMessage(*cb, sender, 0, 90);
replyToMessage(*cb, sender, 1, 110);
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 1",
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 1",
sender.getLastCommand(true));
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 2, 110, false, api::ReturnCode::IO_FAILURE);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 110 Was inconsistent "
"(best node 1)) ReturnCode(IO_FAILURE)",
sender.getLastReply(true));
@@ -429,7 +425,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_put_error)
replyToMessage(*cb, sender, 0, 90);
replyToMessage(*cb, sender, 1, 110);
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 1",
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 1",
sender.getLastCommand(true));
replyToGet(*cb, sender, 2, 110);
@@ -441,7 +437,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_put_error)
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 4);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 110 Was inconsistent "
"(best node 1)) ReturnCode(IO_FAILURE)",
sender.getLastReply(true));
@@ -459,7 +455,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_put_not_st
replyToMessage(*cb, sender, 0, 90);
replyToMessage(*cb, sender, 1, 110);
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 1",
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 1",
sender.getLastCommand(true));
checkMessageSettingsPropagatedTo(sender.commands().back());
@@ -467,7 +463,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_put_not_st
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 2, 110);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 110 Was inconsistent "
"(best node 1)) ReturnCode(NOT_CONNECTED, "
"Can't store document: No storage nodes available)",
@@ -483,8 +479,8 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_inconsiste
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
- std::string wanted("Get(BucketId(0x4000000000008b13), doc:test:test) => 0,"
- "Get(BucketId(0x4400000000008b13), doc:test:test) => 0");
+ std::string wanted("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 0,"
+ "Get(BucketId(0x440000000000cac4), id:ns:testdoctype1::1) => 0");
std::string text = sender.getCommands(true, true);
ASSERT_EQ(wanted, text);
@@ -492,17 +488,17 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_inconsistent_timestamps_inconsiste
replyToGet(*cb, sender, 0, 90);
replyToGet(*cb, sender, 1, 120);
- ASSERT_EQ("Put(BucketId(0x4400000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 1,"
- "Put(BucketId(0x4400000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 0",
+ ASSERT_EQ("Put(BucketId(0x440000000000cac4), id:ns:testdoctype1::1, "
+ "timestamp 200000000, size 60) => 1,"
+ "Put(BucketId(0x440000000000cac4), id:ns:testdoctype1::1, "
+ "timestamp 200000000, size 60) => 0",
sender.getCommands(true, true, 2));
replyToPut(*cb, sender, 2);
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 3);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 120) "
"ReturnCode(NONE)",
@@ -543,7 +539,7 @@ TEST_F(TwoPhaseUpdateOperationTest, n_of_m) {
ASSERT_TRUE(sender.replies().empty());
replyToMessage(*cb, sender, 0, 90);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 90) ReturnCode(NONE)",
sender.getLastReply(true));
@@ -569,18 +565,15 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_updates_newest_received_document)
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
- ASSERT_EQ("Get(BucketId(0x4000000000008b13), doc:test:test) => 0,"
- "Get(BucketId(0x4000000000008b13), doc:test:test) => 2",
+ ASSERT_EQ("Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 0,"
+ "Get(BucketId(0x400000000000cac4), id:ns:testdoctype1::1) => 2",
sender.getCommands(true, true));
replyToGet(*cb, sender, 0, 50);
replyToGet(*cb, sender, 1, 70);
- ASSERT_EQ("Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 1,"
- "Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 0,"
- "Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 2",
+ ASSERT_EQ("Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 1,"
+ "Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 2,"
+ "Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 0",
sender.getCommands(true, true, 2));
// Make sure Put contains an updated document (+10 arith. update on field
// whose value equals gotten timestamp). In this case we want 70 -> 80.
@@ -591,7 +584,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_updates_newest_received_document)
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 4);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 70) "
"ReturnCode(NONE)",
@@ -612,12 +605,9 @@ TEST_F(TwoPhaseUpdateOperationTest, create_if_non_existent_creates_document_if_a
replyToGet(*cb, sender, 1, 0, false);
// Since create-if-non-existent is set, distributor should create doc from
// scratch.
- ASSERT_EQ("Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 1,"
- "Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 0,"
- "Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 2",
+ ASSERT_EQ("Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 1,"
+ "Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 2,"
+ "Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, timestamp 200000000, size 60) => 0",
sender.getCommands(true, true, 2));
ASSERT_EQ("10", getUpdatedValueFromLastPut(sender));
@@ -627,7 +617,7 @@ TEST_F(TwoPhaseUpdateOperationTest, create_if_non_existent_creates_document_if_a
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 4);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 200000000) "
"ReturnCode(NONE)",
@@ -648,14 +638,14 @@ TEST_F(TwoPhaseUpdateOperationTest, update_fails_if_safe_path_has_failed_put) {
replyToGet(*cb, sender, 1, 0, false);
// Since create-if-non-existent is set, distributor should create doc from
// scratch.
- ASSERT_EQ("Put => 1,Put => 0,Put => 2", sender.getCommands(true, false, 2));
+ ASSERT_EQ("Put => 1,Put => 2,Put => 0", sender.getCommands(true, false, 2));
replyToPut(*cb, sender, 2);
replyToPut(*cb, sender, 3);
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 4, api::ReturnCode::IO_FAILURE);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 200000000) "
"ReturnCode(IO_FAILURE)",
@@ -675,7 +665,7 @@ TEST_F(TwoPhaseUpdateOperationTest, update_fails_if_safe_path_gets_fail) {
replyToGet(*cb, sender, 0, 0, false, api::ReturnCode::IO_FAILURE);
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 1, 0, false, api::ReturnCode::IO_FAILURE);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(IO_FAILURE)",
@@ -696,7 +686,7 @@ TEST_F(TwoPhaseUpdateOperationTest, update_fails_if_apply_throws_exception) {
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 1, 70);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 70) "
"ReturnCode(INTERNAL_FAILURE, Can not apply a "
@@ -713,10 +703,10 @@ TEST_F(TwoPhaseUpdateOperationTest, non_existing_with_auto_create) {
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
- ASSERT_EQ("CreateBucketCommand(BucketId(0x4000000000008b13), active) "
+ ASSERT_EQ("CreateBucketCommand(BucketId(0x400000000000cac4), active) "
"Reasons to start: => 0,"
- "Put(BucketId(0x4000000000008b13), doc:test:test, "
- "timestamp 200000000, size 52) => 0",
+ "Put(BucketId(0x400000000000cac4), id:ns:testdoctype1::1, "
+ "timestamp 200000000, size 60) => 0",
sender.getCommands(true, true));
ASSERT_EQ("10", getUpdatedValueFromLastPut(sender));
@@ -725,7 +715,7 @@ TEST_F(TwoPhaseUpdateOperationTest, non_existing_with_auto_create) {
ASSERT_TRUE(sender.replies().empty());
replyToPut(*cb, sender, 1);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 200000000) "
"ReturnCode(NONE)",
@@ -745,7 +735,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_fails_update_when_mismatching_time
replyToGet(*cb, sender, 0, 100);
ASSERT_TRUE(sender.replies().empty());
replyToGet(*cb, sender, 1, 110);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(NONE, No document with requested "
@@ -755,8 +745,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_fails_update_when_mismatching_time
TEST_F(TwoPhaseUpdateOperationTest, safe_path_update_propagates_message_settings_to_gets_and_puts) {
setupDistributor(3, 3, "storage:3 distributor:1");
- std::shared_ptr<TwoPhaseUpdateOperation> cb(
- sendUpdate("0=1/2/3,1=1/2/3,2=2/3/4"));
+ std::shared_ptr<TwoPhaseUpdateOperation> cb(sendUpdate("0=1/2/3,1=1/2/3,2=2/3/4"));
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
@@ -765,7 +754,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_update_propagates_message_settings
checkMessageSettingsPropagatedTo(sender.command(1));
replyToGet(*cb, sender, 0, 50);
replyToGet(*cb, sender, 1, 70);
- ASSERT_EQ("Put => 1,Put => 0,Put => 2", sender.getCommands(true, false, 2));
+ ASSERT_EQ("Put => 1,Put => 2,Put => 0", sender.getCommands(true, false, 2));
checkMessageSettingsPropagatedTo(sender.command(2));
checkMessageSettingsPropagatedTo(sender.command(3));
checkMessageSettingsPropagatedTo(sender.command(4));
@@ -776,16 +765,14 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_update_propagates_message_settings
TEST_F(TwoPhaseUpdateOperationTest, safe_path_propagates_mbus_traces_from_replies) {
setupDistributor(3, 3, "storage:3 distributor:1");
- std::shared_ptr<TwoPhaseUpdateOperation> cb(
- sendUpdate("0=1/2/3,1=1/2/3,2=2/3/4"));
+ std::shared_ptr<TwoPhaseUpdateOperation> cb(sendUpdate("0=1/2/3,1=1/2/3,2=2/3/4"));
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
ASSERT_EQ("Get => 0,Get => 2", sender.getCommands(true));
- replyToGet(*cb, sender, 0, 50, true,
- api::ReturnCode::OK, "hello earthlings");
+ replyToGet(*cb, sender, 0, 50, true, api::ReturnCode::OK, "hello earthlings");
replyToGet(*cb, sender, 1, 70);
- ASSERT_EQ("Put => 1,Put => 0,Put => 2", sender.getCommands(true, false, 2));
+ ASSERT_EQ("Put => 1,Put => 2,Put => 0", sender.getCommands(true, false, 2));
replyToPut(*cb, sender, 2, api::ReturnCode::OK, "fooo");
replyToPut(*cb, sender, 3, api::ReturnCode::OK, "baaa");
ASSERT_TRUE(sender.replies().empty());
@@ -803,8 +790,7 @@ TEST_F(TwoPhaseUpdateOperationTest, update_fails_if_ownership_changes_between_ge
setupDistributor(2, 2, "storage:2 distributor:1");
// Update towards inconsistent bucket invokes safe path.
- std::shared_ptr<TwoPhaseUpdateOperation> cb(
- sendUpdate("0=1/2/3,1=2/3/4"));
+ std::shared_ptr<TwoPhaseUpdateOperation> cb(sendUpdate("0=1/2/3,1=2/3/4"));
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
@@ -823,7 +809,7 @@ TEST_F(TwoPhaseUpdateOperationTest, update_fails_if_ownership_changes_between_ge
// BUCKET_NOT_FOUND is a transient error code which should cause the client
// to re-send the operation, presumably to the correct distributor the next
// time.
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 70) "
"ReturnCode(BUCKET_NOT_FOUND, Distributor lost "
@@ -843,7 +829,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_mismatch_fails_with_tas_
// Newest doc has headerval==110, not 120.
replyToGet(*cb, sender, 0, 100);
replyToGet(*cb, sender, 1, 110);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(TEST_AND_SET_CONDITION_FAILED, "
@@ -877,7 +863,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_parse_failure_fails_with
// NOTE: condition is currently not attempted parsed until Gets have been
// replied to. This may change in the future.
// XXX reliance on parser/exception error message is very fragile.
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(ILLEGAL_PARAMETERS, "
@@ -899,7 +885,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_unknown_doc_type_fails_w
replyToGet(*cb, sender, 1, 110);
// NOTE: condition is currently not attempted parsed until Gets have been
// replied to. This may change in the future.
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(ILLEGAL_PARAMETERS, "
@@ -920,7 +906,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_condition_with_missing_doc_and_no_
// Both Gets return nothing at all, nothing at all.
replyToGet(*cb, sender, 0, 100, false);
replyToGet(*cb, sender, 1, 110, false);
- EXPECT_EQ("UpdateReply(doc:test:test, "
+ EXPECT_EQ("UpdateReply(id:ns:testdoctype1::1, "
"BucketId(0x0000000000000000), "
"timestamp 0, timestamp of updated doc: 0) "
"ReturnCode(TEST_AND_SET_CONDITION_FAILED, "
@@ -976,8 +962,7 @@ TEST_F(TwoPhaseUpdateOperationTest, fast_path_close_edge_sends_correct_reply) {
TEST_F(TwoPhaseUpdateOperationTest, safe_path_close_edge_sends_correct_reply) {
setupDistributor(2, 2, "storage:2 distributor:1");
- std::shared_ptr<TwoPhaseUpdateOperation> cb(
- sendUpdate("0=1/2/3,1=2/3/4")); // Inconsistent replicas.
+ std::shared_ptr<TwoPhaseUpdateOperation> cb(sendUpdate("0=1/2/3,1=2/3/4")); // Inconsistent replicas.
DistributorMessageSenderStub sender;
cb->start(sender, framework::MilliSecTime(0));
diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp
index 7cf3ea0ad18..6bc000f6780 100644
--- a/storage/src/tests/distributor/updateoperationtest.cpp
+++ b/storage/src/tests/distributor/updateoperationtest.cpp
@@ -55,7 +55,7 @@ UpdateOperationTest::sendUpdate(const std::string& bucketState)
{
auto update = std::make_shared<document::DocumentUpdate>(
*_repo, *_html_type,
- document::DocumentId(document::DocIdString("test", "test")));
+ document::DocumentId("id:ns:" + _html_type->getName() + "::1"));
_bId = getExternalOperationHandler().getBucketId(update->getId());
@@ -95,7 +95,7 @@ TEST_F(UpdateOperationTest, simple) {
replyToMessage(*cb, sender, 0, 90);
- ASSERT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ ASSERT_EQ("UpdateReply(id:ns:text/html::1, BucketId(0x0000000000000000), "
"timestamp 100, timestamp of updated doc: 90) ReturnCode(NONE)",
sender.getLastReply(true));
@@ -114,7 +114,7 @@ TEST_F(UpdateOperationTest, not_found) {
replyToMessage(*cb, sender, 0, 0);
- EXPECT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ EXPECT_EQ("UpdateReply(id:ns:text/html::1, BucketId(0x0000000000000000), "
"timestamp 100, timestamp of updated doc: 0) ReturnCode(NONE)",
sender.getLastReply(true));
}
@@ -130,7 +130,7 @@ TEST_F(UpdateOperationTest, multi_node) {
replyToMessage(*cb, sender, 0, 120);
replyToMessage(*cb, sender, 1, 120);
- ASSERT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ ASSERT_EQ("UpdateReply(id:ns:text/html::1, BucketId(0x0000000000000000), "
"timestamp 100, timestamp of updated doc: 120) ReturnCode(NONE)",
sender.getLastReply(true));
@@ -154,7 +154,7 @@ TEST_F(UpdateOperationTest, multi_node_inconsistent_timestamp) {
replyToMessage(*cb, sender, 0, 119);
replyToMessage(*cb, sender, 1, 120);
- ASSERT_EQ("UpdateReply(doc:test:test, BucketId(0x0000000000000000), "
+ ASSERT_EQ("UpdateReply(id:ns:text/html::1, BucketId(0x0000000000000000), "
"timestamp 100, timestamp of updated doc: 120 Was inconsistent "
"(best node 1)) ReturnCode(NONE)",
sender.getLastReply(true));
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 4c4a7c9a0be..fe10d346ba7 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -235,20 +235,6 @@ TEST_F(TestAndSetTest, conditional_put_to_non_existing_document_should_fail) {
EXPECT_EQ("", dumpBucket(BUCKET_ID));
}
-TEST_F(TestAndSetTest, document_with_no_type_should_fail) {
- // Conditionally replace nonexisting document
- // 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(makeDocumentBucket(BUCKET_ID), legacyDocId, timestamp);
- setTestCondition(remove);
-
- auto code = thread->handleRemove(remove)->getResult();
- EXPECT_EQ(code.getResult(), api::ReturnCode::Result::ILLEGAL_PARAMETERS);
- EXPECT_EQ(code.getMessage(), "Document id has no doctype");
- EXPECT_EQ("", dumpBucket(BUCKET_ID));
-}
-
document::Document::SP
TestAndSetTest::createTestDocument()
{
diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp
index c879f7d2779..f006277a7b6 100644
--- a/storage/src/tests/storageserver/documentapiconvertertest.cpp
+++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp
@@ -22,7 +22,6 @@ using document::Bucket;
using document::BucketId;
using document::BucketSpace;
using document::DataType;
-using document::DocIdString;
using document::Document;
using document::DocumentId;
using document::DocumentTypeRepo;
@@ -124,7 +123,7 @@ TEST_F(DocumentApiConverterTest, put) {
}
TEST_F(DocumentApiConverterTest, forwarded_put) {
- auto doc = std::make_shared<Document>(_html_type, DocumentId(DocIdString("test", "test")));
+ auto doc = std::make_shared<Document>(_html_type, DocumentId("id:ns:" + _html_type.getName() + "::test"));
auto putmsg = std::make_unique<documentapi::PutDocumentMessage>(doc);
auto* putmsg_raw = putmsg.get();
diff --git a/storage/src/vespa/storage/visiting/countvisitor.cpp b/storage/src/vespa/storage/visiting/countvisitor.cpp
index 4cb4f2d3447..a9ebe7e452a 100644
--- a/storage/src/vespa/storage/visiting/countvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/countvisitor.cpp
@@ -47,11 +47,6 @@ CountVisitor::handleDocuments(const document::BucketId& /*bucketId*/,
}
switch (idString.getType()) {
- case document::IdString::DOC:
- if (_doScheme) {
- _schemeCount["doc"]++;
- }
- break;
case document::IdString::ID:
if (_doScheme) {
_schemeCount["id"]++;