aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-01-07 06:15:12 +0100
committerGitHub <noreply@github.com>2022-01-07 06:15:12 +0100
commit776a02c236bb78b64d6bb7643f4a5acf2ab0f1e1 (patch)
tree3077f322cc345a30ab801c25da6fbdb845d951b2 /storage
parent499d884cefeac2a4f5dc071814d1a64ddc249875 (diff)
Revert "Revert "Balder/refactor docentry""
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/persistence/splitbitdetectortest.cpp14
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp11
-rw-r--r--storage/src/tests/visiting/visitortest.cpp57
-rw-r--r--storage/src/vespa/storage/persistence/asynchandler.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/bucketprocessor.h7
-rw-r--r--storage/src/vespa/storage/persistence/mergehandler.cpp23
-rw-r--r--storage/src/vespa/storage/persistence/mergehandler.h6
-rw-r--r--storage/src/vespa/storage/persistence/messages.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/messages.h16
-rw-r--r--storage/src/vespa/storage/persistence/processallhandler.cpp3
-rw-r--r--storage/src/vespa/storage/persistence/provider_error_wrapper.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/simplemessagehandler.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/splitbitdetector.cpp1
-rw-r--r--storage/src/vespa/storage/visiting/countvisitor.cpp3
-rw-r--r--storage/src/vespa/storage/visiting/countvisitor.h4
-rw-r--r--storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp7
-rw-r--r--storage/src/vespa/storage/visiting/dumpvisitorsingle.h2
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.cpp3
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.h2
-rw-r--r--storage/src/vespa/storage/visiting/reindexing_visitor.cpp7
-rw-r--r--storage/src/vespa/storage/visiting/reindexing_visitor.h2
-rw-r--r--storage/src/vespa/storage/visiting/testvisitor.cpp3
-rw-r--r--storage/src/vespa/storage/visiting/testvisitor.h2
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp6
-rw-r--r--storage/src/vespa/storage/visiting/visitor.h8
25 files changed, 101 insertions, 91 deletions
diff --git a/storage/src/tests/persistence/splitbitdetectortest.cpp b/storage/src/tests/persistence/splitbitdetectortest.cpp
index d4e84836a5a..5c4dc85e825 100644
--- a/storage/src/tests/persistence/splitbitdetectortest.cpp
+++ b/storage/src/tests/persistence/splitbitdetectortest.cpp
@@ -15,6 +15,8 @@ using namespace ::testing;
namespace storage {
+using DocEntryList = std::vector<spi::DocEntry::UP>;
+
struct SplitBitDetectorTest : Test {
document::TestDocMan testDocMan;
spi::dummy::DummyPersistence provider;
@@ -33,7 +35,7 @@ struct SplitBitDetectorTest : Test {
};
TEST_F(SplitBitDetectorTest, two_users) {
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t i = 0; i < 5; ++i) {
document::Document::SP doc(
testDocMan.createRandomDocumentAtLocation(1, i, 1, 1));
@@ -54,7 +56,7 @@ TEST_F(SplitBitDetectorTest, two_users) {
}
TEST_F(SplitBitDetectorTest, single_user) {
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t i = 0; i < 10; ++i) {
document::Document::SP doc(
testDocMan.createRandomDocumentAtLocation(1, i, 1, 1));
@@ -71,7 +73,7 @@ TEST_F(SplitBitDetectorTest, single_user) {
TEST_F(SplitBitDetectorTest, max_bits) {
int minContentSize = 1, maxContentSize = 1;
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t seed = 0; seed < 10; ++seed) {
int location = 1;
document::Document::SP doc(testDocMan.createRandomDocumentAtLocation(
@@ -92,7 +94,7 @@ TEST_F(SplitBitDetectorTest, max_bits_one_below_max) {
provider.createBucket(my_bucket, context);
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t seed = 0; seed < 10; ++seed) {
int location = 1 | (seed % 2 == 0 ? 0x8000 : 0);
document::Document::SP doc(testDocMan.createRandomDocumentAtLocation(
@@ -114,7 +116,7 @@ TEST_F(SplitBitDetectorTest, max_bits_one_below_max) {
}
TEST_F(SplitBitDetectorTest, unsplittable) {
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t i = 0; i < 10; ++i) {
document::Document::SP doc(
@@ -130,7 +132,7 @@ TEST_F(SplitBitDetectorTest, unsplittable) {
}
TEST_F(SplitBitDetectorTest, unsplittable_min_count) {
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
for (uint32_t i = 0; i < 10; ++i) {
document::Document::SP doc(
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 146dcab2ba7..8cf89b55ad0 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -10,6 +10,7 @@
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/persistence/spi/persistenceprovider.h>
+#include <vespa/persistence/spi/docentry.h>
#include <functional>
using std::unique_ptr;
@@ -73,7 +74,7 @@ struct TestAndSetTest : PersistenceTestUtils {
static std::string expectedDocEntryString(
api::Timestamp timestamp,
const document::DocumentId & testDocId,
- spi::DocumentMetaFlags removeFlag = spi::NONE);
+ spi::DocumentMetaEnum removeFlag = spi::DocumentMetaEnum::NONE);
};
TEST_F(TestAndSetTest, conditional_put_not_executed_on_condition_mismatch) {
@@ -150,7 +151,7 @@ TEST_F(TestAndSetTest, conditional_remove_executed_on_condition_match) {
ASSERT_EQ(fetchResult(asyncHandler->handleRemove(*remove, createTracker(remove, BUCKET))).getResult(), api::ReturnCode::Result::OK);
EXPECT_EQ(expectedDocEntryString(timestampOne, testDocId) +
- expectedDocEntryString(timestampTwo, testDocId, spi::REMOVE_ENTRY),
+ expectedDocEntryString(timestampTwo, testDocId, spi::DocumentMetaEnum::REMOVE_ENTRY),
dumpBucket(BUCKET_ID));
}
@@ -291,12 +292,12 @@ void TestAndSetTest::assertTestDocumentFoundAndMatchesContent(const document::Fi
std::string TestAndSetTest::expectedDocEntryString(
api::Timestamp timestamp,
const document::DocumentId & docId,
- spi::DocumentMetaFlags removeFlag)
+ spi::DocumentMetaEnum removeFlag)
{
std::stringstream ss;
- ss << "DocEntry(" << timestamp << ", " << removeFlag << ", ";
- if (removeFlag == spi::REMOVE_ENTRY) {
+ ss << "DocEntry(" << timestamp << ", " << int(removeFlag) << ", ";
+ if (removeFlag == spi::DocumentMetaEnum::REMOVE_ENTRY) {
ss << docId << ")\n";
} else {
ss << "Doc(" << docId << "))\n";
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index 494af8a0eff..945a08d910e 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -16,6 +16,7 @@
#include <tests/common/teststorageapp.h>
#include <tests/common/dummystoragelink.h>
#include <tests/storageserver/testvisitormessagesession.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <thread>
@@ -23,6 +24,8 @@
using namespace std::chrono_literals;
using document::test::makeBucketSpace;
+using document::Document;
+using document::DocumentId;
using namespace ::testing;
namespace storage {
@@ -54,7 +57,7 @@ struct TestParams {
struct VisitorTest : Test {
static uint32_t docCount;
- std::vector<document::Document::SP > _documents;
+ std::vector<Document::SP> _documents;
std::unique_ptr<TestVisitorMessageSessionFactory> _messageSessionFactory;
std::unique_ptr<TestServiceLayerApp> _node;
std::unique_ptr<DummyStorageLink> _top;
@@ -92,11 +95,11 @@ struct VisitorTest : Test {
void getMessagesAndReply(
int expectedCount,
TestVisitorMessageSession& session,
- std::vector<document::Document::SP >& docs,
- std::vector<document::DocumentId>& docIds,
+ std::vector<Document::SP> & docs,
+ std::vector<DocumentId>& docIds,
std::vector<std::string>& infoMessages,
api::ReturnCode::Result returnCode = api::ReturnCode::OK);
- uint32_t getMatchingDocuments(std::vector<document::Document::SP >& docs);
+ uint32_t getMatchingDocuments(std::vector<Document::SP>& docs);
protected:
void doTestVisitorInstanceHasConsistencyLevel(
@@ -212,7 +215,7 @@ VisitorTest::initializeTest(const TestParams& params)
uri << "id:test:testdoctype1:n=" << i % 10 << ":http://www.ntnu.no/"
<< i << ".html";
- _documents.push_back(document::Document::SP(
+ _documents.push_back(Document::SP(
_node->getTestDocMan().createDocument(content, uri.str())));
const document::DocumentType& type(_documents.back()->getType());
_documents.back()->setValue(type.getField("headerval"),
@@ -275,8 +278,8 @@ void
VisitorTest::getMessagesAndReply(
int expectedCount,
TestVisitorMessageSession& session,
- std::vector<document::Document::SP >& docs,
- std::vector<document::DocumentId>& docIds,
+ std::vector<Document::SP >& docs,
+ std::vector<DocumentId>& docIds,
std::vector<std::string>& infoMessages,
api::ReturnCode::Result result)
{
@@ -351,7 +354,7 @@ VisitorTest::verifyCreateVisitorReply(
}
uint32_t
-VisitorTest::getMatchingDocuments(std::vector<document::Document::SP >& docs) {
+VisitorTest::getMatchingDocuments(std::vector<Document::SP >& docs) {
uint32_t equalCount = 0;
for (uint32_t i=0; i<docs.size(); ++i) {
for (uint32_t j=0; j<_documents.size(); ++j) {
@@ -381,11 +384,7 @@ VisitorTest::sendGetIterReply(GetIterCommand& cmd,
assert(maxDocuments < _documents.size());
size_t documentCount = maxDocuments != 0 ? maxDocuments : _documents.size();
for (size_t i = 0; i < documentCount; ++i) {
- reply->getEntries().emplace_back(
- std::make_unique<spi::DocEntry>(
- spi::Timestamp(1000 + i),
- spi::NONE,
- document::Document::UP(_documents[i]->clone())));
+ reply->getEntries().push_back(spi::DocEntry::create(spi::Timestamp(1000 + i), Document::UP(_documents[i]->clone())));
}
if (documentCount == _documents.size() || overrideCompleted) {
reply->setCompleted();
@@ -481,8 +480,8 @@ TEST_F(VisitorTest, normal_usage) {
sendGetIterReply(*getIterCmd);
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
getMessagesAndReply(_documents.size(), getSession(0), docs, docIds, infoMessages);
ASSERT_EQ(0, infoMessages.size());
@@ -547,8 +546,8 @@ TEST_F(VisitorTest, document_api_client_error) {
sendGetIterReply(*getIterCmd, api::ReturnCode(api::ReturnCode::OK), 1);
}
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages,
api::ReturnCode::INTERNAL_FAILURE);
@@ -587,8 +586,8 @@ TEST_F(VisitorTest, no_document_api_resending_for_failed_visitor) {
sendGetIterReply(*getIterCmd, api::ReturnCode(api::ReturnCode::OK), 2, true);
}
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
// Use non-critical result. Visitor info message should be received
// after we send a NOT_CONNECTED reply. Failing this message as well
@@ -690,8 +689,8 @@ TEST_F(VisitorTest, no_visitor_notification_for_transient_failures) {
ASSERT_NO_FATAL_FAILURE(initializeTest());
ASSERT_NO_FATAL_FAILURE(sendInitialCreateVisitorAndGetIterRound());
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
// Have to make sure time increases in visitor thread so that resend
// times are reached.
@@ -734,8 +733,8 @@ TEST_F(VisitorTest, notification_sent_if_transient_error_retried_many_times) {
ASSERT_NO_FATAL_FAILURE(initializeTest());
sendInitialCreateVisitorAndGetIterRound();
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
// Have to make sure time increases in visitor thread so that resend
// times are reached.
@@ -774,8 +773,8 @@ VisitorTest::doCompleteVisitingSession(
1,
true);
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages);
@@ -835,8 +834,8 @@ TEST_F(VisitorTest, no_more_iterators_sent_while_memory_used_above_limit) {
std::this_thread::sleep_for(100ms);
ASSERT_EQ(0, _bottom->getNumCommands());
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> docIds;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> docIds;
std::vector<std::string> infoMessages;
getMessagesAndReply(1, getSession(0), docs, docIds, infoMessages);
@@ -898,8 +897,8 @@ struct ReindexingVisitorTest : VisitorTest {
void respond_to_client_put(api::ReturnCode::Result result) {
// Reply to the Put from "client" back to the visitor
- std::vector<document::Document::SP> docs;
- std::vector<document::DocumentId> doc_ids;
+ std::vector<Document::SP> docs;
+ std::vector<DocumentId> doc_ids;
std::vector<std::string> info_messages;
getMessagesAndReply(1, getSession(0), docs, doc_ids, info_messages, result);
}
diff --git a/storage/src/vespa/storage/persistence/asynchandler.cpp b/storage/src/vespa/storage/persistence/asynchandler.cpp
index b5161673af3..3d24ee87879 100644
--- a/storage/src/vespa/storage/persistence/asynchandler.cpp
+++ b/storage/src/vespa/storage/persistence/asynchandler.cpp
@@ -6,6 +6,7 @@
#include "bucketownershipnotifier.h"
#include "bucketprocessor.h"
#include <vespa/persistence/spi/persistenceprovider.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/catchresult.h>
#include <vespa/storageapi/message/bucket.h>
#include <vespa/document/update/documentupdate.h>
diff --git a/storage/src/vespa/storage/persistence/bucketprocessor.h b/storage/src/vespa/storage/persistence/bucketprocessor.h
index c605a9338e3..002cba6c15c 100644
--- a/storage/src/vespa/storage/persistence/bucketprocessor.h
+++ b/storage/src/vespa/storage/persistence/bucketprocessor.h
@@ -7,11 +7,14 @@
#pragma once
#include <vespa/persistence/spi/bucket.h>
-#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/context.h>
+#include <persistence/spi/types.h>
namespace document { class FieldSet; }
-namespace storage::spi { struct PersistenceProvider; }
+namespace storage::spi {
+ struct PersistenceProvider;
+ class DocEntry;
+}
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp
index 0c9cecdb6a1..b9739fcf734 100644
--- a/storage/src/vespa/storage/persistence/mergehandler.cpp
+++ b/storage/src/vespa/storage/persistence/mergehandler.cpp
@@ -6,7 +6,7 @@
#include "apply_bucket_diff_state.h"
#include <vespa/storage/persistence/filestorage/mergestatus.h>
#include <vespa/persistence/spi/persistenceprovider.h>
-#include <vespa/persistence/spi/catchresult.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -130,11 +130,8 @@ void update_op_metrics(FileStorThreadMetrics& metrics, const api::StorageReply &
} // anonymous namespace
void
-MergeHandler::populateMetaData(
- const spi::Bucket& bucket,
- Timestamp maxTimestamp,
- std::vector<spi::DocEntry::UP>& entries,
- spi::Context& context) const
+MergeHandler::populateMetaData(const spi::Bucket& bucket, Timestamp maxTimestamp,
+ DocEntryList& entries, spi::Context& context) const
{
spi::DocumentSelection docSel("");
@@ -150,9 +147,7 @@ MergeHandler::populateMetaData(
if (createIterResult.getErrorCode() != spi::Result::ErrorType::NONE) {
std::ostringstream ss;
ss << "Failed to create iterator for "
- << bucket
- << ": "
- << createIterResult.getErrorMessage();
+ << bucket << ": " << createIterResult.getErrorMessage();
throw std::runtime_error(ss.str());
}
spi::IteratorId iteratorId(createIterResult.getIteratorId());
@@ -163,9 +158,7 @@ MergeHandler::populateMetaData(
if (result.getErrorCode() != spi::Result::ErrorType::NONE) {
std::ostringstream ss;
ss << "Failed to iterate for "
- << bucket
- << ": "
- << result.getErrorMessage();
+ << bucket << ": " << result.getErrorMessage();
throw std::runtime_error(ss.str());
}
auto list = result.steal_entries();
@@ -241,7 +234,7 @@ MergeHandler::buildBucketInfoList(
}
}
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
populateMetaData(bucket, maxTimestamp, entries, context);
for (const auto& entry : entries) {
@@ -402,7 +395,7 @@ MergeHandler::fetchLocalData(
IteratorGuard iteratorGuard(_spi, iteratorId, context);
// Fetch all entries
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
entries.reserve(slots.size());
bool fetchedAllLocalData = false;
bool chunkLimitReached = false;
@@ -557,7 +550,7 @@ MergeHandler::applyDiffLocally(
uint32_t notNeededByteCount = 0;
async_results->mark_stale_bucket_info();
- std::vector<spi::DocEntry::UP> entries;
+ DocEntryList entries;
populateMetaData(bucket, MAX_TIMESTAMP, entries, context);
const document::DocumentTypeRepo & repo = _env.getDocumentTypeRepo();
diff --git a/storage/src/vespa/storage/persistence/mergehandler.h b/storage/src/vespa/storage/persistence/mergehandler.h
index 5e66b364242..f52fe63bc2b 100644
--- a/storage/src/vespa/storage/persistence/mergehandler.h
+++ b/storage/src/vespa/storage/persistence/mergehandler.h
@@ -16,7 +16,6 @@
#include "types.h"
#include "merge_bucket_info_syncer.h"
#include <vespa/persistence/spi/bucket.h>
-#include <vespa/persistence/spi/docentry.h>
#include <vespa/storageapi/message/bucket.h>
#include <vespa/storage/common/cluster_context.h>
#include <vespa/storage/common/messagesender.h>
@@ -30,9 +29,9 @@ namespace storage {
namespace spi {
struct PersistenceProvider;
class Context;
+ class DocEntry;
}
class PersistenceUtil;
-class ApplyBucketDiffEntryResult;
class ApplyBucketDiffState;
class MergeStatus;
@@ -82,6 +81,7 @@ public:
void configure(bool async_apply_bucket_diff) noexcept;
private:
+ using DocEntryList = std::vector<std::unique_ptr<spi::DocEntry>>;
const framework::Clock &_clock;
const ClusterContext &_cluster_context;
PersistenceUtil &_env;
@@ -117,7 +117,7 @@ private:
*/
void populateMetaData(const spi::Bucket&,
Timestamp maxTimestamp,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
spi::Context& context) const;
Document::UP deserializeDiffDocument(
diff --git a/storage/src/vespa/storage/persistence/messages.cpp b/storage/src/vespa/storage/persistence/messages.cpp
index c6f7442cfdc..cf05ccd65b8 100644
--- a/storage/src/vespa/storage/persistence/messages.cpp
+++ b/storage/src/vespa/storage/persistence/messages.cpp
@@ -1,8 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "messages.h"
+#include <vespa/persistence/spi/docentry.h>
#include <ostream>
-#include <cassert>
using document::BucketSpace;
diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h
index 594506f53ba..86cf1ac3b06 100644
--- a/storage/src/vespa/storage/persistence/messages.h
+++ b/storage/src/vespa/storage/persistence/messages.h
@@ -2,7 +2,6 @@
#pragma once
#include <vespa/storageapi/message/internal.h>
-#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/bucket.h>
#include <vespa/persistence/spi/selection.h>
#include <vespa/persistence/spi/read_consistency.h>
@@ -10,6 +9,8 @@
namespace storage {
+namespace spi { class DocEntry; }
+
class GetIterCommand : public api::InternalCommand {
private:
document::Bucket _bucket;
@@ -44,9 +45,10 @@ private:
class GetIterReply : public api::InternalReply {
private:
+ using List = std::vector<std::unique_ptr<spi::DocEntry>>;
document::Bucket _bucket;
- std::vector<spi::DocEntry::UP> _entries;
- bool _completed;
+ List _entries;
+ bool _completed;
public:
typedef std::unique_ptr<GetIterReply> UP;
@@ -58,13 +60,9 @@ public:
document::Bucket getBucket() const override { return _bucket; }
- const std::vector<spi::DocEntry::UP>& getEntries() const {
- return _entries;
- }
+ const List & getEntries() const { return _entries; }
- std::vector<spi::DocEntry::UP>& getEntries() {
- return _entries;
- }
+ List & getEntries() { return _entries; }
void setCompleted(bool completed = true) { _completed = completed; }
bool isCompleted() const { return _completed; }
diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp
index 6a2b5e79450..6d6723a0185 100644
--- a/storage/src/vespa/storage/persistence/processallhandler.cpp
+++ b/storage/src/vespa/storage/persistence/processallhandler.cpp
@@ -5,6 +5,7 @@
#include "persistenceutil.h"
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/persistence/spi/persistenceprovider.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
@@ -31,7 +32,7 @@ public:
if (e.getDocument() != nullptr) {
ost << "Doc(" << e.getDocument()->getId() << ")"
<< ", " << e.getDocument()->getId().getGlobalId().toString()
- << ", size: " << e.getPersistedDocumentSize();
+ << ", size: " << e.getSize();
} else if (e.getDocumentId() != nullptr) {
ost << *e.getDocumentId()
<< ", " << e.getDocumentId()->getGlobalId().toString();
diff --git a/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp b/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp
index 752c1175f22..b7344098698 100644
--- a/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp
+++ b/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp
@@ -2,6 +2,7 @@
#include "provider_error_wrapper.h"
#include "persistenceutil.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/vespalib/util/idestructorcallback.h>
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
index 9a7a451b906..74813e2e891 100644
--- a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
+++ b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp
@@ -3,6 +3,7 @@
#include "simplemessagehandler.h"
#include "persistenceutil.h"
#include <vespa/persistence/spi/persistenceprovider.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/storageapi/message/bucket.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/document/fieldset/fieldsetrepo.h>
diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp
index bd472868e06..2a9ac635cff 100644
--- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp
+++ b/storage/src/vespa/storage/persistence/splitbitdetector.cpp
@@ -3,6 +3,7 @@
#include "splitbitdetector.h"
#include "bucketprocessor.h"
#include <vespa/persistence/spi/persistenceprovider.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/document/bucket/bucketidfactory.h>
#include <vespa/document/base/documentid.h>
#include <vespa/document/fieldset/fieldsets.h>
diff --git a/storage/src/vespa/storage/visiting/countvisitor.cpp b/storage/src/vespa/storage/visiting/countvisitor.cpp
index e20699aa799..3971544a9a0 100644
--- a/storage/src/vespa/storage/visiting/countvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/countvisitor.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "countvisitor.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/documentapi/messagebus/messages/visitor.h>
#include <vespa/vespalib/util/stringfmt.h>
@@ -22,7 +23,7 @@ CountVisitor::CountVisitor(StorageComponent& component,
void
CountVisitor::handleDocuments(const document::BucketId& /*bucketId*/,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList& entries,
HitCounter& hitCounter)
{
for (size_t i = 0; i < entries.size(); ++i) {
diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h
index 4c436b3d07c..4120a96225f 100644
--- a/storage/src/vespa/storage/visiting/countvisitor.h
+++ b/storage/src/vespa/storage/visiting/countvisitor.h
@@ -18,11 +18,11 @@ public:
CountVisitor(StorageComponent&,
const vdslib::Parameters& params);
- virtual void completedVisiting(HitCounter&) override;
+ void completedVisiting(HitCounter&) override;
private:
void handleDocuments(const document::BucketId& bucketId,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& hitCounter) override;
bool _doScheme;
diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp
index 704aaa219cb..3419d329a06 100644
--- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp
+++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "dumpvisitorsingle.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/documentapi/messagebus/messages/putdocumentmessage.h>
@@ -16,8 +17,8 @@ DumpVisitorSingle::DumpVisitorSingle(StorageComponent& component, const vdslib::
{
}
-void DumpVisitorSingle::handleDocuments(const document::BucketId& /*bucketId*/,
- std::vector<spi::DocEntry::UP>& entries,
+void DumpVisitorSingle::handleDocuments(const document::BucketId&,
+ DocEntryList& entries,
HitCounter& hitCounter)
{
LOG(debug, "Visitor %s handling block of %zu documents.",
@@ -25,7 +26,7 @@ void DumpVisitorSingle::handleDocuments(const document::BucketId& /*bucketId*/,
for (size_t i = 0; i < entries.size(); ++i) {
spi::DocEntry& entry(*entries[i]);
- const uint32_t docSize = entry.getDocumentSize();
+ const uint32_t docSize = entry.getSize();
if (entry.isRemove()) {
hitCounter.addHit(*entry.getDocumentId(), docSize);
sendMessage(std::make_unique<documentapi::RemoveDocumentMessage>(*entry.getDocumentId()));
diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h
index 81f4ab7e989..c98bad17e84 100644
--- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h
+++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h
@@ -19,7 +19,7 @@ public:
const vdslib::Parameters& params);
private:
- void handleDocuments(const document::BucketId&, std::vector<spi::DocEntry::UP>&, HitCounter&) override;
+ void handleDocuments(const document::BucketId&, DocEntryList&, HitCounter&) override;
};
struct DumpVisitorSingleFactory : public VisitorFactory {
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
index df965f93ae6..1c3c97d7dcb 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
@@ -2,6 +2,7 @@
#include "recoveryvisitor.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/documentapi/messagebus/messages/visitor.h>
#include <vespa/vespalib/text/stringtokenizer.h>
@@ -31,7 +32,7 @@ RecoveryVisitor::RecoveryVisitor(StorageComponent& component,
void
RecoveryVisitor::handleDocuments(const document::BucketId& bid,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& hitCounter)
{
std::lock_guard guard(_mutex);
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h
index 045c8aeb484..e850eca3f37 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.h
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h
@@ -22,7 +22,7 @@ public:
private:
void handleDocuments(const document::BucketId& bucketId,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& hitCounter) override;
void completedBucket(const document::BucketId&, HitCounter&) override;
diff --git a/storage/src/vespa/storage/visiting/reindexing_visitor.cpp b/storage/src/vespa/storage/visiting/reindexing_visitor.cpp
index 528f83e29cc..0b08c52bdc4 100644
--- a/storage/src/vespa/storage/visiting/reindexing_visitor.cpp
+++ b/storage/src/vespa/storage/visiting/reindexing_visitor.cpp
@@ -3,6 +3,7 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/documentapi/messagebus/messages/putdocumentmessage.h>
#include <vespa/storage/common/reindexing_constants.h>
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance.reindexing_visitor");
@@ -14,8 +15,8 @@ ReindexingVisitor::ReindexingVisitor(StorageComponent& component)
{
}
-void ReindexingVisitor::handleDocuments(const document::BucketId& /*bucketId*/,
- std::vector<spi::DocEntry::UP>& entries,
+void ReindexingVisitor::handleDocuments(const document::BucketId& ,
+ DocEntryList & entries,
HitCounter& hitCounter)
{
auto lock_token = make_lock_access_token();
@@ -26,7 +27,7 @@ void ReindexingVisitor::handleDocuments(const document::BucketId& /*bucketId*/,
// We don't reindex removed documents, as that would be very silly.
continue;
}
- const uint32_t doc_size = entry->getDocumentSize();
+ const uint32_t doc_size = entry->getSize();
hitCounter.addHit(*entry->getDocumentId(), doc_size);
auto msg = std::make_unique<documentapi::PutDocumentMessage>(entry->releaseDocument());
msg->setApproxSize(doc_size);
diff --git a/storage/src/vespa/storage/visiting/reindexing_visitor.h b/storage/src/vespa/storage/visiting/reindexing_visitor.h
index 9bde9903617..d9e18542818 100644
--- a/storage/src/vespa/storage/visiting/reindexing_visitor.h
+++ b/storage/src/vespa/storage/visiting/reindexing_visitor.h
@@ -20,7 +20,7 @@ public:
~ReindexingVisitor() override = default;
private:
- void handleDocuments(const document::BucketId&, std::vector<spi::DocEntry::UP>&, HitCounter&) override;
+ void handleDocuments(const document::BucketId&, DocEntryList&, HitCounter&) override;
bool remap_docapi_message_error_code(api::ReturnCode& in_out_code) override;
vespalib::string make_lock_access_token() const;
};
diff --git a/storage/src/vespa/storage/visiting/testvisitor.cpp b/storage/src/vespa/storage/visiting/testvisitor.cpp
index b5ace673e48..10c79ea6f18 100644
--- a/storage/src/vespa/storage/visiting/testvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/testvisitor.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "testvisitor.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/documentapi/messagebus/messages/visitor.h>
#include <sstream>
@@ -39,7 +40,7 @@ TestVisitor::startingVisitor(const std::vector<document::BucketId>& buckets)
void
TestVisitor::handleDocuments(const document::BucketId& /*bucketId*/,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& /*hitCounter*/)
{
std::ostringstream ost;
diff --git a/storage/src/vespa/storage/visiting/testvisitor.h b/storage/src/vespa/storage/visiting/testvisitor.h
index 482b1347faa..989581ac121 100644
--- a/storage/src/vespa/storage/visiting/testvisitor.h
+++ b/storage/src/vespa/storage/visiting/testvisitor.h
@@ -20,7 +20,7 @@ private:
void startingVisitor(const std::vector<document::BucketId>& buckets) override;
void handleDocuments(const document::BucketId& bucketId,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& hitCounter) override;
void completedBucket(const document::BucketId& bucket, HitCounter& hitCounter) override;
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index dfb78122e07..b66285f5048 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -2,6 +2,7 @@
#include "visitor.h"
#include "visitormetrics.h"
+#include <vespa/persistence/spi/docentry.h>
#include <vespa/storageframework/generic/clock/timer.h>
#include <vespa/storageapi/message/datagram.h>
#include <vespa/storage/persistence/messages.h>
@@ -814,12 +815,11 @@ Visitor::onGetIterReply(const std::shared_ptr<GetIterReply>& reply,
uint64_t size = 0;
for (const auto& entry : reply->getEntries()) {
- size += entry->getPersistedDocumentSize();
+ size += entry->getSize();
}
_visitorStatistics.setDocumentsVisited(
- _visitorStatistics.getDocumentsVisited()
- + reply->getEntries().size());
+ _visitorStatistics.getDocumentsVisited() + reply->getEntries().size());
_visitorStatistics.setBytesVisited(_visitorStatistics.getBytesVisited() + size);
} catch (std::exception& e) {
LOG(warning, "handleDocuments threw exception %s", e.what());
diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h
index 52b2d586c78..8857a54e8df 100644
--- a/storage/src/vespa/storage/visiting/visitor.h
+++ b/storage/src/vespa/storage/visiting/visitor.h
@@ -18,7 +18,6 @@
#include <vespa/storage/common/storagecomponent.h>
#include <vespa/storage/common/visitorfactory.h>
#include <vespa/documentapi/messagebus/messages/documentmessage.h>
-#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/selection.h>
#include <vespa/persistence/spi/read_consistency.h>
#include <list>
@@ -39,6 +38,10 @@ namespace documentapi {
namespace storage {
+namespace spi {
+ class DocEntry;
+}
+
namespace api {
class ReturnCode;
class StorageCommand;
@@ -357,6 +360,7 @@ protected:
// error code, false if the DocumentAPI message should be retried later.
[[nodiscard]] virtual bool remap_docapi_message_error_code(api::ReturnCode& in_out_code);
public:
+ using DocEntryList = std::vector<std::unique_ptr<spi::DocEntry>>;
Visitor(StorageComponent& component);
virtual ~Visitor();
@@ -398,7 +402,7 @@ public:
* vector of documents arrive from the persistence layer.
*/
virtual void handleDocuments(const document::BucketId&,
- std::vector<spi::DocEntry::UP>& entries,
+ DocEntryList & entries,
HitCounter& hitCounter) = 0;
/**