diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-14 17:01:58 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-14 17:01:58 +0000 |
commit | 66e66d08e509a4eabf394442bcd7e733e228fb25 (patch) | |
tree | e9aa07ff8e2debfc93c5e430377848779b315cd5 /searchcore | |
parent | 76b1a42ae483ae66a2d1e43ef749f41661754e1c (diff) |
When making callbacks like notifying about new bucket show the gurad that is held.
Then this guard can used instead of possibly making a deadlock if trying to take it yourself.
Diffstat (limited to 'searchcore')
57 files changed, 251 insertions, 283 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 3987a8685ea..ef2c3c18753 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -12,6 +12,7 @@ #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/attribute/sequential_attributes_initializer.h> #include <vespa/searchcore/proton/common/hw_info.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> #include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h> #include <vespa/searchcore/proton/initializer/initializer_task.h> @@ -140,7 +141,7 @@ struct ImportedAttributesRepoBuilder { refAttr->setGidToLidMapperFactory(std::make_shared<MockGidToLidMapperFactory>()); auto targetAttr = search::AttributeFactory::createAttribute(name + "_target", INT32_SINGLE); auto documentMetaStore = std::shared_ptr<search::IDocumentMetaStoreContext>(); - auto targetDocumentMetaStore = std::make_shared<const DocumentMetaStoreContext>(std::make_shared<BucketDBOwner>()); + auto targetDocumentMetaStore = std::make_shared<const DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>()); auto importedAttr = ImportedAttributeVectorFactory::create(name, refAttr, documentMetaStore, targetAttr, targetDocumentMetaStore, false); _repo->add(name, importedAttr); } @@ -230,7 +231,7 @@ struct DummyInitializerTask : public InitializerTask struct ParallelAttributeManager { InitializerTask::SP documentMetaStoreInitTask; - BucketDBOwner::SP bucketDbOwner; + std::shared_ptr<bucketdb::BucketDBOwner> bucketDbOwner; DocumentMetaStore::SP documentMetaStore; AllocStrategy alloc_strategy; bool fastAccessAttributesOnly; @@ -247,7 +248,7 @@ struct ParallelAttributeManager ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSerialNum, AttributeManager::SP baseAttrMgr, const AttributesConfig &attrCfg, uint32_t docIdLimit) : documentMetaStoreInitTask(std::make_shared<DummyInitializerTask>()), - bucketDbOwner(std::make_shared<BucketDBOwner>()), + bucketDbOwner(std::make_shared<bucketdb::BucketDBOwner>()), documentMetaStore(std::make_shared<DocumentMetaStore>(bucketDbOwner)), alloc_strategy(), fastAccessAttributesOnly(false), diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp index 494b37297f4..fa08df6faa1 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp @@ -1,11 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("imported_attributes_context_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcore/proton/attribute/imported_attributes_context.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> @@ -14,6 +14,8 @@ LOG_SETUP("imported_attributes_context_test"); #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> #include <future> +#include <vespa/log/log.h> +LOG_SETUP("imported_attributes_context_test"); using namespace proton; using search::AttributeVector; using search::attribute::BasicType; @@ -80,7 +82,7 @@ struct Fixture { createReferenceAttribute(name + "_ref"), std::shared_ptr<search::IDocumentMetaStoreContext>(), createTargetAttribute(name + "_target"), - std::make_shared<const DocumentMetaStoreContext>(std::make_shared<BucketDBOwner>()), + std::make_shared<const DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>()), false); repo.add(name, attr); return *this; diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp index 44f3f50c36c..52abfed2289 100644 --- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp @@ -2,6 +2,7 @@ #include <vespa/searchcore/proton/server/buckethandler.h> #include <vespa/searchcore/proton/server/ibucketstatechangedhandler.h> #include <vespa/searchcore/proton/server/ibucketmodifiedhandler.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/persistence/spi/test.h> #include <vespa/vespalib/testkit/testapp.h> @@ -28,7 +29,7 @@ struct MySubDb { DocumentMetaStore _metaStore; test::UserDocuments _docs; - MySubDb(std::shared_ptr<BucketDBOwner> bucketDB, SubDbType subDbType) + MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType) : _metaStore(bucketDB, DocumentMetaStore::getFixedName(), search::GrowStrategy(), @@ -69,17 +70,6 @@ struct MyChangedHandler : public IBucketStateChangedHandler } }; - -struct MyModifiedHandler : public IBucketModifiedHandler -{ - virtual void - notifyBucketModified(const BucketId &bucket) override - { - (void) bucket; - } -}; - - bool expectEqual(uint32_t docCount, uint32_t metaCount, size_t docSizes, size_t entrySizes, const BucketInfo &info) { @@ -94,28 +84,26 @@ expectEqual(uint32_t docCount, uint32_t metaCount, size_t docSizes, size_t entry struct Fixture { test::UserDocumentsBuilder _builder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MySubDb _ready; MySubDb _removed; MySubDb _notReady; ThreadStackExecutor _exec; BucketHandler _handler; MyChangedHandler _changedHandler; - MyModifiedHandler _modifiedHandler; BucketStateCalculator::SP _calc; test::BucketIdListResultHandler _bucketList; test::BucketInfoResultHandler _bucketInfo; test::GenericResultHandler _genResult; Fixture() : _builder(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _ready(_bucketDB, SubDbType::READY), _removed(_bucketDB, SubDbType::REMOVED), _notReady(_bucketDB, SubDbType::NOTREADY), _exec(1, 64000), _handler(_exec), _changedHandler(), - _modifiedHandler(), _calc(new BucketStateCalculator()), _bucketList(), _bucketInfo(), _genResult() { @@ -180,7 +168,7 @@ TEST_F("require that bucket is reported in handleGetBucketInfo()", Fixture) TEST_F("require that handleGetBucketInfo() can get cached bucket", Fixture) { { - BucketDBOwner::Guard db = f._bucketDB->takeGuard(); + bucketdb::Guard db = f._bucketDB->takeGuard(); db->add(GID_1, BUCKET_1, TIME_1, DOCSIZE_1, SubDbType::READY); db->cacheBucket(BUCKET_1); db->add(GID_1, BUCKET_1, TIME_1, DOCSIZE_1, SubDbType::NOTREADY); @@ -194,7 +182,7 @@ TEST_F("require that handleGetBucketInfo() can get cached bucket", Fixture) EXPECT_TRUE(expectEqual(2, 2, 2 * DOCSIZE_1, 2 * DOCSIZE_1, f._bucketInfo.getInfo())); { // Must ensure empty bucket db before destruction. - BucketDBOwner::Guard db = f._bucketDB->takeGuard(); + bucketdb::Guard db = f._bucketDB->takeGuard(); db->remove(GID_1, BUCKET_1, TIME_1, DOCSIZE_1, SubDbType::READY); db->remove(GID_1, BUCKET_1, TIME_1, DOCSIZE_1, SubDbType::NOTREADY); } diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp index 9389a60997d..c01a0083674 100644 --- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp @@ -3,6 +3,7 @@ #include <vespa/document/test/make_bucket_space.h> #include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/server/combiningfeedview.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/vespalib/util/idestructorcallback.h> #include <vespa/document/update/documentupdate.h> @@ -47,7 +48,7 @@ struct MyFeedView : public test::DummyFeedView uint32_t _handlePrune; uint32_t _wantedLidLimit; MyFeedView(const std::shared_ptr<const DocumentTypeRepo> &repo, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType) : test::DummyFeedView(repo), _metaStore(bucketDB, @@ -95,7 +96,7 @@ struct MySubDb { MyFeedView::SP _view; MySubDb(const std::shared_ptr<const DocumentTypeRepo> &repo, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType) : _view(std::make_shared<MyFeedView>(repo, std::move(bucketDB), subDbType)) { @@ -129,7 +130,7 @@ const uint32_t NOT_READY = 2; struct Fixture { test::UserDocumentsBuilder _builder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MySubDb _ready; MySubDb _removed; MySubDb _notReady; @@ -137,7 +138,7 @@ struct Fixture CombiningFeedView _view; Fixture() : _builder(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _ready(_builder.getRepo(), _bucketDB, SubDbType::READY), _removed(_builder.getRepo(), _bucketDB, SubDbType::REMOVED), _notReady(_builder.getRepo(), _bucketDB, SubDbType::NOTREADY), diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 8f6b2f0bc10..53b280caa88 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -16,6 +16,7 @@ #include <vespa/searchcore/proton/server/summaryadapter.h> #include <vespa/searchcore/proton/server/attribute_writer_factory.h> #include <vespa/searchcore/proton/server/reconfig_params.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/matching/sessionmanager.h> #include <vespa/searchcore/proton/matching/querylimiter.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> @@ -193,7 +194,7 @@ Fixture::initViewSet(ViewSet &views) (_summaryExecutor, search::LogDocumentStore::Config(), search::GrowStrategy(), BASE_DIR, views._docTypeName, TuneFileSummary(), views._fileHeaderContext,views._noTlSyncer, search::IBucketizer::SP()); auto sesMgr = make_shared<SessionManager>(100); - auto metaStore = make_shared<DocumentMetaStoreContext>(make_shared<BucketDBOwner>()); + auto metaStore = make_shared<DocumentMetaStoreContext>(make_shared<bucketdb::BucketDBOwner>()); auto indexWriter = std::make_shared<IndexWriter>(indexMgr); auto attrWriter = std::make_shared<AttributeWriter>(attrMgr); auto summaryAdapter = std::make_shared<SummaryAdapter>(summaryMgr); @@ -254,7 +255,7 @@ struct MyFastAccessFeedView void init() { MySummaryAdapter::SP summaryAdapter = std::make_shared<MySummaryAdapter>(); Schema::SP schema = std::make_shared<Schema>(); - _dmsc = make_shared<DocumentMetaStoreContext>(std::make_shared<BucketDBOwner>()); + _dmsc = make_shared<DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>()); std::shared_ptr<const DocumentTypeRepo> repo = createRepo(); StoreOnlyFeedView::Context storeOnlyCtx(summaryAdapter, schema, _dmsc, repo, _pendingLidsForCommit, *_gidToLidChangeHandler, _writeService); diff --git a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp index 7f7c0302926..beadf5abfe1 100644 --- a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> #include <vespa/searchcore/proton/server/document_scan_iterator.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/document/base/documentid.h> @@ -22,7 +23,7 @@ struct Fixture DocumentMetaStore _metaStore; std::unique_ptr<DocumentScanIterator> _itr; Fixture() - : _metaStore(std::make_shared<BucketDBOwner>()), + : _metaStore(std::make_shared<bucketdb::BucketDBOwner>()), _itr() { _metaStore.constructFreeList(); 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 40a9656ae41..5472682c503 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 @@ -139,7 +139,7 @@ struct MyStoreOnlyContext HwInfo _hwInfo; StoreOnlyContext _ctx; MyStoreOnlyContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer & bucketDBHandlerInitializer); ~MyStoreOnlyContext(); const MySubDBOwner &getOwner() const { @@ -148,7 +148,7 @@ struct MyStoreOnlyContext }; MyStoreOnlyContext::MyStoreOnlyContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer &bucketDBHandlerInitializer) : _owner(), _syncProxy(), _getSerialNum(), _fileHeader(), _metrics(DOCTYPE_NAME, 1), _configMutex(), _hwInfo(), @@ -175,7 +175,7 @@ struct MyFastAccessContext MyMetricsWireService _wireService; FastAccessContext _ctx; MyFastAccessContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer & bucketDBHandlerInitializer); ~MyFastAccessContext(); const MyMetricsWireService &getWireService() const { @@ -187,7 +187,7 @@ struct MyFastAccessContext }; MyFastAccessContext::MyFastAccessContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer & bucketDBHandlerInitializer) : _storeOnlyCtx(writeService, bucketDB, bucketDBHandlerInitializer), _attributeMetrics(nullptr), @@ -212,7 +212,7 @@ struct MySearchableContext vespalib::Clock _clock; SearchableContext _ctx; MySearchableContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer & bucketDBHandlerInitializer); ~MySearchableContext(); const MyMetricsWireService &getWireService() const { @@ -225,7 +225,7 @@ struct MySearchableContext MySearchableContext::MySearchableContext(IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, IBucketDBHandlerInitializer & bucketDBHandlerInitializer) : _fastUpdCtx(writeService, bucketDB, bucketDBHandlerInitializer), _queryLimiter(), _clock(), @@ -284,7 +284,7 @@ struct FixtureBase ThreadStackExecutor _summaryExecutor; ExecutorThreadingService _writeService; typename Traits::Config _cfg; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; BucketDBHandler _bucketDBHandler; typename Traits::Context _ctx; typename Traits::Schema _baseSchema; @@ -296,7 +296,7 @@ struct FixtureBase : _summaryExecutor(1, 64 * 1024), _writeService(_summaryExecutor), _cfg(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _bucketDBHandler(*_bucketDB), _ctx(_writeService, _bucketDB, _bucketDBHandler), _baseSchema(), @@ -317,11 +317,11 @@ struct FixtureBase proton::test::runInMaster(_writeService, func); } void init() { - DocumentSubDbInitializer::SP task = - _subDb.createInitializer(*_snapshot->_cfg, Traits::configSerial(), IndexConfig()); - vespalib::ThreadStackExecutor executor(1, 1024 * 1024); - initializer::TaskRunner taskRunner(executor); - taskRunner.runTask(task); + DocumentSubDbInitializer::SP task = + _subDb.createInitializer(*_snapshot->_cfg, Traits::configSerial(), IndexConfig()); + vespalib::ThreadStackExecutor executor(1, 1024 * 1024); + initializer::TaskRunner taskRunner(executor); + taskRunner.runTask(task); auto sessionMgr = std::make_shared<SessionManager>(1); runInMaster([&] () { _subDb.initViews(*_snapshot->_cfg, sessionMgr); }); } diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp index 7c8388b05ed..4007a7761a3 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp @@ -14,7 +14,7 @@ MyBucketModifiedHandler::notifyBucketModified(const BucketId &bucket) { _modified.push_back(bucket); } -MyMoveHandler::MyMoveHandler(BucketDBOwner &bucketDb, bool storeMoveDoneContext) +MyMoveHandler::MyMoveHandler(bucketdb::BucketDBOwner &bucketDb, bool storeMoveDoneContext) : _bucketDb(bucketDb), _moves(), _numCachedBuckets(), @@ -35,16 +35,17 @@ MyMoveHandler::handleMove(MoveOperation &op, IDestructorCallback::SP moveDoneCtx } } -MySubDb::MySubDb(const std::shared_ptr<const DocumentTypeRepo> &repo, std::shared_ptr<BucketDBOwner> bucketDB, +MySubDb::MySubDb(const std::shared_ptr<const DocumentTypeRepo> &repo, std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, uint32_t subDbId, SubDbType subDbType) - : _metaStoreSP(std::make_shared<DocumentMetaStore>(bucketDB, DocumentMetaStore::getFixedName(), - search::GrowStrategy(), subDbType)), - _metaStore(*_metaStoreSP), - _realRetriever(std::make_shared<MyDocumentRetriever>(repo)), - _retriever(_realRetriever), - _subDb("my_sub_db", subDbId, _metaStoreSP, _retriever, IFeedView::SP(), nullptr), - _docs(), - _bucketDBHandler(*bucketDB) { + : _metaStoreSP(std::make_shared<DocumentMetaStore>(bucketDB, DocumentMetaStore::getFixedName(), + search::GrowStrategy(), subDbType)), + _metaStore(*_metaStoreSP), + _realRetriever(std::make_shared<MyDocumentRetriever>(repo)), + _retriever(_realRetriever), + _subDb("my_sub_db", subDbId, _metaStoreSP, _retriever, IFeedView::SP(), nullptr), + _docs(), + _bucketDBHandler(*bucketDB) +{ _bucketDBHandler.addDocumentMetaStore(_metaStoreSP.get(), 0); } diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.h b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.h index 4a6bb4fa938..65e206d7327 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.h +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.h @@ -31,13 +31,13 @@ struct MyMoveOperationLimiter : public IMoveOperationLimiter { struct MyMoveHandler : public IDocumentMoveHandler { using MoveOperationVector = std::vector<MoveOperation>; - BucketDBOwner &_bucketDb; + bucketdb::BucketDBOwner &_bucketDb; MoveOperationVector _moves; size_t _numCachedBuckets; bool _storeMoveDoneContexts; std::vector<vespalib::IDestructorCallback::SP> _moveDoneContexts; - MyMoveHandler(BucketDBOwner &bucketDb, bool storeMoveDoneContext = false); + MyMoveHandler(bucketdb::BucketDBOwner &bucketDb, bool storeMoveDoneContext = false); ~MyMoveHandler() override; void handleMove(MoveOperation &op, vespalib::IDestructorCallback::SP moveDoneCtx) override; @@ -103,7 +103,7 @@ struct MySubDb { UserDocuments _docs; bucketdb::BucketDBHandler _bucketDBHandler; - MySubDb(const std::shared_ptr<const DocumentTypeRepo> &repo, std::shared_ptr<BucketDBOwner> bucketDB, + MySubDb(const std::shared_ptr<const DocumentTypeRepo> &repo, std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, uint32_t subDbId, SubDbType subDbType); ~MySubDb(); diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp index 56cf1ae5389..502639d1dca 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp @@ -64,7 +64,7 @@ struct ControllerFixtureBase : public ::testing::Test test::ClusterStateHandler _clusterStateHandler; test::BucketHandler _bucketHandler; MyBucketModifiedHandler _modifiedHandler; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MyMoveHandler _moveHandler; MySubDb _ready; MySubDb _notReady; @@ -129,7 +129,7 @@ ControllerFixtureBase::ControllerFixtureBase(const BlockableMaintenanceJobConfig _calc(std::make_shared<test::BucketStateCalculator>()), _bucketHandler(), _modifiedHandler(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _moveHandler(*_bucketDB, storeMoveDoneContexts), _ready(_builder.getRepo(), _bucketDB, 1, SubDbType::READY), _notReady(_builder.getRepo(), _bucketDB, 2, SubDbType::NOTREADY), @@ -751,7 +751,7 @@ TEST_F(ControllerFixture, require_that_notifyCreateBucket_causes_bucket_to_be_re EXPECT_TRUE(bucketsModified().empty()); addReady(_notReady.bucket(3)); // bucket 3 now ready, no notify EXPECT_TRUE(_bmj.done()); // move job still believes work done - _bmj.notifyCreateBucket(_notReady.bucket(3)); // reconsider bucket 3 + _bmj.notifyCreateBucket(_bucketDB->takeGuard(), _notReady.bucket(3)); // reconsider bucket 3 EXPECT_FALSE(_bmj.done()); runLoop(); EXPECT_TRUE(_bmj.done()); diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp index 0d978e6e463..420f45d99e8 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentmover_test.cpp @@ -14,7 +14,7 @@ using document::BucketId; struct MySubDbTwoBuckets : public MySubDb { MySubDbTwoBuckets(test::UserDocumentsBuilder &builder, - std::shared_ptr<BucketDBOwner> bucketDB, + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, uint32_t subDbId, SubDbType subDbType) : MySubDb(builder.getRepo(), bucketDB, subDbId, subDbType) @@ -32,16 +32,16 @@ struct MySubDbTwoBuckets : public MySubDb struct DocumentMoverTest : ::testing::Test { test::UserDocumentsBuilder _builder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MyMoveOperationLimiter _limiter; DocumentBucketMover _mover; MySubDbTwoBuckets _source; - BucketDBOwner _bucketDb; + bucketdb::BucketDBOwner _bucketDb; MyMoveHandler _handler; PendingLidTracker _pendingLidsForCommit; DocumentMoverTest() : _builder(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _limiter(), _mover(_limiter), _source(_builder, _bucketDB, 0u, SubDbType::READY), diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/scaniterator_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/scaniterator_test.cpp index 2c382473fca..91b8709e8da 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/scaniterator_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/scaniterator_test.cpp @@ -17,7 +17,7 @@ using ScanPass = ScanItr::Pass; struct ScanTestBase : public ::testing::Test { test::UserDocumentsBuilder _builder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MySubDb _ready; MySubDb _notReady; ScanTestBase(); @@ -34,7 +34,7 @@ struct ScanTestBase : public ::testing::Test ScanTestBase::ScanTestBase() : _builder(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _ready(_builder.getRepo(), _bucketDB, 1, SubDbType::READY), _notReady(_builder.getRepo(), _bucketDB, 2, SubDbType::NOTREADY) {} diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 8840d4778e0..bcb0c049e56 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -428,7 +428,7 @@ struct FeedHandlerFixture MyReplayConfig replayConfig; MyFeedView feedView; MyTlsWriter tls_writer; - BucketDBOwner _bucketDB; + bucketdb::BucketDBOwner _bucketDB; bucketdb::BucketDBHandler _bucketDBHandler; FeedHandler handler; FeedHandlerFixture() diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index bf2265ed9a0..49b1f10bde2 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -10,6 +10,7 @@ #include <vespa/searchcore/proton/server/matchview.h> #include <vespa/searchcore/proton/server/searchable_feed_view.h> #include <vespa/searchcore/proton/feedoperation/operations.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/test/document_meta_store_context_observer.h> #include <vespa/searchcore/proton/test/dummy_document_store.h> #include <vespa/searchcore/proton/test/dummy_summary_manager.h> @@ -541,7 +542,7 @@ struct FixtureBase return msa._store; } - BucketDBOwner::Guard getBucketDB() const { + bucketdb::Guard getBucketDB() const { return getMetaStore().getBucketDB().takeGuard(); } @@ -684,7 +685,7 @@ FixtureBase::FixtureBase() msa(static_cast<MySummaryAdapter&>(*sa)), maw(static_cast<MyAttributeWriter&>(*aw)), _docIdLimit(0u), - _dmscReal(std::make_shared<DocumentMetaStoreContext>(std::make_shared<BucketDBOwner>())), + _dmscReal(std::make_shared<DocumentMetaStoreContext>(std::make_shared<bucketdb::BucketDBOwner>())), _dmsc(std::make_shared<test::DocumentMetaStoreContextObserver>(*_dmscReal)), pc(sc._builder->getDocumentType().getName(), "fileconfig_test"), _sharedExecutor(1, 0x10000), diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.cpp index b9bb6a7c801..5a68e46c57e 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.cpp +++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.cpp @@ -213,7 +213,7 @@ MyDocumentRetriever::parseSelect(const vespalib::string&) const { abort(); } -MySubDb::MySubDb(std::shared_ptr<BucketDBOwner> bucket_db, const MyDocumentStore& store, const std::shared_ptr<const DocumentTypeRepo> & repo) +MySubDb::MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucket_db, const MyDocumentStore& store, const std::shared_ptr<const DocumentTypeRepo> & repo) : sub_db(std::move(bucket_db), SUBDB_ID), maintenance_sub_db(sub_db.getName(), sub_db.getSubDbId(), sub_db.getDocumentMetaStoreContext().getSP(), std::make_shared<MyDocumentRetriever>(repo, store), diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.h b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.h index ec34c0fd5a7..9ef96762e2d 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.h +++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_common.h @@ -140,6 +140,6 @@ struct MySubDb { test::DummyDocumentSubDb sub_db; MaintenanceDocumentSubDB maintenance_sub_db; PendingLidTracker _pendingLidsForCommit; - MySubDb(std::shared_ptr<BucketDBOwner> bucket_db, const MyDocumentStore& store, const std::shared_ptr<const DocumentTypeRepo> & repo); + MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucket_db, const MyDocumentStore& store, const std::shared_ptr<const DocumentTypeRepo> & repo); ~MySubDb(); }; diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_handler_test.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_handler_test.cpp index 993cb9226c5..2ca1101ac3a 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_handler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_handler_test.cpp @@ -1,11 +1,12 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "lid_space_common.h" +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/vespalib/gtest/gtest.h> struct HandlerTest : public ::testing::Test { DocBuilder _docBuilder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; MyDocumentStore _docStore; MySubDb _subDb; LidSpaceCompactionHandler _handler; @@ -15,7 +16,7 @@ struct HandlerTest : public ::testing::Test { HandlerTest::HandlerTest() : _docBuilder(Schema()), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _docStore(), _subDb(_bucketDB, _docStore, _docBuilder.getDocumentTypeRepo()), _handler(_subDb.maintenance_sub_db, "test") diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index e47dfac90db..a7a8788b478 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -25,6 +25,7 @@ #include <vespa/searchcore/proton/server/maintenancecontroller.h> #include <vespa/searchcore/proton/test/buckethandler.h> #include <vespa/searchcore/proton/test/clusterstatehandler.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/test/disk_mem_usage_notifier.h> #include <vespa/searchcore/proton/test/mock_attribute_manager.h> #include <vespa/searchcore/proton/test/test.h> @@ -98,7 +99,7 @@ class MyDocumentSubDB public: MyDocumentSubDB(uint32_t subDBId, SubDbType subDbType, const std::shared_ptr<const document::DocumentTypeRepo> &repo, - std::shared_ptr<BucketDBOwner> bucketDB, const DocTypeName &docTypeName); + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const DocTypeName &docTypeName); ~MyDocumentSubDB(); uint32_t getSubDBId() const { return _subDBId; } @@ -131,7 +132,7 @@ public: }; MyDocumentSubDB::MyDocumentSubDB(uint32_t subDBId, SubDbType subDbType, const std::shared_ptr<const document::DocumentTypeRepo> &repo, - std::shared_ptr<BucketDBOwner> bucketDB, const DocTypeName &docTypeName) + std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const DocTypeName &docTypeName) : _docs(), _subDBId(subDBId), _metaStoreSP(std::make_shared<DocumentMetaStore>( @@ -365,7 +366,7 @@ public: DummyBucketExecutor _bucketExecutor; DocTypeName _docTypeName; test::UserDocumentsBuilder _builder; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; test::BucketStateCalculator::SP _calc; test::ClusterStateHandler _clusterStateHandler; test::BucketHandler _bucketHandler; @@ -785,7 +786,7 @@ MaintenanceControllerFixture::MaintenanceControllerFixture() _bucketExecutor(2), _docTypeName("searchdocument"), // must match document builder _builder(), - _bucketDB(std::make_shared<BucketDBOwner>()), + _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _calc(new test::BucketStateCalculator()), _clusterStateHandler(), _bucketHandler(), diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp index 3b98206e9cf..7d181eaa0ee 100644 --- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp @@ -7,6 +7,7 @@ #include <vespa/searchcore/proton/server/putdonecontext.h> #include <vespa/searchcore/proton/server/removedonecontext.h> #include <vespa/searchcore/proton/server/storeonlyfeedview.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> #include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> #include <vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h> @@ -199,7 +200,7 @@ struct FixtureBase { putCount(0), heartbeatCount(0), outstandingMoveOps(0), - metaStore(std::make_shared<DocumentMetaStore>(std::make_shared<BucketDBOwner>(), + metaStore(std::make_shared<DocumentMetaStore>(std::make_shared<bucketdb::BucketDBOwner>(), DocumentMetaStore::getFixedName(), search::GrowStrategy(), subDbType)), diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 21b32b40c80..fd18979c6e0 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -92,10 +92,10 @@ struct BoolVector : public std::vector<bool> { using PutRes = DocumentMetaStore::Result; using Result = DocumentMetaStore::Result; -BucketDBOwner::SP +std::shared_ptr<bucketdb::BucketDBOwner> createBucketDB() { - return std::make_shared<BucketDBOwner>(); + return std::make_shared<bucketdb::BucketDBOwner>(); } void @@ -774,7 +774,7 @@ requireThatBasicBucketInfoWorks() BucketId prevBucket = m.begin()->first.first; uint32_t cnt = 0u; uint32_t maxcnt = 0u; - BucketDBOwner::Guard bucketDB = dms.getBucketDB().takeGuard(); + bucketdb::Guard bucketDB = dms.getBucketDB().takeGuard(); for (Map::const_iterator i = m.begin(), ie = m.end(); i != ie; ++i) { if (i->first.first == prevBucket) { cksum.add(i->first.second, i->second, 1, SubDbType::READY); @@ -862,7 +862,7 @@ struct Comparator { }; struct UserDocFixture { - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; DocumentMetaStore dms; std::vector<GlobalId> gids; BucketId bid1; @@ -1106,19 +1106,15 @@ struct MyBucketCreateListener : public IBucketCreateListener { MyBucketCreateListener(); ~MyBucketCreateListener(); - virtual void notifyCreateBucket(const document::BucketId &bucket) override; + void notifyCreateBucket(const bucketdb::Guard & guard, const document::BucketId &bucket) override; }; -MyBucketCreateListener::MyBucketCreateListener() -{ -} +MyBucketCreateListener::MyBucketCreateListener() = default; -MyBucketCreateListener::~MyBucketCreateListener() -{ -} +MyBucketCreateListener::~MyBucketCreateListener() = default; void -MyBucketCreateListener::notifyCreateBucket(const document::BucketId &bucket) +MyBucketCreateListener::notifyCreateBucket(const bucketdb::Guard &, const document::BucketId &bucket) { _buckets.emplace_back(bucket); } @@ -1647,7 +1643,7 @@ TEST(DocumentMetaStoreTest, overlapping_bucket_active_state_works) } struct RemovedFixture { - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; DocumentMetaStore dms; bucketdb::BucketDBHandler _bucketDBHandler; @@ -1671,7 +1667,7 @@ RemovedFixture::RemovedFixture() { _bucketDBHandler.addDocumentMetaStore(&dms, 0); } -RemovedFixture::~RemovedFixture() {} +RemovedFixture::~RemovedFixture() = default; TEST(DocumentMetaStoreTest, remove_changed_bucket_works) { diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 0278aba41d9..f68e4956e15 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -13,6 +13,7 @@ #include <vespa/searchcore/proton/matching/querynodes.h> #include <vespa/searchcore/proton/matching/sessionmanager.h> #include <vespa/searchcore/proton/matching/viewresolver.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchlib/aggregation/aggregation.h> #include <vespa/searchlib/aggregation/grouping.h> #include <vespa/searchlib/aggregation/perdocexpression.h> @@ -377,7 +378,7 @@ MyWorld::MyWorld() searchContext(), attributeContext(), sessionManager(), - metaStore(std::make_shared<BucketDBOwner>()), + metaStore(std::make_shared<bucketdb::BucketDBOwner>()), matchingStats(), clock(), queryLimiter() diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp index 30e3c86cb34..7f92686cfb9 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp @@ -75,14 +75,14 @@ void assertLid(const std::unique_ptr<search::IGidToLidMapper> &mapper, const ves struct Fixture { - BucketDBOwner::SP _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; std::shared_ptr<DocumentMetaStore> _dms; std::shared_ptr<const DocumentMetaStoreContext> _dmsContext; Timestamp _timestamp; using generation_t = GenerationHandler::generation_t; Fixture() - : _bucketDB(std::make_shared<BucketDBOwner>()), + : _bucketDB(std::make_shared<bucketdb::BucketDBOwner>()), _dms(std::make_shared<DocumentMetaStore>(_bucketDB)), _dmsContext(std::make_shared<const DocumentMetaStoreContext>(_dms)) { diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index 058374cfc59..234520d040b 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -29,6 +29,7 @@ #include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> #include <vespa/searchcore/proton/server/documentretriever.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/test/dummy_document_store.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributeguard.h> @@ -84,7 +85,6 @@ using search::index::Schema; using search::index::schema::DataType; using search::tensor::TensorAttribute; using storage::spi::Bucket; -using storage::spi::GetResult; using storage::spi::Timestamp; using storage::spi::test::makeSpiBucket; using vespalib::make_string; @@ -327,7 +327,7 @@ struct Fixture { Fixture() : repo(getRepoConfig()), - meta_store(std::make_shared<BucketDBOwner>()), + meta_store(std::make_shared<bucketdb::BucketDBOwner>()), gid(doc_id.getGlobalId()), bucket_id(gid.convertToBucketId()), timestamp(21), diff --git a/searchcore/src/tests/proton/server/feedstates_test.cpp b/searchcore/src/tests/proton/server/feedstates_test.cpp index 4d4056de81d..47d365411c9 100644 --- a/searchcore/src/tests/proton/server/feedstates_test.cpp +++ b/searchcore/src/tests/proton/server/feedstates_test.cpp @@ -69,7 +69,7 @@ struct Fixture IFeedView *feed_view_ptr; MyReplayConfig replay_config; MemoryConfigStore config_store; - BucketDBOwner _bucketDB; + bucketdb::BucketDBOwner _bucketDB; bucketdb::BucketDBHandler _bucketDBHandler; MyIncSerialNum _inc_serial_num; ReplayTransactionLogState state; diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.cpp index d8789e8bd6b..1b988add03c 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.cpp @@ -20,10 +20,10 @@ BucketCreateNotifier::~BucketCreateNotifier() } void -BucketCreateNotifier::notifyCreateBucket(const BucketId &bucket) +BucketCreateNotifier::notifyCreateBucket(const Guard & guard, const BucketId &bucket) { for (const auto &listener : _listeners) { - listener->notifyCreateBucket(bucket); + listener->notifyCreateBucket(guard, bucket); } } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.h index 50e53743e26..4f6fe86e6c6 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_create_notifier.h @@ -19,11 +19,11 @@ class BucketCreateNotifier : public IBucketCreateNotifier public: BucketCreateNotifier(); - virtual ~BucketCreateNotifier() override; + ~BucketCreateNotifier() override; - virtual void notifyCreateBucket(const document::BucketId &bucket) override; - virtual void addListener(IBucketCreateListener *listener) override; - virtual void removeListener(IBucketCreateListener *listener) override; + void notifyCreateBucket(const Guard & guard, const document::BucketId &bucket) override; + void addListener(IBucketCreateListener *listener) override; + void removeListener(IBucketCreateListener *listener) override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp index 78d118ab539..b1a24f567b1 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.cpp @@ -50,14 +50,12 @@ convertBucketsToSlime(const BucketDB &bucketDb, Cursor &array) } -BucketDBExplorer::BucketDBExplorer(BucketDBOwner::Guard bucketDb) +BucketDBExplorer::BucketDBExplorer(bucketdb::Guard bucketDb) : _bucketDb(std::move(bucketDb)) { } -BucketDBExplorer::~BucketDBExplorer() -{ -} +BucketDBExplorer::~BucketDBExplorer() = default; void BucketDBExplorer::get_state(const Inserter &inserter, bool full) const diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.h index 4af0c261ef7..86babc38af4 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_explorer.h @@ -13,14 +13,13 @@ namespace proton { class BucketDBExplorer : public vespalib::StateExplorer { private: - BucketDBOwner::Guard _bucketDb; + bucketdb::Guard _bucketDb; public: - BucketDBExplorer(BucketDBOwner::Guard bucketDb); - ~BucketDBExplorer(); + BucketDBExplorer(bucketdb::Guard bucketDb); + ~BucketDBExplorer() override; - // Implements vespalib::StateExplorer - virtual void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; + void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.cpp index 5e31e9364fc..503083502b3 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.cpp @@ -2,26 +2,23 @@ #include "bucket_db_owner.h" -namespace proton { +namespace proton::bucketdb { -BucketDBOwner::Guard::Guard(BucketDB *bucketDB, Mutex &mutex) +Guard::Guard(BucketDB *bucketDB, std::mutex &mutex) : _bucketDB(bucketDB), _guard(mutex) -{ -} +{ } -BucketDBOwner::Guard::Guard(Guard &&rhs) +Guard::Guard(Guard &&rhs) : _bucketDB(rhs._bucketDB), _guard(std::move(rhs._guard)) -{ -} +{ } BucketDBOwner::BucketDBOwner() : _bucketDB(), _mutex() -{ -} +{ } } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h index 1ff8e16a749..d6bfdba8e72 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h @@ -5,45 +5,38 @@ #include "bucketdb.h" #include <mutex> -namespace proton { +namespace proton::bucketdb { + +class Guard +{ +public: + Guard(BucketDB *bucketDB, std::mutex &mutex); + Guard(const Guard &) = delete; + Guard(Guard &&rhs); + Guard &operator=(const Guard &) = delete; + Guard &operator=(Guard &&rhs) = delete; + BucketDB *operator->() { return _bucketDB; } + BucketDB &operator*() { return *_bucketDB; } + const BucketDB *operator->() const { return _bucketDB; } + const BucketDB &operator*() const { return *_bucketDB; } +private: + BucketDB *_bucketDB; + std::unique_lock<std::mutex> _guard; +}; /** * Class that owns and provides guarded access to a bucket database. */ class BucketDBOwner { - using Mutex = std::mutex; - public: - class Guard - { - private: - BucketDB *_bucketDB; - std::unique_lock<Mutex> _guard; - - public: - Guard(BucketDB *bucketDB, Mutex &mutex); - Guard(const Guard &) = delete; - Guard(Guard &&rhs); - Guard &operator=(const Guard &) = delete; - Guard &operator=(Guard &&rhs) = delete; - BucketDB *operator->() { return _bucketDB; } - BucketDB &operator*() { return *_bucketDB; } - const BucketDB *operator->() const { return _bucketDB; } - const BucketDB &operator*() const { return *_bucketDB; } - }; - -private: - BucketDB _bucketDB; - Mutex _mutex; - -public: - typedef std::shared_ptr<BucketDBOwner> SP; - BucketDBOwner(); Guard takeGuard() { return Guard(&_bucketDB, _mutex); } +private: + BucketDB _bucketDB; + std::mutex _mutex; }; -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdeltapair.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdeltapair.h index 21f0dacec48..04c189a733e 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdeltapair.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdeltapair.h @@ -19,8 +19,7 @@ public: BucketDeltaPair() : _delta1(), _delta2() - { - } + { } }; } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.cpp index 46cbb4fc37f..5d323be8f90 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.cpp @@ -7,23 +7,17 @@ using storage::spi::BucketInfo; namespace proton::bucketdb { -ScanIterator::ScanIterator(BucketDBOwner::Guard db, Pass pass, BucketId lastBucket, BucketId endBucket) +ScanIterator::ScanIterator(const Guard & db, Pass pass, BucketId lastBucket, BucketId endBucket) : _db(std::move(db)), _itr(lastBucket.isSet() ? _db->upperBound(lastBucket) : _db->begin()), _end(pass == Pass::SECOND && endBucket.isSet() ? _db->upperBound(endBucket) : _db->end()) { } -ScanIterator::ScanIterator(BucketDBOwner::Guard db, BucketId bucket) +ScanIterator::ScanIterator(const Guard & db, BucketId bucket) : _db(std::move(db)), _itr(_db->lowerBound(bucket)), _end(_db->end()) { } -ScanIterator::ScanIterator(ScanIterator &&rhs) - : _db(std::move(rhs._db)), - _itr(rhs._itr), - _end(rhs._end) -{ } - } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.h index 5c1f224c1e7..fe8c246fafe 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketscaniterator.h @@ -19,16 +19,16 @@ class ScanIterator { private: using BucketId = document::BucketId; using BucketIterator = BucketDB::ConstMapIterator; - BucketDBOwner::Guard _db; + const Guard &_db; BucketIterator _itr; BucketIterator _end; public: enum class Pass {FIRST, SECOND}; - ScanIterator(BucketDBOwner::Guard db, Pass pass, BucketId lastBucket, BucketId endBucket); - ScanIterator(BucketDBOwner::Guard db, BucketId bucket); + ScanIterator(const Guard & db, Pass pass, BucketId lastBucket, BucketId endBucket); + ScanIterator(const Guard & db, BucketId bucket); ScanIterator(const ScanIterator &) = delete; - ScanIterator(ScanIterator &&rhs); + ScanIterator(ScanIterator &&rhs) = delete; ScanIterator &operator=(const ScanIterator &) = delete; ScanIterator &operator=(ScanIterator &&rhs) = delete; diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketsessionbase.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketsessionbase.h index 6e2c0043ef9..97f0d5c3df9 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketsessionbase.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketsessionbase.h @@ -20,12 +20,11 @@ public: typedef storage::spi::Timestamp Timestamp; protected: - BucketDBOwner::Guard _bucketDB; + Guard _bucketDB; IBucketCreateNotifier &_bucketCreateNotifier; public: BucketSessionBase(BucketDBOwner &bucketDB, IBucketCreateNotifier &bucketCreateNotifier); - bool extractInfo(const BucketId &bucket, BucketState *&info); static bool calcFixupNeed(BucketState *state, bool wantActive, bool fixup); diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_listener.h b/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_listener.h index e00e24332e0..53a5b02f2e3 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_listener.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_listener.h @@ -6,6 +6,8 @@ namespace document { class BucketId; } namespace proton::bucketdb { +class Guard; + /** * Interface class used by a registered listener to get notifications about * non-empty buckets created due to split/join operations. @@ -13,13 +15,13 @@ namespace proton::bucketdb { class IBucketCreateListener { public: - virtual ~IBucketCreateListener() {} + virtual ~IBucketCreateListener() = default; /** * Signal that the given bucket has been created due to split/join * operation. */ - virtual void notifyCreateBucket(const document::BucketId &bucket) = 0; + virtual void notifyCreateBucket(const Guard & guard, const document::BucketId &bucket) = 0; }; } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_notifier.h b/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_notifier.h index 0fd4e6707a1..c0a0e586d2a 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_notifier.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/i_bucket_create_notifier.h @@ -7,6 +7,7 @@ namespace document { class BucketId; } namespace proton::bucketdb { class IBucketCreateListener; +class Guard; /** * Interface class used to (un)register a listener to get notifications about @@ -15,13 +16,13 @@ class IBucketCreateListener; class IBucketCreateNotifier { public: - virtual ~IBucketCreateNotifier() {} + virtual ~IBucketCreateNotifier() = default; /** * Signal that the given bucket has been created due to split/join * operation. */ - virtual void notifyCreateBucket(const document::BucketId &bucket) = 0; + virtual void notifyCreateBucket(const Guard & guard, const document::BucketId &bucket) = 0; /* * Register bucket create listener. diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/joinbucketssession.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/joinbucketssession.cpp index f8f707dbfc3..657e6a6a9bb 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/joinbucketssession.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/joinbucketssession.cpp @@ -97,7 +97,7 @@ JoinBucketsSession::finish() _bucketDB->deleteEmptyBucket(_source2); } if (!_source1Delta.empty() || !_source2Delta.empty()) { - _bucketCreateNotifier.notifyCreateBucket(_target); + _bucketCreateNotifier.notifyCreateBucket(_bucketDB, _target); } } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/splitbucketsession.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/splitbucketsession.cpp index d03b630b822..cd2503553a0 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/splitbucketsession.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/splitbucketsession.cpp @@ -22,9 +22,7 @@ SplitBucketSession::SplitBucketSession(BucketDBOwner &bucketDB, _source(source), _target1(target1), _target2(target2) -{ -} - +{ } void SplitBucketSession::setup() @@ -49,7 +47,6 @@ SplitBucketSession::setup() } } - void SplitBucketSession::applyDeltas(const BucketDeltaPair &deltas) { @@ -57,10 +54,8 @@ SplitBucketSession::applyDeltas(const BucketDeltaPair &deltas) _target2Delta += deltas._delta2; } - void -SplitBucketSession::applyDelta(const BucketState &delta, BucketState *src, - BucketId &dstBucket) +SplitBucketSession::applyDelta(const BucketState &delta, BucketState *src, BucketId &dstBucket) { if (delta.empty()) return; @@ -69,7 +64,6 @@ SplitBucketSession::applyDelta(const BucketState &delta, BucketState *src, delta.applyDelta(src, dst); } - void SplitBucketSession::finish() { @@ -86,10 +80,10 @@ SplitBucketSession::finish() _bucketDB->deleteEmptyBucket(_source); } if (!_target1Delta.empty()) { - _bucketCreateNotifier.notifyCreateBucket(_target1); + _bucketCreateNotifier.notifyCreateBucket(_bucketDB, _target1); } if (!_target2Delta.empty()) { - _bucketCreateNotifier.notifyCreateBucket(_target2); + _bucketCreateNotifier.notifyCreateBucket(_bucketDB, _target2); } } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index 2225671d8f8..8152761c64d 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -346,15 +346,14 @@ DocumentMetaStore::updateMetaDataAndBucketDB(const GlobalId &gid, namespace { void -unloadBucket(BucketDBOwner &db, const BucketId &id, const BucketState &delta) +unloadBucket(bucketdb::BucketDBOwner &db, const BucketId &id, const BucketState &delta) { if (!id.valid()) { assert(delta.empty()); return; } assert(!delta.empty()); - BucketDBOwner::Guard guard(db.takeGuard()); - guard->unloadBucket(id, delta); + db.takeGuard()->unloadBucket(id, delta); } } @@ -376,14 +375,13 @@ DocumentMetaStore::unload() prevDelta = BucketState(); prev = bucketId; } - prevDelta.add(metaData.getGid(), metaData.getTimestamp(), metaData.getDocSize(), - _subDbType); + prevDelta.add(metaData.getGid(), metaData.getTimestamp(), metaData.getDocSize(), _subDbType); } unloadBucket(*_bucketDB, prev, prevDelta); } -DocumentMetaStore::DocumentMetaStore(BucketDBOwner::SP bucketDB, +DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, const vespalib::string &name, const GrowStrategy &grow, SubDbType subDbType) @@ -398,7 +396,7 @@ DocumentMetaStore::DocumentMetaStore(BucketDBOwner::SP bucketDB, _lidAlloc(_metaDataStore.size(), _metaDataStore.capacity(), getGenerationHolder()), - _bucketDB(bucketDB), + _bucketDB(std::move(bucketDB)), _shrinkLidSpaceBlockers(0), _subDbType(subDbType), _trackDocumentSizes(true), @@ -546,7 +544,7 @@ DocumentMetaStore::updateMetaData(DocId lid, } void -DocumentMetaStore::remove(DocId lid, uint64_t prepare_serial_num, BucketDBOwner::Guard &bucketGuard) +DocumentMetaStore::remove(DocId lid, uint64_t prepare_serial_num, bucketdb::Guard &bucketGuard) { const GlobalId & gid = getRawGid(lid); KeyComp comp(gid, _metaDataStore); @@ -577,7 +575,7 @@ DocumentMetaStore::remove(DocId lid, uint64_t prepare_serial_num) if (!validLid(lid)) { return false; } - BucketDBOwner::Guard bucketGuard = _bucketDB->takeGuard(); + bucketdb::Guard bucketGuard = _bucketDB->takeGuard(); remove(lid, prepare_serial_num, bucketGuard); incGeneration(); if (_op_listener) { @@ -624,7 +622,7 @@ DocumentMetaStore::move(DocId fromLid, DocId toLid, uint64_t prepare_serial_num) void DocumentMetaStore::removeBatch(const std::vector<DocId> &lidsToRemove, const uint32_t docIdLimit) { - BucketDBOwner::Guard bucketGuard = _bucketDB->takeGuard(); + bucketdb::Guard bucketGuard = _bucketDB->takeGuard(); for (const auto &lid : lidsToRemove) { assert(lid > 0 && lid < docIdLimit); (void) docIdLimit; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 74447878f09..a8bce39a5a4 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -8,7 +8,6 @@ #include "lid_gid_key_comparator.h" #include "lid_hold_list.h" #include "raw_document_meta_data.h" -#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/common/subdbtype.h> #include <vespa/searchlib/attribute/singlesmallnumericattribute.h> #include <vespa/searchlib/queryeval/blueprint.h> @@ -16,13 +15,14 @@ #include <vespa/vespalib/util/rcuvector.h> namespace proton::bucketdb { -class SplitBucketSession; -class JoinBucketsSession; + class SplitBucketSession; + class JoinBucketsSession; + class Guard; } namespace proton::documentmetastore { -class OperationListener; -class Reader; + class OperationListener; + class Reader; } namespace proton { @@ -54,25 +54,27 @@ public: private: // maps from lid -> meta data - typedef vespalib::RcuVectorBase<RawDocumentMetaData> MetaDataStore; - typedef documentmetastore::LidGidKeyComparator KeyComp; + using MetaDataStore = vespalib::RcuVectorBase<RawDocumentMetaData>; + using KeyComp = documentmetastore::LidGidKeyComparator; + using OperationListenerSP = std::shared_ptr<documentmetastore::OperationListener>; + using BucketDBOwnerSP = std::shared_ptr<bucketdb::BucketDBOwner>; // Lids are stored as keys in the tree, sorted by their gid // counterpart. The LidGidKeyComparator class maps from lids -> metadata by // using the metadata store. - typedef vespalib::btree::BTree<documentmetastore::GidToLidMapKey, vespalib::btree::BTreeNoLeafData, - vespalib::btree::NoAggregated, const KeyComp &> TreeType; + using TreeType = vespalib::btree::BTree<documentmetastore::GidToLidMapKey, vespalib::btree::BTreeNoLeafData, + vespalib::btree::NoAggregated, const KeyComp &>; MetaDataStore _metaDataStore; TreeType _gidToLidMap; Iterator _gid_to_lid_map_write_itr; // Iterator used for all updates of _gidToLidMap SerialNum _gid_to_lid_map_write_itr_prepare_serial_num; documentmetastore::LidAllocator _lidAlloc; - BucketDBOwner::SP _bucketDB; + BucketDBOwnerSP _bucketDB; uint32_t _shrinkLidSpaceBlockers; const SubDbType _subDbType; bool _trackDocumentSizes; - std::shared_ptr<documentmetastore::OperationListener> _op_listener; + OperationListenerSP _op_listener; DocId getFreeLid(); DocId peekFreeLid(); @@ -124,7 +126,7 @@ private: VESPA_DLL_LOCAL DocId readNextDoc(documentmetastore::Reader & reader, TreeType::Builder & treeBuilder); - void remove(DocId lid, uint64_t cached_iterator_sequence_id, BucketDBOwner::Guard &bucketGuard); + void remove(DocId lid, uint64_t cached_iterator_sequence_id, bucketdb::Guard &bucketGuard); public: typedef TreeType::Iterator Iterator; @@ -134,7 +136,7 @@ public: sizeof(uint32_t) + GlobalId::LENGTH + sizeof(uint8_t) + sizeof(Timestamp::Type); - DocumentMetaStore(BucketDBOwner::SP bucketDB, + DocumentMetaStore(BucketDBOwnerSP bucketDB, const vespalib::string & name=getFixedName(), const search::GrowStrategy & grow=search::GrowStrategy(), SubDbType subDbType = SubDbType::READY); @@ -227,7 +229,7 @@ public: /** * Implements documentmetastore::IBucketHandler. */ - BucketDBOwner &getBucketDB() const override { return *_bucketDB; } + bucketdb::BucketDBOwner &getBucketDB() const override { return *_bucketDB; } bucketdb::BucketDeltaPair handleSplit(const bucketdb::SplitBucketSession &session) override; bucketdb::BucketDeltaPair handleJoin(const bucketdb::JoinBucketsSession &session) override; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp index 90665a1ebfe..1f83504a284 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp @@ -11,10 +11,10 @@ DocumentMetaStoreContext::ReadGuard::ReadGuard(const search::AttributeVector::SP } -DocumentMetaStoreContext::DocumentMetaStoreContext(BucketDBOwner::SP bucketDB, +DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const vespalib::string &name, const search::GrowStrategy &grow) : - _metaStoreAttr(std::make_shared<DocumentMetaStore>(bucketDB, name, grow)), + _metaStoreAttr(std::make_shared<DocumentMetaStore>(std::move(bucketDB), name, grow)), _metaStore(std::dynamic_pointer_cast<IDocumentMetaStore>(_metaStoreAttr)) { } @@ -26,7 +26,7 @@ DocumentMetaStoreContext::DocumentMetaStoreContext(const search::AttributeVector { } -DocumentMetaStoreContext::~DocumentMetaStoreContext() {} +DocumentMetaStoreContext::~DocumentMetaStoreContext() = default; void DocumentMetaStoreContext::constructFreeList() diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index cc5a0b577cf..5f5a81ac865 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -4,7 +4,6 @@ #include "documentmetastore.h" #include "i_document_meta_store_context.h" -#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> namespace proton { @@ -32,10 +31,10 @@ public: * Create a new context instantiating a document meta store * with the given name, grow strategy, and comparator. */ - DocumentMetaStoreContext(BucketDBOwner::SP bucketDB, + DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const vespalib::string &name = DocumentMetaStore::getFixedName(), const search::GrowStrategy &grow = search::GrowStrategy()); - ~DocumentMetaStoreContext(); + ~DocumentMetaStoreContext() override; /** * Create a new context with the given document meta store encapsulated * as an attribute vector. diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h index f96972c4562..4365e116f10 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h @@ -3,14 +3,13 @@ #pragma once #include <vespa/document/bucket/bucketid.h> -#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> -#include <vespa/searchcore/proton/bucketdb/bucketstate.h> #include <vespa/searchcore/proton/bucketdb/bucketdeltapair.h> #include <vector> namespace proton::bucketdb { class SplitBucketSession; class JoinBucketsSession; + class BucketDBOwner; } namespace proton::documentmetastore { @@ -22,9 +21,9 @@ struct IBucketHandler { typedef document::BucketId BucketId; - virtual ~IBucketHandler() {} + virtual ~IBucketHandler() = default; - virtual BucketDBOwner &getBucketDB() const = 0; + virtual bucketdb::BucketDBOwner &getBucketDB() const = 0; /** * Split the source bucket into two target buckets. diff --git a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp index ec2d1b70e4a..eee67ce6c6b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp @@ -2,6 +2,7 @@ #include "buckethandler.h" #include "ibucketstatechangedhandler.h" +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/vespalib/util/lambdatask.h> #include <vespa/log/log.h> @@ -58,8 +59,7 @@ BucketHandler::deactivateAllActiveBuckets() BucketId::List buckets; _ready->getBucketDB().takeGuard()->getActiveBuckets(buckets); for (auto bucketId : buckets) { - _ready->setBucketState(bucketId, - storage::spi::BucketInfo::NOT_ACTIVE); + _ready->setBucketState(bucketId, storage::spi::BucketInfo::NOT_ACTIVE); // Don't notify bucket state changed, node is marked down so // noone is listening. } diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp index 1c642205c86..8b9b3c539d6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp @@ -228,7 +228,7 @@ BucketMoveJob::deactivateBucket(BucketId bucket) void BucketMoveJob::activateBucket(BucketId bucket) { - BucketDBOwner::Guard notReadyBdb(_notReady.meta_store()->getBucketDB().takeGuard()); + bucketdb::Guard notReadyBdb(_notReady.meta_store()->getBucketDB().takeGuard()); if (notReadyBdb->get(bucket).getDocumentCount() == 0) { return; // notready bucket already empty. This is the normal case. } @@ -236,7 +236,7 @@ BucketMoveJob::activateBucket(BucketId bucket) } void -BucketMoveJob::notifyCreateBucket(const BucketId &bucket) +BucketMoveJob::notifyCreateBucket(const bucketdb::Guard &, const BucketId &bucket) { _delayedBuckets.insert(bucket); considerRun(); diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h index 8a84a10199c..0a2af6e1535 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h +++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h @@ -139,7 +139,7 @@ public: void notifyDiskMemUsage(DiskMemUsageState state) override; // bucketdb::IBucketCreateListener API - void notifyCreateBucket(const document::BucketId &bucket) override; + void notifyCreateBucket(const bucketdb::Guard & guard, const document::BucketId &bucket) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h index c8e1310ec3b..808c9430590 100644 --- a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h @@ -39,15 +39,10 @@ private: public: ClusterStateHandler(vespalib::Executor &executor); + ~ClusterStateHandler() override; - virtual - ~ClusterStateHandler(); - - virtual void - addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; - - virtual void - removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; + void addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; + void removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; /** * Implements the cluster state aspect of IPersistenceHandler. diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp index d37c4c84021..309704958a8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp @@ -1,9 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "combiningfeedview.h" -#include <vespa/document/fieldvalue/document.h> #include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> #include <vespa/searchcore/proton/feedoperation/operations.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> +#include <vespa/document/fieldvalue/document.h> #include <vespa/vespalib/util/idestructorcallback.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.cpp b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.cpp index 7c1b3b67f30..76a65df4d1a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.cpp @@ -7,6 +7,7 @@ #include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> #include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/document/fieldvalue/document.h> #include <vespa/vespalib/util/destructor_callbacks.h> @@ -35,17 +36,12 @@ BucketMover::createMoveOperation(const MoveKey &key) { void BucketMover::moveDocument(MoveOperationUP moveOp, IDestructorCallbackSP onDone) { - // We cache the bucket for the document we are going to move to avoid getting - // inconsistent bucket info (getBucketInfo()) while moving between ready and not-ready - // sub dbs as the bucket info is not updated atomically in this case. - _bucketDb->takeGuard()->cacheBucket(moveOp->getBucketId()); _handler->handleMove(*moveOp, std::move(onDone)); - _bucketDb->takeGuard()->uncacheBucket(); } BucketMover::BucketMover(const BucketId &bucket, const MaintenanceDocumentSubDB *source, uint32_t targetSubDbId, - IDocumentMoveHandler &handler,BucketDBOwner &bucketDb) noexcept + IDocumentMoveHandler &handler, BucketDBOwner &bucketDb) noexcept : _source(source), _handler(&handler), _bucketDb(&bucketDb), @@ -111,11 +107,15 @@ BucketMover::moveDocuments(size_t maxDocsToMove, IMoveOperationLimiter &limiter) if (moveOps.empty()) return allOk; updateLastValidGid(moveOps.back()->getDocument()->getId().getGlobalId()); - std::vector<IDestructorCallbackSP> opTrackers; - for (size_t i(0); i < moveOps.size(); i++) { - opTrackers.push_back(limiter.beginOperation()); + + for (auto & moveOp : moveOps) { + // We cache the bucket for the document we are going to move to avoid getting + // inconsistent bucket info (getBucketInfo()) while moving between ready and not-ready + // sub dbs as the bucket info is not updated atomically in this case. + _bucketDb->takeGuard()->cacheBucket(moveOp->getBucketId()); + _handler->handleMove(*moveOp, limiter.beginOperation()); + _bucketDb->takeGuard()->uncacheBucket(); } - moveDocuments(std::move(moveOps), std::make_shared<vespalib::KeepAlive<std::vector<IDestructorCallbackSP>>>(opTrackers)); return allOk; } @@ -132,7 +132,7 @@ DocumentBucketMover::DocumentBucketMover(IMoveOperationLimiter &limiter) noexcep void DocumentBucketMover::setupForBucket(const document::BucketId &bucket, const MaintenanceDocumentSubDB *source, - uint32_t targetSubDbId, IDocumentMoveHandler &handler, BucketDBOwner &bucketDb) + uint32_t targetSubDbId, IDocumentMoveHandler &handler, bucketdb::BucketDBOwner &bucketDb) { _impl = std::make_unique<BucketMover>(bucket, source, targetSubDbId, handler, bucketDb); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h index 6b2cda497dc..dc91d40ce4e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h @@ -10,14 +10,16 @@ namespace vespalib { class IDestructorCallback; } namespace proton { -class BucketDBOwner; struct IDocumentMoveHandler; struct IMoveOperationLimiter; class MaintenanceDocumentSubDB; class MoveOperation; namespace bucketdb { - /** + +class BucketDBOwner; + +/** * Class used to move all documents in a bucket from a source sub database * to a target sub database. The actual moving is handled by a given instance * of IDocumentMoveHandler. @@ -49,7 +51,7 @@ public: BucketMover(const BucketMover &) = delete; BucketMover & operator=(const BucketMover &) = delete; - // TODO remove once we have swaitched bucket move job + // TODO remove once we have switched bucket move job bool moveDocuments(size_t maxDocsToMove, IMoveOperationLimiter &limiter); /// Must be called in master thread @@ -105,7 +107,7 @@ public: const MaintenanceDocumentSubDB *source, uint32_t targetSubDbId, IDocumentMoveHandler &handler, - BucketDBOwner &bucketDb); + bucketdb::BucketDBOwner &bucketDb); const document::BucketId &getBucket() const { return _impl->getBucket(); } bool moveDocuments(size_t maxDocsToMove); void cancel() { _impl->cancel(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 166d1e928bb..de692ebe68a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -1007,7 +1007,7 @@ void notifyBucketsChanged(const documentmetastore::IBucketHandler &metaStore, IBucketModifiedHandler &handler, const vespalib::string &name) { - BucketDBOwner::Guard buckets = metaStore.getBucketDB().takeGuard(); + bucketdb::Guard buckets = metaStore.getBucketDB().takeGuard(); for (const auto &kv : *buckets) { handler.notifyBucketModified(kv.first); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 6ce0b896a50..4a66a7caab4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -51,7 +51,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( _bucketDBHandler(), _hwInfo(hwInfo) { - _bucketDB = std::make_shared<BucketDBOwner>(); + _bucketDB = std::make_shared<bucketdb::BucketDBOwner>(); _bucketDBHandler = std::make_unique<bucketdb::BucketDBHandler>(*_bucketDB); StoreOnlyDocSubDB::Context context(owner, tlSyncer, getSerialNum, fileHeaderContext, writeService, diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index c86370c942b..15b188f7616 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -79,9 +79,8 @@ private: const uint32_t _notReadySubDbId; using RetrieversSP = std::shared_ptr<std::vector<std::shared_ptr<IDocumentRetriever>> >; vespalib::VarHolder<RetrieversSP> _retrievers; - using ReprocessingTasks = std::vector<std::shared_ptr<IReprocessingTask>>; ReprocessingRunner _reprocessingRunner; - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; std::unique_ptr<bucketdb::BucketDBHandler> _bucketDBHandler; HwInfo _hwInfo; @@ -122,7 +121,7 @@ public: const_iterator begin() const { return _subDBs.begin(); } const_iterator end() const { return _subDBs.end(); } - BucketDBOwner &getBucketDB() { return *_bucketDB; } + bucketdb::BucketDBOwner &getBucketDB() { return *_bucketDB; } bucketdb::IBucketDBHandler &getBucketDBHandler() { return *_bucketDBHandler; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index 9b504c74635..d59ca6647dd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -72,7 +72,7 @@ StoreOnlyDocSubDB::Context::Context(IDocumentSubDBOwner &owner, const IGetSerialNum &getSerialNum, const FileHeaderContext &fileHeaderContext, searchcorespi::index::IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + BucketDBOwnerSP bucketDB, bucketdb::IBucketDBHandlerInitializer & bucketDBHandlerInitializer, DocumentDBTaggedMetrics &metrics, std::mutex &configMutex, diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 37229bd551c..eb0821d4535 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -82,6 +82,7 @@ public: class StoreOnlyDocSubDB : public DocSubDB { public: + using BucketDBOwnerSP = std::shared_ptr<bucketdb::BucketDBOwner>; struct Config { const DocTypeName _docTypeName; const vespalib::string _subName; @@ -101,7 +102,7 @@ public: const IGetSerialNum &_getSerialNum; const search::common::FileHeaderContext &_fileHeaderContext; searchcorespi::index::IThreadingService &_writeService; - std::shared_ptr<BucketDBOwner> _bucketDB; + BucketDBOwnerSP _bucketDB; bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; DocumentDBTaggedMetrics &_metrics; std::mutex &_configMutex; @@ -112,7 +113,7 @@ public: const IGetSerialNum &getSerialNum, const search::common::FileHeaderContext &fileHeaderContext, searchcorespi::index::IThreadingService &writeService, - std::shared_ptr<BucketDBOwner> bucketDB, + BucketDBOwnerSP bucketDB, bucketdb::IBucketDBHandlerInitializer & bucketDBHandlerInitializer, DocumentDBTaggedMetrics &metrics, @@ -126,7 +127,7 @@ protected: const DocTypeName _docTypeName; const vespalib::string _subName; const vespalib::string _baseDir; - BucketDBOwner::SP _bucketDB; + BucketDBOwnerSP _bucketDB; bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; IDocumentMetaStoreContext::SP _metaStoreCtx; // The following two serial numbers reflect state at program startup diff --git a/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h b/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h index a6ff6d86d0d..da2d332964c 100644 --- a/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h +++ b/searchcore/src/vespa/searchcore/proton/test/document_meta_store_observer.h @@ -91,34 +91,34 @@ struct DocumentMetaStoreObserver : public IDocumentMetaStore const DocId docIdLimit) override { _store.removeBatch(lidsToRemove, docIdLimit); } - virtual void removeBatchComplete(const std::vector<DocId> &lidsToRemove) override { + void removeBatchComplete(const std::vector<DocId> &lidsToRemove) override { _store.removeBatchComplete(lidsToRemove); } - virtual const RawDocumentMetaData &getRawMetaData(DocId lid) const override { + const RawDocumentMetaData &getRawMetaData(DocId lid) const override { return _store.getRawMetaData(lid); } /** * Implements documentmetastore::IBucketHandler. */ - virtual BucketDBOwner &getBucketDB() const override { + bucketdb::BucketDBOwner &getBucketDB() const override { return _store.getBucketDB(); } - virtual bucketdb::BucketDeltaPair + bucketdb::BucketDeltaPair handleSplit(const bucketdb::SplitBucketSession &session) override { return _store.handleSplit(session); } - virtual bucketdb::BucketDeltaPair + bucketdb::BucketDeltaPair handleJoin(const bucketdb::JoinBucketsSession &session) override { return _store.handleJoin(session); } - virtual void updateActiveLids(const BucketId &bucketId, bool active) override { + void updateActiveLids(const BucketId &bucketId, bool active) override { _store.updateActiveLids(bucketId, active); } - virtual void setBucketState(const BucketId &bucketId, bool active) override { + void setBucketState(const BucketId &bucketId, bool active) override { _store.setBucketState(bucketId, active); } - virtual void populateActiveBuckets(const document::BucketId::List &buckets) override { + void populateActiveBuckets(const document::BucketId::List &buckets) override { _store.populateActiveBuckets(buckets); } @@ -126,64 +126,64 @@ struct DocumentMetaStoreObserver : public IDocumentMetaStore /** * Implements proton::IDocumentMetaStore */ - virtual void constructFreeList() override { + void constructFreeList() override { _store.constructFreeList(); } - virtual Iterator begin() const override { + Iterator begin() const override { return _store.begin(); } - virtual Iterator lowerBound(const BucketId &bucketId) const override { + Iterator lowerBound(const BucketId &bucketId) const override { return _store.lowerBound(bucketId); } - virtual Iterator upperBound(const BucketId &bucketId) const override { + Iterator upperBound(const BucketId &bucketId) const override { return _store.upperBound(bucketId); } - virtual Iterator lowerBound(const GlobalId &gid) const override { + Iterator lowerBound(const GlobalId &gid) const override { return _store.lowerBound(gid); } - virtual Iterator upperBound(const GlobalId &gid) const override { + Iterator upperBound(const GlobalId &gid) const override { return _store.upperBound(gid); } - virtual void getLids(const BucketId &bucketId, std::vector<DocId> &lids) override { + void getLids(const BucketId &bucketId, std::vector<DocId> &lids) override { _store.getLids(bucketId, lids); } - virtual DocId getNumUsedLids() const override { + DocId getNumUsedLids() const override { return _store.getNumUsedLids(); } - virtual DocId getNumActiveLids() const override { + DocId getNumActiveLids() const override { return _store.getNumActiveLids(); } - virtual bool getFreeListActive() const override { + bool getFreeListActive() const override { return _store.getFreeListActive(); } - virtual void compactLidSpace(DocId wantedLidLimit) override { + void compactLidSpace(DocId wantedLidLimit) override { _compactLidSpaceLidLimit = wantedLidLimit; _store.compactLidSpace(wantedLidLimit); } - virtual void holdUnblockShrinkLidSpace() override { + void holdUnblockShrinkLidSpace() override { ++_holdUnblockShrinkLidSpaceCnt; _store.holdUnblockShrinkLidSpace(); } - virtual void commit(search::SerialNum firstSerialNum, - search::SerialNum lastSerialNum) override { + void commit(search::SerialNum firstSerialNum, + search::SerialNum lastSerialNum) override { _store.commit(firstSerialNum, lastSerialNum); } - virtual DocId getCommittedDocIdLimit() const override { + DocId getCommittedDocIdLimit() const override { return _store.getCommittedDocIdLimit(); } - virtual void removeAllOldGenerations() override { + void removeAllOldGenerations() override { _store.removeAllOldGenerations(); } - virtual bool canShrinkLidSpace() const override { + bool canShrinkLidSpace() const override { return _store.canShrinkLidSpace(); } - virtual search::SerialNum getLastSerialNum() const override { + search::SerialNum getLastSerialNum() const override { return _store.getLastSerialNum(); } - virtual void foreach(const search::IGidToLidMapperVisitor &visitor) const override { + void foreach(const search::IGidToLidMapperVisitor &visitor) const override { _store.foreach(visitor); } - virtual void set_operation_listener(documentmetastore::OperationListener::SP op_listener) override { + void set_operation_listener(documentmetastore::OperationListener::SP op_listener) override { _store.set_operation_listener(std::move(op_listener)); } }; 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 4c3839b3d0c..c95a938539c 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 @@ -31,7 +31,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB std::unique_ptr<ExecutorThreadingService> _writeService; PendingLidTracker _pendingLidTracker; - DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, uint32_t subDbId) + DummyDocumentSubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, uint32_t subDbId) : _subDbId(subDbId), _metaStoreCtx(std::move(bucketDB)), _summaryManager(), |