aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
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/src/tests/proton/documentdb/configurer/configurer_test.cpp
parent964c5024198ad07ce4658d7782cf0103bb467c7d (diff)
Move uncommitted lids tracker from feedview to subdb to avoid ownership issues.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp')
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp40
1 files changed, 22 insertions, 18 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