summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-30 14:46:21 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-30 15:39:37 +0000
commit7b57360527d407f6588d99d8bef2333243e83f21 (patch)
tree9ca2143e638c06d11945cd5512e7677bf1fac5ac /searchcore
parent964c5024198ad07ce4658d7782cf0103bb467c7d (diff)
Move uncommitted lids tracker from feedview to subdb to avoid ownership issues.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp40
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp25
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp16
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/ifeedview.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h9
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp32
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h1
25 files changed, 118 insertions, 100 deletions
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index cb7fccea50f..25cf028ecca 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -151,6 +151,7 @@ struct Fixture
EmptyConstantValueFactory _constantValueFactory;
ConstantValueRepo _constantValueRepo;
vespalib::ThreadStackExecutor _summaryExecutor;
+ PendingLidTracker _pendingLidsForCommit;
ViewSet _views;
MyDocumentDBReferenceResolver _resolver;
ConfigurerUP _configurer;
@@ -165,6 +166,7 @@ Fixture::Fixture()
_constantValueFactory(),
_constantValueRepo(_constantValueFactory),
_summaryExecutor(8, 128*1024),
+ _pendingLidsForCommit(),
_views(),
_resolver(),
_configurer()
@@ -173,7 +175,7 @@ Fixture::Fixture()
vespalib::mkdir(BASE_DIR);
initViewSet(_views);
_configurer = std::make_unique<Configurer>(_views._summaryMgr, _views.searchView, _views.feedView, _queryLimiter,
- _constantValueRepo, _clock, "test", 0);
+ _constantValueRepo, _clock, "test", 0);
}
Fixture::~Fixture() = default;
@@ -213,14 +215,15 @@ Fixture::initViewSet(ViewSet &views)
*views._gidToLidChangeHandler,
views.repo,
views._writeService),
- SearchableFeedView::PersistentParams(
+ SearchableFeedView::PersistentParams(
views.serialNum,
views.serialNum,
views._docTypeName,
0u /* subDbId */,
SubDbType::READY),
- FastAccessFeedView::Context(attrWriter, views._docIdLimit),
- SearchableFeedView::Context(indexWriter)));
+ _pendingLidsForCommit,
+ FastAccessFeedView::Context(attrWriter, views._docIdLimit),
+ SearchableFeedView::Context(indexWriter)));
}
@@ -237,7 +240,7 @@ struct MyFastAccessFeedView
std::shared_ptr<IGidToLidChangeHandler> _gidToLidChangeHandler;
VarHolder<FastAccessFeedView::SP> _feedView;
- explicit MyFastAccessFeedView(IThreadingService &writeService)
+ explicit MyFastAccessFeedView(IThreadingService &writeService, PendingLidTrackerBase & pendinglidsForCommit)
: _fileHeaderContext(),
_docIdLimit(0),
_writeService(writeService),
@@ -246,14 +249,14 @@ struct MyFastAccessFeedView
_gidToLidChangeHandler(make_shared<DummyGidToLidChangeHandler>()),
_feedView()
{
- init();
+ init(pendinglidsForCommit);
}
~MyFastAccessFeedView();
- void init() {
- ISummaryAdapter::SP summaryAdapter(new MySummaryAdapter());
- Schema::SP schema(new Schema());
+ void init(PendingLidTrackerBase & pendinglidsForCommit) {
+ MySummaryAdapter::SP summaryAdapter = std::make_shared<MySummaryAdapter>();
+ Schema::SP schema = std::make_shared<Schema>();
_dmsc = make_shared<DocumentMetaStoreContext>(std::make_shared<BucketDBOwner>());
std::shared_ptr<const DocumentTypeRepo> repo = createRepo();
StoreOnlyFeedView::Context storeOnlyCtx(summaryAdapter, schema, _dmsc, *_gidToLidChangeHandler, repo,
@@ -263,7 +266,7 @@ struct MyFastAccessFeedView
_writeService.attributeFieldWriter(), _writeService.shared(), _hwInfo);
auto writer = std::make_shared<AttributeWriter>(mgr);
FastAccessFeedView::Context fastUpdateCtx(writer, _docIdLimit);
- _feedView.set(std::make_shared<FastAccessFeedView>(storeOnlyCtx, params, fastUpdateCtx));
+ _feedView.set(std::make_shared<FastAccessFeedView>(storeOnlyCtx, params, pendinglidsForCommit, fastUpdateCtx));
}
};
@@ -273,12 +276,13 @@ struct FastAccessFixture
{
vespalib::ThreadStackExecutor _sharedExecutor;
ExecutorThreadingService _writeService;
+ PendingLidTracker _pendingLidsForCommit;
MyFastAccessFeedView _view;
FastAccessDocSubDBConfigurer _configurer;
FastAccessFixture()
: _sharedExecutor(1, 0x10000),
_writeService(_sharedExecutor),
- _view(_writeService),
+ _view(_writeService, _pendingLidsForCommit),
_configurer(_view._feedView, std::make_unique<AttributeWriterFactory>(), "test")
{
vespalib::rmdir(BASE_DIR, true);
@@ -462,7 +466,7 @@ TEST_F("require that we can reconfigure attribute manager", Fixture)
AttributeCollectionSpec spec(specList, 1, 0);
ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true));
// Use new config snapshot == old config snapshot (only relevant for reprocessing)
- f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver);
+ f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver, f._pendingLidsForCommit);
ViewPtrs n = f._views.getViewPtrs();
{ // verify search view
@@ -501,7 +505,7 @@ checkAttributeWriterChangeOnRepoChange(Fixture &f, bool docTypeRepoChanged)
AttributeCollectionSpec spec(specList, 1, 0);
ReconfigParams params(CCR().setDocumentTypeRepoChanged(docTypeRepoChanged));
// Use new config snapshot == old config snapshot (only relevant for reprocessing)
- f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver);
+ f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver, f._pendingLidsForCommit);
auto newAttributeWriter = getAttributeWriter(f);
if (docTypeRepoChanged) {
EXPECT_NOT_EQUAL(oldAttributeWriter, newAttributeWriter);
@@ -522,7 +526,7 @@ TEST_F("require that reconfigure returns reprocessing initializer when changing
AttributeCollectionSpec spec(specList, 1, 0);
ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true));
IReprocessingInitializer::UP init =
- f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver);
+ f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver, f._pendingLidsForCommit);
EXPECT_TRUE(init.get() != nullptr);
EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr);
@@ -534,7 +538,7 @@ TEST_F("require that we can reconfigure attribute writer", FastAccessFixture)
AttributeCollectionSpec::AttributeList specList;
AttributeCollectionSpec spec(specList, 1, 0);
FastAccessFeedView::SP o = f._view._feedView.get();
- f._configurer.reconfigure(*createConfig(), *createConfig(), spec);
+ f._configurer.reconfigure(*createConfig(), *createConfig(), spec, f._pendingLidsForCommit);
FastAccessFeedView::SP n = f._view._feedView.get();
FastAccessFeedViewComparer cmp(o, n);
@@ -549,7 +553,7 @@ TEST_F("require that reconfigure returns reprocessing initializer", FastAccessFi
AttributeCollectionSpec::AttributeList specList;
AttributeCollectionSpec spec(specList, 1, 0);
IReprocessingInitializer::UP init =
- f._configurer.reconfigure(*createConfig(), *createConfig(), spec);
+ f._configurer.reconfigure(*createConfig(), *createConfig(), spec, f._pendingLidsForCommit);
EXPECT_TRUE(init.get() != nullptr);
EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr);
@@ -561,7 +565,7 @@ TEST_F("require that we can reconfigure summary manager", Fixture)
ViewPtrs o = f._views.getViewPtrs();
ReconfigParams params(CCR().setSummarymapChanged(true));
// Use new config snapshot == old config snapshot (only relevant for reprocessing)
- f._configurer->reconfigure(*createConfig(), *createConfig(), params, f._resolver);
+ f._configurer->reconfigure(*createConfig(), *createConfig(), params, f._resolver, f._pendingLidsForCommit);
ViewPtrs n = f._views.getViewPtrs();
{ // verify search view
@@ -581,7 +585,7 @@ TEST_F("require that we can reconfigure matchers", Fixture)
ViewPtrs o = f._views.getViewPtrs();
// Use new config snapshot == old config snapshot (only relevant for reprocessing)
f._configurer->reconfigure(*createConfig(o.fv->getSchema()), *createConfig(o.fv->getSchema()),
- ReconfigParams(CCR().setRankProfilesChanged(true)), f._resolver);
+ ReconfigParams(CCR().setRankProfilesChanged(true)), f._resolver, f._pendingLidsForCommit);
ViewPtrs n = f._views.getViewPtrs();
{ // verify search view
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index b9683c49c11..3adca0abb25 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -489,6 +489,7 @@ FeedTokenContext::~FeedTokenContext() = default;
struct FixtureBase
{
MyTracer _tracer;
+ PendingLidTracker _pendingLidsForCommit;
SchemaContext sc;
IIndexWriter::SP iw;
ISummaryAdapter::SP sa;
@@ -677,6 +678,7 @@ struct FixtureBase
FixtureBase::FixtureBase()
: _tracer(),
+ _pendingLidsForCommit(),
sc(),
iw(std::make_shared<MyIndexWriter>(_tracer)),
sa(std::make_shared<MySummaryAdapter>(*sc._builder->getDocumentTypeRepo())),
@@ -721,6 +723,7 @@ struct SearchableFeedViewFixture : public FixtureBase
sc.getRepo(),
_writeService),
pc.getParams(),
+ _pendingLidsForCommit,
FastAccessFeedView::Context(aw, _docIdLimit),
SearchableFeedView::Context(iw))
{
@@ -744,6 +747,7 @@ struct FastAccessFeedViewFixture : public FixtureBase
sc.getRepo(),
_writeService),
pc.getParams(),
+ _pendingLidsForCommit,
FastAccessFeedView::Context(aw, _docIdLimit))
{
}
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
index c162d7dcd28..5f033b1b73a 100644
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
@@ -43,7 +43,7 @@ private:
int &_heartbeatCount;
public:
- MySummaryAdapter(int &removeCount, int &putCount, int &heartbeatCount)
+ MySummaryAdapter(int &removeCount, int &putCount, int &heartbeatCount) noexcept
: _rmCount(removeCount),
_putCount(putCount),
_heartbeatCount(heartbeatCount) {
@@ -86,6 +86,7 @@ struct MyMinimalFeedView : public MyMinimalFeedViewBase, public StoreOnlyFeedVie
const DocumentMetaStore::SP &metaStore,
searchcorespi::index::IThreadingService &writeService,
const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit,
int &outstandingMoveOps_) :
MyMinimalFeedViewBase(),
StoreOnlyFeedView(StoreOnlyFeedView::Context(summaryAdapter,
@@ -94,7 +95,8 @@ struct MyMinimalFeedView : public MyMinimalFeedViewBase, public StoreOnlyFeedVie
*gidToLidChangeHandler,
myGetDocumentTypeRepo(),
writeService),
- params),
+ params,
+ pendingLidsForCommit),
removeMultiAttributesCount(0),
removeMultiIndexFieldsCount(0),
heartBeatAttributesCount(0),
@@ -132,9 +134,10 @@ struct MoveOperationFeedView : public MyMinimalFeedView {
const DocumentMetaStore::SP &metaStore,
searchcorespi::index::IThreadingService &writeService,
const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit,
int &outstandingMoveOps_) :
MyMinimalFeedView(summaryAdapter, metaStore, writeService,
- params, outstandingMoveOps_),
+ params, pendingLidsForCommit, outstandingMoveOps_),
putAttributesCount(0),
putIndexFieldsCount(0),
removeAttributesCount(0),
@@ -187,6 +190,7 @@ struct FixtureBase {
DocumentMetaStore::SP metaStore;
vespalib::ThreadStackExecutor sharedExecutor;
ExecutorThreadingService writeService;
+ PendingLidTracker pendingLidsForCoomit;
typename FeedViewType::UP feedview;
SerialNum serial_num;
@@ -195,21 +199,22 @@ struct FixtureBase {
putCount(0),
heartbeatCount(0),
outstandingMoveOps(0),
- metaStore(new DocumentMetaStore(std::make_shared<BucketDBOwner>(),
- DocumentMetaStore::getFixedName(),
- search::GrowStrategy(),
- std::make_shared<DocumentMetaStore::DefaultGidCompare>(),
- subDbType)),
+ metaStore(std::make_shared<DocumentMetaStore>(std::make_shared<BucketDBOwner>(),
+ DocumentMetaStore::getFixedName(),
+ search::GrowStrategy(),
+ std::make_shared<DocumentMetaStore::DefaultGidCompare>(),
+ subDbType)),
sharedExecutor(1, 0x10000),
writeService(sharedExecutor),
+ pendingLidsForCoomit(),
feedview(),
serial_num(2u)
{
StoreOnlyFeedView::PersistentParams params(0, 0, DocTypeName("foo"), subdb_id, subDbType);
metaStore->constructFreeList();
- ISummaryAdapter::SP adapter = std::make_unique<MySummaryAdapter>(removeCount, putCount, heartbeatCount);
+ ISummaryAdapter::SP adapter = std::make_shared<MySummaryAdapter>(removeCount, putCount, heartbeatCount);
feedview = std::make_unique<FeedViewType>(adapter, metaStore, writeService,
- params, outstandingMoveOps);
+ params, pendingLidsForCoomit, outstandingMoveOps);
}
~FixtureBase() {
diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
index 6f52a49749e..abff2b891ba 100644
--- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
@@ -233,11 +233,6 @@ CombiningFeedView::forceCommit(search::SerialNum serialNum, DoneCallback onDone)
}
}
-ILidCommitState &
-CombiningFeedView::getUncommittedLidsTracker() {
- LOG_ABORT("CombiningFeedView::getUncommittedLidsTracker should never be called.");
-}
-
bool
CombiningFeedView::isDrained() const
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h
index ce5cb303aba..03e5f6aba21 100644
--- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h
@@ -79,7 +79,6 @@ public:
void sync() override;
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &pruneOp) override;
void handleCompactLidSpace(const CompactLidSpaceOperation &op) override;
- ILidCommitState & getUncommittedLidsTracker() override;
bool isDrained() const override;
// Called by document db executor
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
index bb1cbcf9371..85d9c767535 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
@@ -129,9 +129,9 @@ DocumentSubDBCollection::createRetrievers()
namespace {
IDocumentRetriever::SP
-wrapRetriever(IDocumentRetriever::SP retriever, ILidCommitState & unCommitedLidsTracker)
+wrapRetriever(IDocumentRetriever::SP retriever, ILidCommitState & unCommittedLidsTracker)
{
- return std::make_shared<CommitAndWaitDocumentRetriever>(std::move(retriever), unCommitedLidsTracker);
+ return std::make_shared<CommitAndWaitDocumentRetriever>(std::move(retriever), unCommittedLidsTracker);
}
}
@@ -145,11 +145,11 @@ DocumentSubDBCollection::getRetrievers(IDocumentRetriever::ReadConsistency consi
wrappedList->reserve(list->size());
assert(list->size() == 3);
wrappedList->push_back(wrapRetriever((*list)[_readySubDbId],
- getReadySubDB()->getFeedView()->getUncommittedLidsTracker()));
+ getReadySubDB()->getUncommittedLidsTracker()));
wrappedList->push_back(wrapRetriever((*list)[_remSubDbId],
- getRemSubDB()->getFeedView()->getUncommittedLidsTracker()));
+ getRemSubDB()->getUncommittedLidsTracker()));
wrappedList->push_back(wrapRetriever((*list)[_notReadySubDbId],
- getNotReadySubDB()->getFeedView()->getUncommittedLidsTracker()));
+ getNotReadySubDB()->getUncommittedLidsTracker()));
return wrappedList;
} else {
return list;
@@ -162,18 +162,18 @@ void DocumentSubDBCollection::maintenanceSync(MaintenanceController &mc) {
_readySubDbId,
getReadySubDB()->getDocumentMetaStoreContext().getSP(),
wrapRetriever((*retrievers)[_readySubDbId],
- getReadySubDB()->getFeedView()->getUncommittedLidsTracker()),
+ getReadySubDB()->getUncommittedLidsTracker()),
getReadySubDB()->getFeedView());
MaintenanceDocumentSubDB remSubDB(getRemSubDB()->getName(),
_remSubDbId,
getRemSubDB()->getDocumentMetaStoreContext().getSP(),
- wrapRetriever((*retrievers)[_remSubDbId], getRemSubDB()->getFeedView()->getUncommittedLidsTracker()),
+ wrapRetriever((*retrievers)[_remSubDbId], getRemSubDB()->getUncommittedLidsTracker()),
getRemSubDB()->getFeedView());
MaintenanceDocumentSubDB notReadySubDB(getNotReadySubDB()->getName(),
_notReadySubDbId,
getNotReadySubDB()->getDocumentMetaStoreContext().getSP(),
wrapRetriever((*retrievers)[_notReadySubDbId],
- getNotReadySubDB()->getFeedView()->getUncommittedLidsTracker()),
+ getNotReadySubDB()->getUncommittedLidsTracker()),
getNotReadySubDB()->getFeedView());
mc.syncSubDBs(readySubDB, remSubDB, notReadySubDB);
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
index be63bea85e4..6fcf4fc609d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
@@ -116,6 +116,7 @@ FastAccessDocSubDB::initFeedView(IAttributeWriter::SP writer, const DocumentDBCo
auto feedView = std::make_shared<FastAccessFeedView>(
getStoreOnlyFeedViewContext(configSnapshot),
getFeedViewPersistentParams(),
+ getUncommittedLidsTracker(),
FastAccessFeedView::Context(std::move(writer), _docIdLimit));
_fastAccessFeedView.set(feedView);
@@ -264,7 +265,7 @@ FastAccessDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const
AttributeCollectionSpec::UP attrSpec =
createAttributeSpec(newConfigSnapshot.getAttributesConfig(), serialNum);
IReprocessingInitializer::UP initializer =
- configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, *attrSpec);
+ configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, *attrSpec, getUncommittedLidsTracker());
if (initializer->hasReprocessors()) {
tasks.push_back(IReprocessingTask::SP(createReprocessingTask(*initializer,
newConfigSnapshot.getDocumentTypeRepoSP()).release()));
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp
index ab257d56848..e35e8c27113 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp
@@ -18,7 +18,8 @@ void
FastAccessDocSubDBConfigurer::reconfigureFeedView(const FastAccessFeedView::SP &curr,
const Schema::SP &schema,
const std::shared_ptr<const DocumentTypeRepo> &repo,
- IAttributeWriter::SP writer)
+ IAttributeWriter::SP writer,
+ PendingLidTrackerBase & pendingLidsForCommit)
{
_feedView.set(std::make_shared<FastAccessFeedView>(
StoreOnlyFeedView::Context(curr->getSummaryAdapter(),
@@ -27,7 +28,8 @@ FastAccessDocSubDBConfigurer::reconfigureFeedView(const FastAccessFeedView::SP &
curr->getGidToLidChangeHandler(),
repo,
curr->getWriteService()),
- curr->getPersistentParams(),
+ curr->getPersistentParams(),
+ pendingLidsForCommit,
FastAccessFeedView::Context(std::move(writer),curr->getDocIdLimit())));
}
@@ -45,11 +47,13 @@ FastAccessDocSubDBConfigurer::~FastAccessDocSubDBConfigurer() = default;
IReprocessingInitializer::UP
FastAccessDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
- const AttributeCollectionSpec &attrSpec)
+ const AttributeCollectionSpec &attrSpec,
+ PendingLidTrackerBase & pendingLidsForCommit)
{
FastAccessFeedView::SP oldView = _feedView.get();
IAttributeWriter::SP writer = _factory->create(oldView->getAttributeWriter(), attrSpec);
- reconfigureFeedView(oldView, newConfig.getSchemaSP(), newConfig.getDocumentTypeRepoSP(), writer);
+ reconfigureFeedView(oldView, newConfig.getSchemaSP(), newConfig.getDocumentTypeRepoSP(),
+ writer, pendingLidsForCommit);
const document::DocumentType *newDocType = newConfig.getDocumentType();
const document::DocumentType *oldDocType = oldConfig.getDocumentType();
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h
index dc54bdc421d..659067ce67d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.h
@@ -25,7 +25,8 @@ private:
void reconfigureFeedView(const FastAccessFeedView::SP &curr,
const search::index::Schema::SP &schema,
const std::shared_ptr<const document::DocumentTypeRepo> &repo,
- IAttributeWriter::SP attrWriter);
+ IAttributeWriter::SP attrWriter,
+ PendingLidTrackerBase & pendingLidsForCommit);
public:
FastAccessDocSubDBConfigurer(FeedViewVarHolder &feedView,
@@ -35,7 +36,8 @@ public:
IReprocessingInitializer::UP reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
- const AttributeCollectionSpec &attrSpec);
+ const AttributeCollectionSpec &attrSpec,
+ PendingLidTrackerBase & pendingLidsForCommit);
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp
index 52b4d869ce8..7fd3e194214 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp
@@ -61,9 +61,9 @@ FastAccessFeedView::heartBeatAttributes(SerialNum serialNum)
_attributeWriter->heartBeat(serialNum);
}
-FastAccessFeedView::FastAccessFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx,
- const PersistentParams &params, const Context &ctx)
- : Parent(storeOnlyCtx, params),
+FastAccessFeedView::FastAccessFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx, const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit, const Context &ctx)
+ : Parent(storeOnlyCtx, params, pendingLidsForCommit),
_attributeWriter(ctx._attrWriter),
_docIdLimit(ctx._docIdLimit)
{}
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.h
index e0823be3e43..ff34b0c32c2 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.h
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.h
@@ -51,8 +51,8 @@ protected:
void internalForceCommit(SerialNum serialNum, OnForceCommitDoneType onCommitDone) override;
public:
- FastAccessFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx,
- const PersistentParams &params, const Context &ctx);
+ FastAccessFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx, const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit, const Context &ctx);
~FastAccessFeedView();
virtual const IAttributeWriter::SP &getAttributeWriter() const {
diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
index 65724e66913..c19f38b738f 100644
--- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
@@ -41,6 +41,7 @@ class ISummaryAdapter;
class ISummaryManager;
class ReconfigParams;
class RemoveDocumentsOperation;
+class PendingLidTrackerBase;
/**
* Interface for a document sub database that handles a subset of the documents that belong to a
@@ -119,6 +120,7 @@ public:
virtual std::shared_ptr<IDocumentDBReference> getDocumentDBReference() = 0;
virtual void tearDownReferences(IDocumentDBReferenceResolver &resolver) = 0;
virtual void validateDocStore(FeedHandler &op, SerialNum serialNum) const = 0;
+ virtual PendingLidTrackerBase & getUncommittedLidsTracker() = 0;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h
index aea8c909b8c..afafd397afc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h
@@ -4,7 +4,6 @@
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/searchlib/common/serialnum.h>
-#include <vespa/searchcore/proton/common/ipendinglidtracker.h>
namespace document { class DocumentTypeRepo; }
@@ -64,7 +63,6 @@ public:
void forceCommit(search::SerialNum serialNum) { forceCommit(serialNum, DoneCallback()); }
virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation & pruneOp) = 0;
virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) = 0;
- virtual ILidCommitState & getUncommittedLidsTracker() = 0;
virtual bool isDrained() const = 0;
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
index 7a15d7122c6..91bde4572ed 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
@@ -28,7 +28,8 @@ typedef AttributeReprocessingInitializer::Config ARIConfig;
void
SearchableDocSubDBConfigurer::reconfigureFeedView(IAttributeWriter::SP attrWriter,
const Schema::SP &schema,
- const std::shared_ptr<const DocumentTypeRepo> &repo)
+ const std::shared_ptr<const DocumentTypeRepo> &repo,
+ PendingLidTrackerBase & pendingLidsForCommit)
{
SearchableFeedView::SP curr = _feedView.get();
_feedView.set(std::make_shared<SearchableFeedView>(
@@ -39,6 +40,7 @@ SearchableDocSubDBConfigurer::reconfigureFeedView(IAttributeWriter::SP attrWrite
repo,
curr->getWriteService()),
curr->getPersistentParams(),
+ pendingLidsForCommit,
FastAccessFeedView::Context(std::move(attrWriter), curr->getDocIdLimit()),
SearchableFeedView::Context(curr->getIndexWriter())));
}
@@ -136,11 +138,12 @@ SearchableDocSubDBConfigurer::
reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
const ReconfigParams &params,
- IDocumentDBReferenceResolver &resolver)
+ IDocumentDBReferenceResolver &resolver,
+ PendingLidTrackerBase & pendingLidsForCommit)
{
assert(!params.shouldAttributeManagerChange());
AttributeCollectionSpec attrSpec(AttributeCollectionSpec::AttributeList(), 0, 0);
- reconfigure(newConfig, oldConfig, attrSpec, params, resolver);
+ reconfigure(newConfig, oldConfig, attrSpec, params, resolver, pendingLidsForCommit);
}
namespace {
@@ -172,7 +175,8 @@ SearchableDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
const AttributeCollectionSpec &attrSpec,
const ReconfigParams &params,
- IDocumentDBReferenceResolver &resolver)
+ IDocumentDBReferenceResolver &resolver,
+ PendingLidTrackerBase & pendingLidsForCommit)
{
bool shouldMatchViewChange = false;
bool shouldSearchViewChange = false;
@@ -238,7 +242,8 @@ SearchableDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig,
if (shouldFeedViewChange) {
reconfigureFeedView(std::move(attrWriter),
newConfig.getSchemaSP(),
- newConfig.getDocumentTypeRepoSP());
+ newConfig.getDocumentTypeRepoSP(),
+ pendingLidsForCommit);
}
return initializer;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
index 6fe0826d578..f2df6aff37e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
@@ -47,7 +47,8 @@ private:
void reconfigureFeedView(IAttributeWriter::SP attrWriter,
const search::index::Schema::SP &schema,
- const std::shared_ptr<const document::DocumentTypeRepo> &repo);
+ const std::shared_ptr<const document::DocumentTypeRepo> &repo,
+ PendingLidTrackerBase & pendingLidsForCommit);
void reconfigureMatchView(const searchcorespi::IndexSearchable::SP &indexSearchable);
@@ -81,14 +82,16 @@ public:
void reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
const ReconfigParams &params,
- IDocumentDBReferenceResolver &resolver);
+ IDocumentDBReferenceResolver &resolver,
+ PendingLidTrackerBase & pendingLidsForCommit);
IReprocessingInitializer::UP
reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
const AttributeCollectionSpec &attrSpec,
const ReconfigParams &params,
- IDocumentDBReferenceResolver &resolver);
+ IDocumentDBReferenceResolver &resolver,
+ PendingLidTrackerBase & pendingLidsForCommit);
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
index ebef7b4b6d4..cc3dc88c386 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp
@@ -31,8 +31,9 @@ SearchableFeedView::Context::Context(const IIndexWriter::SP &indexWriter)
SearchableFeedView::Context::~Context() = default;
SearchableFeedView::SearchableFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx, const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit,
const FastAccessFeedView::Context &fastUpdateCtx, Context ctx)
- : Parent(storeOnlyCtx, params, fastUpdateCtx),
+ : Parent(storeOnlyCtx, params, pendingLidsForCommit, fastUpdateCtx),
_indexWriter(ctx._indexWriter),
_hasIndexedFields(_schema->getNumIndexFields() > 0)
{ }
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.h b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.h
index 944d383e06d..f796965f608 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.h
@@ -55,6 +55,7 @@ private:
public:
SearchableFeedView(const StoreOnlyFeedView::Context &storeOnlyCtx, const PersistentParams &params,
+ PendingLidTrackerBase & pendingLidsForCommit,
const FastAccessFeedView::Context &fastUpdateCtx, Context ctx);
~SearchableFeedView() override;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index 7f2b8fcaa63..9413ca0bb53 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -155,7 +155,7 @@ SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const
AttributeCollectionSpec::UP attrSpec =
createAttributeSpec(newConfigSnapshot.getAttributesConfig(), serialNum);
IReprocessingInitializer::UP initializer =
- _configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, *attrSpec, params, resolver);
+ _configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, *attrSpec, params, resolver, getUncommittedLidsTracker());
if (initializer && initializer->hasReprocessors()) {
tasks.emplace_back(createReprocessingTask(*initializer, newConfigSnapshot.getDocumentTypeRepoSP()));
}
@@ -164,7 +164,7 @@ SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const
reconfigureAttributeMetrics(*newMgr, *oldMgr);
}
} else {
- _configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, params, resolver);
+ _configurer.reconfigure(newConfigSnapshot, oldConfigSnapshot, params, resolver, getUncommittedLidsTracker());
}
syncViews();
return tasks;
@@ -229,6 +229,7 @@ SearchableDocSubDB::initFeedView(IAttributeWriter::SP attrWriter,
assert(_writeService.master().isCurrentThread());
auto feedView = std::make_shared<SearchableFeedView>(getStoreOnlyFeedViewContext(configSnapshot),
getFeedViewPersistentParams(),
+ getUncommittedLidsTracker(),
FastAccessFeedView::Context(std::move(attrWriter), _docIdLimit),
SearchableFeedView::Context(getIndexWriter()));
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index 89d244a1176..f8dc41a5c92 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -389,11 +389,12 @@ void
StoreOnlyDocSubDB::initFeedView(const DocumentDBConfig &configSnapshot)
{
assert(_writeService.master().isCurrentThread());
- auto feedView = std::make_unique<StoreOnlyFeedView>(getStoreOnlyFeedViewContext(configSnapshot),
- getFeedViewPersistentParams());
+ auto feedView = std::make_shared<StoreOnlyFeedView>(getStoreOnlyFeedViewContext(configSnapshot),
+ getFeedViewPersistentParams(),
+ getUncommittedLidsTracker());
// XXX: Not exception safe.
- _iFeedView.set(StoreOnlyFeedView::SP(feedView.release()));
+ _iFeedView.set(std::move(feedView));
}
vespalib::string
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 8d7fce4544d..c44499d9a70 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -156,6 +156,7 @@ private:
TlsSyncer _tlsSyncer;
DocumentMetaStoreFlushTarget::SP _dmsFlushTarget;
std::shared_ptr<ShrinkLidSpaceFlushTarget> _dmsShrinkTarget;
+ PendingLidTracker _pendingLidsForCommit;
IFlushTargetList getFlushTargets() override;
protected:
@@ -233,6 +234,7 @@ public:
void close() override;
std::shared_ptr<IDocumentDBReference> getDocumentDBReference() override;
void tearDownReferences(IDocumentDBReferenceResolver &resolver) override;
+ PendingLidTrackerBase & getUncommittedLidsTracker() override { return _pendingLidsForCommit; }
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index 9fabdb3cd6c..e1f8fba47a4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -209,14 +209,9 @@ moveMetaData(documentmetastore::IStore &meta_store, const DocumentId & doc_id, c
meta_store.move(op.getPrevLid(), op.getLid(), op.get_prepare_serial_num());
}
-std::unique_ptr<PendingLidTrackerBase>
-createUncommitedLidTracker() {
- return std::make_unique<PendingLidTracker>();
-}
-
} // namespace
-StoreOnlyFeedView::StoreOnlyFeedView(const Context &ctx, const PersistentParams &params)
+StoreOnlyFeedView::StoreOnlyFeedView(const Context &ctx, const PersistentParams &params, PendingLidTrackerBase & pendingLidsForCommit)
: IFeedView(),
FeedDebugger(),
_summaryAdapter(ctx._summaryAdapter),
@@ -225,7 +220,7 @@ StoreOnlyFeedView::StoreOnlyFeedView(const Context &ctx, const PersistentParams
_docType(nullptr),
_lidReuseDelayer(ctx._writeService, _documentMetaStoreContext->get()),
_pendingLidsForDocStore(),
- _pendingLidsForCommit(createUncommitedLidTracker()),
+ _pendingLidsForCommit(pendingLidsForCommit),
_schema(ctx._schema),
_writeService(ctx._writeService),
_params(params),
@@ -243,16 +238,11 @@ StoreOnlyFeedView::sync()
_writeService.summary().sync();
}
-ILidCommitState &
-StoreOnlyFeedView::getUncommittedLidsTracker() {
- return *_pendingLidsForCommit;
-}
-
void
StoreOnlyFeedView::forceCommit(SerialNum serialNum, DoneCallback onDone)
{
internalForceCommit(serialNum, std::make_shared<ForceCommitContext>(_writeService.master(), _metaStore,
- _pendingLidsForCommit->produceSnapshot(),
+ _pendingLidsForCommit.produceSnapshot(),
std::move(onDone)));
}
@@ -272,7 +262,7 @@ StoreOnlyFeedView::internalForceCommit(SerialNum serialNum, OnForceCommitDoneTyp
IPendingLidTracker::Token
StoreOnlyFeedView::get_pending_lid_token(const DocumentOperation &op)
{
- return (op.getValidDbdId(_params._subDbId) ? _pendingLidsForCommit->produce(op.getLid()) : IPendingLidTracker::Token());
+ return (op.getValidDbdId(_params._subDbId) ? _pendingLidsForCommit.produce(op.getLid()) : IPendingLidTracker::Token());
}
void
@@ -332,7 +322,7 @@ StoreOnlyFeedView::internalPut(FeedToken token, const PutOperation &putOp)
}
if (docAlreadyExists && putOp.changedDbdId()) {
assert(!putOp.getValidDbdId(_params._subDbId));
- internalRemove(std::move(token), _pendingLidsForCommit->produce(putOp.getPrevLid()), serialNum,
+ internalRemove(std::move(token), _pendingLidsForCommit.produce(putOp.getPrevLid()), serialNum,
std::move(pendingNotifyRemoveDone), putOp.getPrevLid(), IDestructorCallback::SP());
}
}
@@ -602,7 +592,7 @@ StoreOnlyFeedView::internalRemove(FeedToken token, const RemoveOperationWithDocI
if (rmOp.getValidPrevDbdId(_params._subDbId)) {
if (rmOp.changedDbdId()) {
assert(!rmOp.getValidDbdId(_params._subDbId));
- internalRemove(std::move(token), _pendingLidsForCommit->produce(rmOp.getPrevLid()), serialNum,
+ internalRemove(std::move(token), _pendingLidsForCommit.produce(rmOp.getPrevLid()), serialNum,
std::move(pendingNotifyRemoveDone), rmOp.getPrevLid(), IDestructorCallback::SP());
}
}
@@ -616,12 +606,12 @@ StoreOnlyFeedView::internalRemove(FeedToken token, const RemoveOperationWithGid
const SerialNum serialNum = rmOp.getSerialNum();
DocumentId dummy;
PendingNotifyRemoveDone pendingNotifyRemoveDone = adjustMetaStore(rmOp, rmOp.getGlobalId(), dummy);
- auto uncommitted = _pendingLidsForCommit->produce(rmOp.getLid());
+ auto uncommitted = _pendingLidsForCommit.produce(rmOp.getLid());
if (rmOp.getValidPrevDbdId(_params._subDbId)) {
if (rmOp.changedDbdId()) {
assert(!rmOp.getValidDbdId(_params._subDbId));
- internalRemove(std::move(token), _pendingLidsForCommit->produce(rmOp.getPrevLid()), serialNum, std::move(pendingNotifyRemoveDone),
+ internalRemove(std::move(token), _pendingLidsForCommit.produce(rmOp.getPrevLid()), serialNum, std::move(pendingNotifyRemoveDone),
rmOp.getPrevLid(), IDestructorCallback::SP());
}
}
@@ -788,7 +778,7 @@ StoreOnlyFeedView::handleMove(const MoveOperation &moveOp, IDestructorCallback::
if (moveOp.getValidDbdId(_params._subDbId)) {
const document::GlobalId &gid = docId.getGlobalId();
std::shared_ptr<PutDoneContext> onWriteDone =
- createPutDoneContext(FeedToken(), _pendingLidsForCommit->produce(moveOp.getLid()),
+ createPutDoneContext(FeedToken(), _pendingLidsForCommit.produce(moveOp.getLid()),
_gidToLidChangeHandler, doc, gid, moveOp.getLid(), serialNum,
moveOp.changedDbdId() && useDocumentMetaStore(serialNum), doneCtx);
putSummary(serialNum, moveOp.getLid(), doc, onWriteDone);
@@ -796,7 +786,7 @@ StoreOnlyFeedView::handleMove(const MoveOperation &moveOp, IDestructorCallback::
putIndexedFields(serialNum, moveOp.getLid(), doc, onWriteDone);
}
if (docAlreadyExists && moveOp.changedDbdId()) {
- internalRemove(FeedToken(), _pendingLidsForCommit->produce(moveOp.getPrevLid()), serialNum, std::move(pendingNotifyRemoveDone), moveOp.getPrevLid(), doneCtx);
+ internalRemove(FeedToken(), _pendingLidsForCommit.produce(moveOp.getPrevLid()), serialNum, std::move(pendingNotifyRemoveDone), moveOp.getPrevLid(), doneCtx);
}
}
@@ -835,7 +825,7 @@ StoreOnlyFeedView::handleCompactLidSpace(const CompactLidSpaceOperation &op)
if (useDocumentMetaStore(serialNum)) {
getDocumentMetaStore()->get().compactLidSpace(op.getLidLimit());
auto commitContext(std::make_shared<ForceCommitContext>(_writeService.master(), _metaStore,
- _pendingLidsForCommit->produceSnapshot(),
+ _pendingLidsForCommit.produceSnapshot(),
DoneCallback()));
commitContext->holdUnblockShrinkLidSpace();
internalForceCommit(serialNum, commitContext);
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
index c497dea3a19..f762f7273b0 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h
@@ -139,7 +139,7 @@ private:
const document::DocumentType *_docType;
LidReuseDelayer _lidReuseDelayer;
PendingLidTracker _pendingLidsForDocStore;
- std::unique_ptr<PendingLidTrackerBase> _pendingLidsForCommit;
+ PendingLidTrackerBase &_pendingLidsForCommit;
protected:
const search::index::Schema::SP _schema;
@@ -207,7 +207,7 @@ protected:
virtual void removeIndexedFields(SerialNum serialNum, const LidVector &lidsToRemove, OnWriteDoneType onWriteDone);
virtual void internalForceCommit(SerialNum serialNum, OnForceCommitDoneType onCommitDone);
public:
- StoreOnlyFeedView(const Context &ctx, const PersistentParams &params);
+ StoreOnlyFeedView(const Context &ctx, const PersistentParams &params, PendingLidTrackerBase & pendingLidsForCommit);
~StoreOnlyFeedView() override;
const ISummaryAdapter::SP &getSummaryAdapter() const { return _summaryAdapter; }
@@ -244,7 +244,6 @@ public:
*/
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &pruneOp) override;
void handleCompactLidSpace(const CompactLidSpaceOperation &op) override;
- ILidCommitState & getUncommittedLidsTracker() override;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
index 7358a78de61..4c3839b3d0c 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
@@ -14,6 +14,7 @@
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h>
#include <vespa/searchcore/proton/server/reconfig_params.h>
+#include <vespa/searchcore/proton/common/pendinglidtracker.h>
namespace proton::test {
@@ -28,6 +29,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB
IIndexWriter::SP _indexWriter;
vespalib::ThreadStackExecutor _sharedExecutor;
std::unique_ptr<ExecutorThreadingService> _writeService;
+ PendingLidTracker _pendingLidTracker;
DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, uint32_t subDbId)
: _subDbId(subDbId),
@@ -96,6 +98,11 @@ struct DummyDocumentSubDb : public IDocumentSubDB
std::shared_ptr<IDocumentDBReference> getDocumentDBReference() override {
return std::shared_ptr<IDocumentDBReference>();
}
+
+ PendingLidTrackerBase &getUncommittedLidsTracker() override {
+ return _pendingLidTracker;
+ }
+
void tearDownReferences(IDocumentDBReferenceResolver &) override { }
};
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.cpp
index 2507abcc9ea..631dce24044 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.cpp
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.cpp
@@ -17,9 +17,4 @@ DummyFeedView::DummyFeedView(std::shared_ptr<const document::DocumentTypeRepo> d
DummyFeedView::~DummyFeedView() = default;
-ILidCommitState &
-DummyFeedView::getUncommittedLidsTracker() {
- assert(false);
-}
-
}
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h
index b50e47e8f9c..e114aef2af8 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h
@@ -33,7 +33,6 @@ struct DummyFeedView : public IFeedView
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) override {}
void handleCompactLidSpace(const CompactLidSpaceOperation &) override {}
void forceCommit(search::SerialNum, DoneCallback) override { }
- ILidCommitState & getUncommittedLidsTracker() override;
bool isDrained() const override { return true; }
};