diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2023-11-07 16:17:01 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2023-11-08 15:05:46 +0000 |
commit | 7881facd0f0e312e9bafefccdf00301f1b74a0ff (patch) | |
tree | e4e088a0c30e32fc68805e82e2114e8ade9a2dd1 /persistence/src | |
parent | e7b517e5705538cd90a72920c3edb0d36abb274e (diff) |
Include doc type name and GID in metadata iteration results
Document type is fetched from the associated `IPersistenceHandler`
on-demand; it is assumed the lifetime of the pointer must be valid
for the entire lifetime of the iterator itself, as the latter holds
a valid handler snapshot.
For simplicity, it's possible to _not_ pass in a handler, in which
case the doc type name will be implicitly empty.
Some expected `DocEntry` sizes have been adjusted, as we now
report the size of the document type and GID alongside the
base type size.
Diffstat (limited to 'persistence/src')
-rw-r--r-- | persistence/src/tests/spi/clusterstatetest.cpp | 2 | ||||
-rw-r--r-- | persistence/src/vespa/persistence/spi/docentry.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp index 863bde5c225..bbe563274ec 100644 --- a/persistence/src/tests/spi/clusterstatetest.cpp +++ b/persistence/src/tests/spi/clusterstatetest.cpp @@ -297,7 +297,7 @@ TEST(DocEntryTest, test_doctype_and_gid) { DocEntry::UP e = DocEntry::create(Timestamp(9), DocumentMetaEnum::NONE, "doc_type", GlobalId::parse("gid(0xc4cef118f9f9649222750be2)")); EXPECT_EQ(9, e->getTimestamp()); EXPECT_FALSE(e->isRemove()); - EXPECT_EQ(20, e->getSize()); + EXPECT_EQ(44, e->getSize()); EXPECT_EQ(nullptr, e->getDocument()); EXPECT_EQ(nullptr, e->getDocumentId()); EXPECT_EQ("doc_type", e->getDocumentType()); diff --git a/persistence/src/vespa/persistence/spi/docentry.cpp b/persistence/src/vespa/persistence/spi/docentry.cpp index 5077af568ac..6e92223cb6e 100644 --- a/persistence/src/vespa/persistence/spi/docentry.cpp +++ b/persistence/src/vespa/persistence/spi/docentry.cpp @@ -71,7 +71,7 @@ DocEntryWithId::DocEntryWithId(Timestamp t, DocumentMetaEnum metaEnum, const Doc { } DocEntryWithTypeAndGid::DocEntryWithTypeAndGid(Timestamp t, DocumentMetaEnum metaEnum, vespalib::stringref docType, GlobalId gid) - : DocEntry(t, metaEnum, docType.size() + sizeof(gid)), + : DocEntry(t, metaEnum, sizeof(DocEntry) + docType.size() + sizeof(gid)), _type(docType), _gid(gid) { } |