aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-30 11:08:57 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-30 11:08:57 +0000
commit468e68675aa55e3b6200e61ac5aa5bfbe5a6e791 (patch)
tree42200f07080dbe96450b0f59663c40b3466a296d
parent55d3dbb705a58a66901fb384fce83fdf55f2e51e (diff)
Remove the ICommitable interface as it is now void.
Wait happens directly og the LidCommitState interface.
-rw-r--r--searchcore/CMakeLists.txt1
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp59
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp15
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp11
-rw-r--r--searchcore/src/tests/proton/server/visibility_handler/.gitignore1
-rw-r--r--searchcore/src/tests/proton/server/visibility_handler/CMakeLists.txt9
-rw-r--r--searchcore/src/tests/proton/server/visibility_handler/visibility_handler_test.cpp175
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/icommitable.h22
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp20
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/visibilityhandler.cpp95
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/visibilityhandler.h43
20 files changed, 63 insertions, 418 deletions
diff --git a/searchcore/CMakeLists.txt b/searchcore/CMakeLists.txt
index f98a3c87a2e..3e95c60f21b 100644
--- a/searchcore/CMakeLists.txt
+++ b/searchcore/CMakeLists.txt
@@ -144,7 +144,6 @@ vespa_define_module(
src/tests/proton/server/health_adapter
src/tests/proton/server/memory_flush_config_updater
src/tests/proton/server/memoryflush
- src/tests/proton/server/visibility_handler
src/tests/proton/statusreport
src/tests/proton/summaryengine
src/tests/proton/verify_ranksetup
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 53f590189fa..ee22e2668c6 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -274,18 +274,6 @@ struct PairDR : DocumentRetrieverBaseForTest {
}
};
-struct Committer : public ICommitable {
- size_t _commitAndWaitCount;
- Committer() : _commitAndWaitCount(0) { }
- void commitAndWait(ILidCommitState &) override { _commitAndWaitCount++; }
- void commitAndWait(ILidCommitState & tracker, uint32_t ) override {
- commitAndWait(tracker);
- }
- void commitAndWait(ILidCommitState & tracker, const std::vector<uint32_t> & ) override {
- commitAndWait(tracker);
- }
-};
-
size_t getSize() {
return sizeof(DocEntry);
}
@@ -500,10 +488,9 @@ TEST("require that iterator ignoring maxbytes stops at the end, and does not aut
TEST_DO(verifyIterateIgnoringStopSignal(itr));
}
-void verifyReadConsistency(DocumentIterator & itr, Committer & committer) {
- PendingLidTracker lidTracker;
+void verifyReadConsistency(DocumentIterator & itr, ILidCommitState & lidCommitState) {
IDocumentRetriever::SP retriever = doc("id:ns:document::1", Timestamp(2), bucket(5));
- auto commitAndWaitRetriever = std::make_shared<CommitAndWaitDocumentRetriever>(retriever, committer, lidTracker);
+ auto commitAndWaitRetriever = std::make_shared<CommitAndWaitDocumentRetriever>(retriever, lidCommitState);
itr.add(commitAndWaitRetriever);
IterateResult res = itr.iterate(largeNum);
@@ -512,10 +499,46 @@ void verifyReadConsistency(DocumentIterator & itr, Committer & committer) {
TEST_DO(checkEntry(res, 0, Document(*DataType::DOCUMENT, DocumentId("id:ns:document::1")), Timestamp(2)));
}
+class ILidCommitStateProxy : public ILidCommitState {
+public:
+ explicit ILidCommitStateProxy(ILidCommitState & lidState)
+ : _waitCompleteCount(0),
+ _lidState(lidState)
+ {}
+private:
+ State waitState(State state, uint32_t lid) const override {
+ assert(state == State::COMPLETED);
+ _lidState.waitComplete(lid);
+ _waitCompleteCount++;
+ return state;
+ }
+
+ State waitState(State state, const LidList &lids) const override {
+ assert(state == State::COMPLETED);
+ _lidState.waitComplete(lids);
+ _waitCompleteCount++;
+ return state;
+ }
+
+ State waitState(State state) const override {
+ assert(state == State::COMPLETED);
+ _lidState.waitComplete();
+ _waitCompleteCount++;
+ return state;
+ }
+
+public:
+ mutable size_t _waitCompleteCount;
+private:
+ ILidCommitState & _lidState;
+};
+
void verifyStrongReadConsistency(DocumentIterator & itr) {
- Committer committer;
- TEST_DO(verifyReadConsistency(itr, committer));
- EXPECT_EQUAL(1u, committer._commitAndWaitCount);
+ PendingLidTracker lidTracker;
+
+ ILidCommitStateProxy lidCommitState(lidTracker);
+ TEST_DO(verifyReadConsistency(itr, lidCommitState));
+ EXPECT_EQUAL(1u, lidCommitState._waitCompleteCount);
}
TEST("require that default readconsistency does commit") {
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 53050db5a00..06f0ba4109e 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -5,7 +5,6 @@
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
#include <vespa/searchcore/proton/common/hw_info.h>
-#include <vespa/searchcore/proton/common/icommitable.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics.h>
#include <vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h>
@@ -253,18 +252,6 @@ struct TwoAttrSchema : public OneAttrSchema
}
};
-struct Committer : public ICommitable {
- size_t _commitAndWaitCount;
- Committer() : _commitAndWaitCount(0) { }
- void commitAndWait(ILidCommitState & ) override { _commitAndWaitCount++; }
- void commitAndWait(ILidCommitState & tracker, uint32_t ) override {
- commitAndWait(tracker);
- }
- void commitAndWait(ILidCommitState & tracker, const std::vector<uint32_t> & ) override {
- commitAndWait(tracker);
- }
-};
-
struct MyConfigSnapshot
{
typedef std::unique_ptr<MyConfigSnapshot> UP;
@@ -279,7 +266,7 @@ struct MyConfigSnapshot
_bootstrap()
{
auto documenttypesConfig = std::make_shared<DocumenttypesConfig>(_builder.getDocumenttypesConfig());
- TuneFileDocumentDB::SP tuneFileDocumentDB(new TuneFileDocumentDB());
+ auto tuneFileDocumentDB = std::make_shared<TuneFileDocumentDB>();
_bootstrap = std::make_shared<BootstrapConfig>(1,
documenttypesConfig,
_builder.getDocumentTypeRepo(),
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index d309c7f8b1a..a3148aa9372 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -354,7 +354,7 @@ struct MockLidSpaceCompactionHandler : public ILidSpaceCompactionHandler
};
-class MaintenanceControllerFixture : public ICommitable
+class MaintenanceControllerFixture
{
public:
MyExecutor _executor;
@@ -385,16 +385,9 @@ public:
MaintenanceControllerFixture();
- ~MaintenanceControllerFixture() override;
+ ~MaintenanceControllerFixture();
void syncSubDBs();
- void commitAndWait(ILidCommitState & ) override { }
- void commitAndWait(ILidCommitState & tracker, uint32_t ) override {
- commitAndWait(tracker);
- }
- void commitAndWait(ILidCommitState & tracker, const std::vector<uint32_t> & ) override {
- commitAndWait(tracker);
- }
void performSyncSubDBs();
void notifyClusterStateChanged();
void performNotifyClusterStateChanged();
diff --git a/searchcore/src/tests/proton/server/visibility_handler/.gitignore b/searchcore/src/tests/proton/server/visibility_handler/.gitignore
deleted file mode 100644
index 3666e0c37c3..00000000000
--- a/searchcore/src/tests/proton/server/visibility_handler/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-searchcore_visibility_handler_test_app
diff --git a/searchcore/src/tests/proton/server/visibility_handler/CMakeLists.txt b/searchcore/src/tests/proton/server/visibility_handler/CMakeLists.txt
deleted file mode 100644
index cb79d0fae8a..00000000000
--- a/searchcore/src/tests/proton/server/visibility_handler/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchcore_visibility_handler_test_app TEST
- SOURCES
- visibility_handler_test.cpp
- DEPENDS
- searchcore_server
- searchcore_test
-)
-vespa_add_test(NAME searchcore_visibility_handler_test_app COMMAND searchcore_visibility_handler_test_app)
diff --git a/searchcore/src/tests/proton/server/visibility_handler/visibility_handler_test.cpp b/searchcore/src/tests/proton/server/visibility_handler/visibility_handler_test.cpp
deleted file mode 100644
index 2351d5ed0a9..00000000000
--- a/searchcore/src/tests/proton/server/visibility_handler/visibility_handler_test.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/searchcore/proton/server/visibilityhandler.h>
-#include <vespa/searchcore/proton/test/dummy_feed_view.h>
-#include <vespa/searchcore/proton/test/threading_service_observer.h>
-#include <vespa/searchcore/proton/server/executorthreadingservice.h>
-#include <vespa/searchcore/proton/common/pendinglidtracker.h>
-#include <vespa/vespalib/util/lambdatask.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP("visibility_handler_test");
-
-using search::SerialNum;
-using proton::IGetSerialNum;
-using proton::test::DummyFeedView;
-using proton::ExecutorThreadingService;
-using proton::test::ThreadingServiceObserver;
-using proton::IFeedView;
-using proton::VisibilityHandler;
-using vespalib::makeLambdaTask;
-
-namespace {
-
-class MyGetSerialNum : public IGetSerialNum
-{
- SerialNum _serialNum;
-public:
- MyGetSerialNum()
- : _serialNum(0u)
- {}
- SerialNum getSerialNum() const override { return _serialNum; }
- void setSerialNum(SerialNum serialNum) { _serialNum = serialNum; }
-};
-
-
-
-class MyFeedView : public DummyFeedView
-{
- uint32_t _forceCommitCount;
- SerialNum _committedSerialNum;
-public:
- std::unique_ptr<proton::PendingLidTrackerBase> _tracker;
-
-
- MyFeedView()
- : _forceCommitCount(0u),
- _committedSerialNum(0u)
- {}
-
- void setTracker(vespalib::duration visibilityDelay) {
- if (visibilityDelay == vespalib::duration::zero()) {
- _tracker = std::make_unique<proton::PendingLidTracker>();
- } else {
- _tracker = std::make_unique<proton::TwoPhasePendingLidTracker>();
- }
- }
-
- void forceCommit(SerialNum serialNum, DoneCallback) override
- {
- EXPECT_TRUE(serialNum >= _committedSerialNum);
- _committedSerialNum = serialNum;
- ++_forceCommitCount;
- _tracker->produceSnapshot();
- }
-
- uint32_t getForceCommitCount() const { return _forceCommitCount; }
- SerialNum getCommittedSerialNum() const { return _committedSerialNum; }
-};
-
-
-class Fixture
-{
-public:
- MyGetSerialNum _getSerialNum;
- vespalib::ThreadStackExecutor _sharedExecutor;
- ExecutorThreadingService _writeServiceReal;
- ThreadingServiceObserver _writeService;
- std::shared_ptr<MyFeedView> _feedViewReal;
- vespalib::VarHolder<IFeedView::SP> _feedView;
- VisibilityHandler _visibilityHandler;
-
-
- Fixture()
- : _getSerialNum(),
- _sharedExecutor(1, 0x10000),
- _writeServiceReal(_sharedExecutor),
- _writeService(_writeServiceReal),
- _feedViewReal(std::make_shared<MyFeedView>()),
- _feedView(_feedViewReal),
- _visibilityHandler(_getSerialNum, _writeService, _feedView)
- {}
-
- void
- checkCommitPostCondition(uint32_t expForceCommitCount,
- SerialNum expCommittedSerialNum,
- uint32_t expMasterExecuteCnt)
- {
- EXPECT_EQUAL(expForceCommitCount, _feedViewReal->getForceCommitCount());
- EXPECT_EQUAL(expCommittedSerialNum,
- _feedViewReal->getCommittedSerialNum());
- EXPECT_EQUAL(expMasterExecuteCnt,
- _writeService.masterObserver().getExecuteCnt());
- }
-
- proton::PendingLidTracker::Token
- createToken(proton::PendingLidTrackerBase & tracker, SerialNum serialNum, uint32_t lid) {
- if (serialNum == 0) {
- return proton::PendingLidTracker::Token();
- } else {
- return tracker.produce(lid);;
- }
- }
-
- void
- testCommitAndWait(vespalib::duration visibilityDelay, bool internal,
- uint32_t expForceCommitCount,
- SerialNum expCommittedSerialNum,
- uint32_t expMasterExecuteCnt,
- SerialNum currSerialNum = 10u)
- {
- _feedViewReal->setTracker(visibilityDelay);
- _getSerialNum.setSerialNum(currSerialNum);
- constexpr uint32_t MY_LID=13;
- proton::PendingLidTrackerBase * lidTracker = _feedViewReal->_tracker.get();
- {
- proton::PendingLidTracker::Token token = createToken(*lidTracker, currSerialNum, MY_LID);
- }
- if (internal) {
- VisibilityHandler *visibilityHandler = &_visibilityHandler;
- auto task = makeLambdaTask([=]() { visibilityHandler->commitAndWait(*lidTracker, MY_LID); });
- _writeService.master().execute(std::move(task));
- _writeService.master().sync();
- } else {
- _visibilityHandler.commitAndWait(*lidTracker, MY_LID);
- }
- checkCommitPostCondition(expForceCommitCount,
- expCommittedSerialNum,
- expMasterExecuteCnt);
- }
-};
-
-}
-
-TEST_F("Check external commitAndWait with zero visibility delay", Fixture)
-{
- f.testCommitAndWait(0s, false, 0u, 0u, 0u);
-}
-
-TEST_F("Check external commitAndWait with nonzero visibility delay", Fixture)
-{
- f.testCommitAndWait(1s, false, 1u, 10u, 1u);
-}
-
-TEST_F("Check external commitAndWait with nonzero visibility delay and no new feed operation", Fixture)
-{
- f.testCommitAndWait(1s, false, 0u, 0u, 0u, 0u);
-}
-
-TEST_F("Check internal commitAndWait with zero visibility delay", Fixture)
-{
- f.testCommitAndWait(0s, true, 0u, 0u, 1u);
-}
-
-TEST_F("Check internal commitAndWait with nonzero visibility delay", Fixture)
-{
- f.testCommitAndWait(1s, true, 1u, 10u, 1u);
-}
-
-TEST_F("Check internal commitAndWait with nonzero visibility delay and no new feed operation", Fixture)
-{
- f.testCommitAndWait(1s, true, 0u, 0u, 1u, 0u);
-}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchcore/src/vespa/searchcore/proton/common/icommitable.h b/searchcore/src/vespa/searchcore/proton/common/icommitable.h
deleted file mode 100644
index 85aea3fc486..00000000000
--- a/searchcore/src/vespa/searchcore/proton/common/icommitable.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vector>
-namespace proton {
-
-class ILidCommitState;
-
-/**
- * Interface for anyone that needs to commit.
- **/
-class ICommitable {
-public:
- virtual void commitAndWait(ILidCommitState & unCommittedLidTracker) = 0;
- virtual void commitAndWait(ILidCommitState &uncommittedLidTracker, uint32_t lid) = 0;
- virtual void commitAndWait(ILidCommitState &uncommittedLidTracker, const std::vector<uint32_t> & lid) = 0;
-protected:
- virtual ~ICommitable() = default;
-};
-
-}
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp
index daa240e8b12..aa20627600f 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.cpp
@@ -5,10 +5,9 @@
namespace proton {
-CommitAndWaitDocumentRetriever::CommitAndWaitDocumentRetriever(IDocumentRetriever::SP retriever, ICommitable &commit,
+CommitAndWaitDocumentRetriever::CommitAndWaitDocumentRetriever(IDocumentRetriever::SP retriever,
ILidCommitState & unCommittedLidTracker)
: _retriever(std::move(retriever)),
- _commit(commit),
_uncommittedLidsTracker(unCommittedLidTracker)
{ }
@@ -32,7 +31,7 @@ CommitAndWaitDocumentRetriever::getDocumentMetaData(const document::DocumentId &
document::Document::UP
CommitAndWaitDocumentRetriever::getFullDocument(search::DocumentIdT lid) const {
// Ensure that attribute vectors are committed
- _commit.commitAndWait(_uncommittedLidsTracker, lid);
+ _uncommittedLidsTracker.waitComplete(lid);
return _retriever->getFullDocument(lid);
}
@@ -40,7 +39,7 @@ document::Document::UP
CommitAndWaitDocumentRetriever::getPartialDocument(search::DocumentIdT lid, const document::DocumentId & docId,
const document::FieldSet & fieldSet) const
{
- _commit.commitAndWait(_uncommittedLidsTracker, lid);
+ _uncommittedLidsTracker.waitComplete(lid);
return _retriever->getPartialDocument(lid, docId, fieldSet);
}
@@ -48,7 +47,7 @@ void
CommitAndWaitDocumentRetriever::visitDocuments(const LidVector &lids, search::IDocumentVisitor &visitor,
ReadConsistency readConsistency) const
{
- _commit.commitAndWait(_uncommittedLidsTracker, lids);
+ _uncommittedLidsTracker.waitComplete(lids);
_retriever->visitDocuments(lids, visitor, readConsistency);
}
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h
index 8e1ac08fa20..68f34c65362 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h
@@ -4,7 +4,6 @@
#include "i_document_retriever.h"
#include <vespa/searchcore/proton/common/ipendinglidtracker.h>
-#include <vespa/searchcore/proton/common/icommitable.h>
namespace proton {
@@ -16,11 +15,10 @@ namespace proton {
class CommitAndWaitDocumentRetriever : public IDocumentRetriever
{
IDocumentRetriever::SP _retriever;
- ICommitable &_commit;
ILidCommitState &_uncommittedLidsTracker;
using Bucket = storage::spi::Bucket;
public:
- CommitAndWaitDocumentRetriever(IDocumentRetriever::SP retriever, ICommitable &commit, ILidCommitState & unCommittedLidTracker);
+ CommitAndWaitDocumentRetriever(IDocumentRetriever::SP retriever, ILidCommitState & unCommittedLidTracker);
~CommitAndWaitDocumentRetriever() override;
const document::DocumentTypeRepo &getDocumentTypeRepo() const override;
diff --git a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
index 5b9269917d7..93432221e61 100644
--- a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
@@ -103,7 +103,6 @@ vespa_add_library(searchcore_server STATIC
transactionlogmanager.cpp
transactionlogmanagerbase.cpp
updatedonecontext.cpp
- visibilityhandler.cpp
DEPENDS
searchcore_attribute
searchcore_bucketdb
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index ad500d4dac8..a176b1cf8c2 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -166,7 +166,6 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
_writeFilter(),
_transient_memory_usage_provider(std::make_shared<TransientMemoryUsageProvider>()),
_feedHandler(std::make_unique<FeedHandler>(_writeService, tlsSpec, docTypeName, *this, _writeFilter, *this, tlsWriterFactory)),
- _visibility(*_feedHandler, _writeService, _feedView),
_subDBs(*this, *this, *_feedHandler, _docTypeName, _writeService, warmupExecutor, fileHeaderContext,
metricsWireService, getMetrics(), queryLimiter, clock, _configMutex, _baseDir,
makeSubDBConfig(protonCfg.distribution,
@@ -731,7 +730,7 @@ BucketGuard::UP DocumentDB::lockBucket(const document::BucketId &bucket)
std::shared_ptr<std::vector<IDocumentRetriever::SP> >
DocumentDB::getDocumentRetrievers(IDocumentRetriever::ReadConsistency consistency)
{
- return _subDBs.getRetrievers(consistency, _visibility);
+ return _subDBs.getRetrievers(consistency);
}
SerialNum
@@ -905,7 +904,7 @@ DocumentDB::syncFeedView()
_feedView.set(newFeedView);
_feedHandler->setActiveFeedView(newFeedView.get());
_subDBs.createRetrievers();
- _subDBs.maintenanceSync(_maintenanceController, _visibility);
+ _subDBs.maintenanceSync(_maintenanceController);
// Ensure that old feed view is referenced until all index executor tasks
// depending on it has completed.
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index 4c4840446fe..c94b8ffca46 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -18,8 +18,6 @@
#include "ireplayconfig.h"
#include "maintenancecontroller.h"
#include "threading_service_config.h"
-#include "visibilityhandler.h"
-
#include <vespa/metrics/updatehook.h>
#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h>
#include <vespa/searchcore/proton/common/doctypename.h>
@@ -139,7 +137,6 @@ private:
AttributeUsageFilter _writeFilter;
std::shared_ptr<TransientMemoryUsageProvider> _transient_memory_usage_provider;
std::unique_ptr<FeedHandler> _feedHandler;
- VisibilityHandler _visibility;
DocumentSubDBCollection _subDBs;
MaintenanceController _maintenanceController;
ILidSpaceCompactionHandler::Vector _lidSpaceCompactionHandlers;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
index d2b3c7b9d1d..bb1cbcf9371 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
@@ -129,26 +129,26 @@ DocumentSubDBCollection::createRetrievers()
namespace {
IDocumentRetriever::SP
-wrapRetriever(IDocumentRetriever::SP retriever, ICommitable &commit, ILidCommitState & unCommitedLidsTracker)
+wrapRetriever(IDocumentRetriever::SP retriever, ILidCommitState & unCommitedLidsTracker)
{
- return std::make_shared<CommitAndWaitDocumentRetriever>(std::move(retriever), commit, unCommitedLidsTracker);
+ return std::make_shared<CommitAndWaitDocumentRetriever>(std::move(retriever), unCommitedLidsTracker);
}
}
DocumentSubDBCollection::RetrieversSP
-DocumentSubDBCollection::getRetrievers(IDocumentRetriever::ReadConsistency consistency, ICommitable & visibilityHandler) {
+DocumentSubDBCollection::getRetrievers(IDocumentRetriever::ReadConsistency consistency) {
RetrieversSP list = _retrievers.get();
if (consistency == IDocumentRetriever::ReadConsistency::STRONG) {
auto wrappedList = std::make_shared<std::vector<IDocumentRetriever::SP>>();
wrappedList->reserve(list->size());
assert(list->size() == 3);
- wrappedList->push_back(wrapRetriever((*list)[_readySubDbId], visibilityHandler,
+ wrappedList->push_back(wrapRetriever((*list)[_readySubDbId],
getReadySubDB()->getFeedView()->getUncommittedLidsTracker()));
- wrappedList->push_back(wrapRetriever((*list)[_remSubDbId], visibilityHandler,
+ wrappedList->push_back(wrapRetriever((*list)[_remSubDbId],
getRemSubDB()->getFeedView()->getUncommittedLidsTracker()));
- wrappedList->push_back(wrapRetriever((*list)[_notReadySubDbId], visibilityHandler,
+ wrappedList->push_back(wrapRetriever((*list)[_notReadySubDbId],
getNotReadySubDB()->getFeedView()->getUncommittedLidsTracker()));
return wrappedList;
} else {
@@ -156,23 +156,23 @@ DocumentSubDBCollection::getRetrievers(IDocumentRetriever::ReadConsistency consi
}
}
-void DocumentSubDBCollection::maintenanceSync(MaintenanceController &mc, ICommitable &commit) {
+void DocumentSubDBCollection::maintenanceSync(MaintenanceController &mc) {
RetrieversSP retrievers = _retrievers.get();
MaintenanceDocumentSubDB readySubDB(getReadySubDB()->getName(),
_readySubDbId,
getReadySubDB()->getDocumentMetaStoreContext().getSP(),
- wrapRetriever((*retrievers)[_readySubDbId], commit,
+ wrapRetriever((*retrievers)[_readySubDbId],
getReadySubDB()->getFeedView()->getUncommittedLidsTracker()),
getReadySubDB()->getFeedView());
MaintenanceDocumentSubDB remSubDB(getRemSubDB()->getName(),
_remSubDbId,
getRemSubDB()->getDocumentMetaStoreContext().getSP(),
- wrapRetriever((*retrievers)[_remSubDbId], commit, getRemSubDB()->getFeedView()->getUncommittedLidsTracker()),
+ wrapRetriever((*retrievers)[_remSubDbId], getRemSubDB()->getFeedView()->getUncommittedLidsTracker()),
getRemSubDB()->getFeedView());
MaintenanceDocumentSubDB notReadySubDB(getNotReadySubDB()->getName(),
_notReadySubDbId,
getNotReadySubDB()->getDocumentMetaStoreContext().getSP(),
- wrapRetriever((*retrievers)[_notReadySubDbId], commit,
+ wrapRetriever((*retrievers)[_notReadySubDbId],
getNotReadySubDB()->getFeedView()->getUncommittedLidsTracker()),
getNotReadySubDB()->getFeedView());
mc.syncSubDBs(readySubDB, remSubDB, notReadySubDB);
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
index 83ebef18274..317ec191d60 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
@@ -32,7 +32,6 @@ class DocumentDBConfig;
struct DocumentDBTaggedMetrics;
class MaintenanceController;
struct MetricsWireService;
-class ICommitable;
struct IDocumentDBReferenceResolver;
class IGetSerialNum;
class DocTypeName;
@@ -119,10 +118,10 @@ public:
void setBucketStateCalculator(const IBucketStateCalculatorSP &calc);
void createRetrievers();
- void maintenanceSync(MaintenanceController &mc, ICommitable &commit);
+ void maintenanceSync(MaintenanceController &mc);
// Internally synchronized
- RetrieversSP getRetrievers(IDocumentRetriever::ReadConsistency consistency, ICommitable & visibilityHandler);
+ RetrieversSP getRetrievers(IDocumentRetriever::ReadConsistency consistency);
IDocumentSubDB *getReadySubDB() { return _subDBs[_readySubDbId]; }
const IDocumentSubDB *getReadySubDB() const { return _subDBs[_readySubDbId]; }
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h
index 44308d49dab..3468ec40923 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h
@@ -6,7 +6,6 @@
#include "i_lid_space_compaction_handler.h"
#include "i_operation_storer.h"
#include "iheartbeathandler.h"
-#include <vespa/searchcore/proton/common/icommitable.h>
#include <vespa/searchcore/proton/matching/isessioncachepruner.h>
#include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index 481fe799f8f..aaae7621562 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -6,7 +6,6 @@
#include "reconfig_params.h"
#include "i_document_subdb_owner.h"
#include "ibucketstatecalculator.h"
-#include <vespa/searchcore/proton/common/icommitable.h>
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/flushengine/threadedflushtarget.h>
#include <vespa/searchcore/proton/index/index_manager_initializer.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
index 0fcf9b99718..4e021e74189 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
@@ -26,7 +26,6 @@ class DocumentDBConfig;
struct IDocumentDBReferenceResolver;
struct MetricsWireService;
class GidToLidChangeHandler;
-class ICommitable;
/**
* The searchable sub database supports searching and keeps all attribute fields in memory and
diff --git a/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.cpp
deleted file mode 100644
index 67deee74e88..00000000000
--- a/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "visibilityhandler.h"
-#include <vespa/vespalib/util/isequencedtaskexecutor.h>
-#include <vespa/vespalib/util/lambdatask.h>
-
-using vespalib::makeLambdaTask;
-
-namespace proton {
-
-VisibilityHandler::VisibilityHandler(const IGetSerialNum & serial,
- IThreadingService &writeService,
- const FeedViewHolder & feedView)
- : _serial(serial),
- _writeService(writeService),
- _feedView(feedView),
- _lastCommitSerialNum(0),
- _lock()
-{
-}
-
-VisibilityHandler::~VisibilityHandler() = default;
-
-void
-VisibilityHandler::internalCommit(bool force)
-{
- if (_writeService.master().isCurrentThread()) {
- performCommit(force);
- } else {
- std::lock_guard<std::mutex> guard(_lock);
- bool wasCommitTaskSpawned = startCommit(guard, force);
- (void) wasCommitTaskSpawned;
- }
-}
-
-void
-VisibilityHandler::commitAndWait(ILidCommitState & unCommittedLidTracker)
-{
- ILidCommitState::State state = unCommittedLidTracker.getState();
- if (state == ILidCommitState::State::NEED_COMMIT) {
- internalCommit(false);
- }
- if (state != ILidCommitState::State::COMPLETED) {
- unCommittedLidTracker.waitComplete();
- }
-}
-
-void
-VisibilityHandler::commitAndWait(ILidCommitState & unCommittedLidTracker, uint32_t lid) {
- ILidCommitState::State state = unCommittedLidTracker.getState(lid);
- if (state == ILidCommitState::State::NEED_COMMIT) {
- internalCommit(false);
- }
- if (state != ILidCommitState::State::COMPLETED) {
- unCommittedLidTracker.waitComplete(lid);
- }
-}
-void
-VisibilityHandler::commitAndWait(ILidCommitState & unCommittedLidTracker, const std::vector<uint32_t> & lids) {
- ILidCommitState::State state = unCommittedLidTracker.getState(lids);
- if (state == ILidCommitState::State::NEED_COMMIT) {
- internalCommit(false);
- }
- if (state != ILidCommitState::State::COMPLETED) {
- unCommittedLidTracker.waitComplete(lids);
- }
-}
-
-bool
-VisibilityHandler::startCommit(const std::lock_guard<std::mutex> &unused, bool force)
-{
- (void) unused;
- SerialNum current = _serial.getSerialNum();
- if ((current > _lastCommitSerialNum) || force) {
- _writeService.master().execute(makeLambdaTask([this, force]() { performCommit(force);}));
- return true;
- }
- return false;
-}
-
-void
-VisibilityHandler::performCommit(bool force)
-{
- // Called by master thread
- SerialNum current = _serial.getSerialNum();
- if ((current > _lastCommitSerialNum) || force) {
- IFeedView::SP feedView(_feedView.get());
- if (feedView) {
- feedView->forceCommit(current);
- _lastCommitSerialNum = current;
- }
- }
-}
-
-}
diff --git a/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.h b/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.h
deleted file mode 100644
index 7286a532d43..00000000000
--- a/searchcore/src/vespa/searchcore/proton/server/visibilityhandler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include "ifeedview.h"
-#include "igetserialnum.h"
-#include <vespa/searchcore/proton/common/icommitable.h>
-#include <vespa/searchcorespi/index/ithreadingservice.h>
-#include <vespa/vespalib/util/varholder.h>
-#include <vespa/vespalib/util/time.h>
-#include <mutex>
-
-namespace proton {
-
-/**
- * Handle commit of changes withing the allowance of visibilitydelay.
- * It will both handle background commit jobs and the necessary commit and wait for sequencing.
- **/
-class VisibilityHandler : public ICommitable
-{
- using IThreadingService = searchcorespi::index::IThreadingService;
- using FeedViewHolder = vespalib::VarHolder<IFeedView::SP>;
-public:
- typedef search::SerialNum SerialNum;
- VisibilityHandler(const IGetSerialNum &serial,
- IThreadingService &threadingService,
- const FeedViewHolder &feedView);
- ~VisibilityHandler() override;
- void commitAndWait(ILidCommitState & unCommittedLidTracker) override;
- void commitAndWait(ILidCommitState &, uint32_t ) override;
- void commitAndWait(ILidCommitState &, const std::vector<uint32_t> & ) override;
-private:
- bool startCommit(const std::lock_guard<std::mutex> &unused, bool force);
- void performCommit(bool force);
- void internalCommit(bool force);
- const IGetSerialNum & _serial;
- IThreadingService & _writeService;
- const FeedViewHolder & _feedView;
- SerialNum _lastCommitSerialNum;
- std::mutex _lock;
-};
-
-}