diff options
Diffstat (limited to 'searchcore/src/tests')
5 files changed, 51 insertions, 91 deletions
diff --git a/searchcore/src/tests/proton/common/dummydbowner.h b/searchcore/src/tests/proton/common/dummydbowner.h deleted file mode 100644 index 1fa9c17257c..00000000000 --- a/searchcore/src/tests/proton/common/dummydbowner.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -#include <vespa/searchcore/proton/server/idocumentdbowner.h> -#include <vespa/searchcore/proton/reference/document_db_reference_registry.h> -#include <vespa/vespalib/stllike/string.h> - -namespace proton { - -struct DummyDBOwner : IDocumentDBOwner { - std::shared_ptr<IDocumentDBReferenceRegistry> _registry; - - DummyDBOwner() - : _registry(std::make_shared<DocumentDBReferenceRegistry>()) - {} - ~DummyDBOwner() {} - - bool isInitializing() const override { return false; } - - uint32_t getDistributionKey() const override { return -1; } - std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override { - return _registry; - } -}; - -} // namespace proton diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 5b081fb5b51..9709530f2c2 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -1,6 +1,34 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <tests/proton/common/dummydbowner.h> +#include <vespa/searchcore/proton/test/dummydbowner.h> +#include <vespa/searchcore/proton/attribute/attribute_writer.h> +#include <vespa/searchcore/proton/docsummary/docsumcontext.h> +#include <vespa/searchcore/proton/docsummary/documentstoreadapter.h> +#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> +#include <vespa/searchcore/proton/feedoperation/putoperation.h> +#include <vespa/searchcore/proton/matching/querylimiter.h> +#include <vespa/searchcore/proton/metrics/metricswireservice.h> +#include <vespa/searchcore/proton/server/bootstrapconfig.h> +#include <vespa/searchcore/proton/server/documentdb.h> +#include <vespa/searchcore/proton/server/documentdbconfigmanager.h> +#include <vespa/searchcore/proton/server/feedhandler.h> +#include <vespa/searchcore/proton/server/idocumentsubdb.h> +#include <vespa/searchcore/proton/server/memoryconfigstore.h> +#include <vespa/searchcore/proton/server/searchview.h> +#include <vespa/searchcore/proton/server/summaryadapter.h> +#include <vespa/searchcore/proton/test/bucketfactory.h> +#include <vespa/searchcore/proton/test/mock_shared_threading_service.h> +#include <vespa/searchlib/attribute/interlock.h> +#include <vespa/searchlib/engine/docsumapi.h> +#include <vespa/searchlib/index/dummyfileheadercontext.h> +#include <vespa/searchlib/tensor/tensor_attribute.h> +#include <vespa/searchlib/test/doc_builder.h> +#include <vespa/searchlib/transactionlog/nosyncproxy.h> +#include <vespa/searchlib/transactionlog/translogserver.h> +#include <vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h> +#include <vespa/searchsummary/docsummary/i_docsum_store_document.h> +#include <vespa/searchsummary/docsummary/i_juniper_converter.h> +#include <vespa/searchsummary/docsummary/linguisticsannotation.h> #include <vespa/config-bucketspaces.h> #include <vespa/config/helper/configgetter.hpp> #include <vespa/document/annotation/annotation.h> @@ -31,34 +59,6 @@ #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/test/value_compare.h> #include <vespa/eval/eval/value.h> -#include <vespa/searchcore/proton/attribute/attribute_writer.h> -#include <vespa/searchcore/proton/docsummary/docsumcontext.h> -#include <vespa/searchcore/proton/docsummary/documentstoreadapter.h> -#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> -#include <vespa/searchcore/proton/feedoperation/putoperation.h> -#include <vespa/searchcore/proton/matching/querylimiter.h> -#include <vespa/searchcore/proton/metrics/metricswireservice.h> -#include <vespa/searchcore/proton/server/bootstrapconfig.h> -#include <vespa/searchcore/proton/server/documentdb.h> -#include <vespa/searchcore/proton/server/documentdbconfigmanager.h> -#include <vespa/searchcore/proton/server/feedhandler.h> -#include <vespa/searchcore/proton/server/idocumentsubdb.h> -#include <vespa/searchcore/proton/server/memoryconfigstore.h> -#include <vespa/searchcore/proton/server/searchview.h> -#include <vespa/searchcore/proton/server/summaryadapter.h> -#include <vespa/searchcore/proton/test/bucketfactory.h> -#include <vespa/searchcore/proton/test/mock_shared_threading_service.h> -#include <vespa/searchlib/attribute/interlock.h> -#include <vespa/searchlib/engine/docsumapi.h> -#include <vespa/searchlib/index/dummyfileheadercontext.h> -#include <vespa/searchlib/tensor/tensor_attribute.h> -#include <vespa/searchlib/test/doc_builder.h> -#include <vespa/searchlib/transactionlog/nosyncproxy.h> -#include <vespa/searchlib/transactionlog/translogserver.h> -#include <vespa/searchsummary/docsummary/i_docsum_field_writer_factory.h> -#include <vespa/searchsummary/docsummary/i_docsum_store_document.h> -#include <vespa/searchsummary/docsummary/i_juniper_converter.h> -#include <vespa/searchsummary/docsummary/linguisticsannotation.h> #include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/data/slime/json_format.h> #include <vespa/vespalib/data/slime/slime.h> diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 53ea1b3542f..600e4981c0f 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -155,6 +155,7 @@ struct Fixture RankingAssetsRepo _constantValueRepo; vespalib::ThreadStackExecutor _summaryExecutor; std::shared_ptr<PendingLidTrackerBase> _pendingLidsForCommit; + SessionManager _sessionMgr; ViewSet _views; MyDocumentDBReferenceResolver _resolver; ConfigurerUP _configurer; @@ -170,6 +171,7 @@ Fixture::Fixture() _constantValueRepo(_constantValueFactory), _summaryExecutor(8, 128_Ki), _pendingLidsForCommit(std::make_shared<PendingLidTracker>()), + _sessionMgr(100), _views(), _resolver(), _configurer() @@ -197,7 +199,6 @@ Fixture::initViewSet(ViewSet &views) auto summaryMgr = make_shared<SummaryManager> (_summaryExecutor, search::LogDocumentStore::Config(), search::GrowStrategy(), BASE_DIR, TuneFileSummary(), views._fileHeaderContext,views._noTlSyncer, search::IBucketizer::SP()); - auto sesMgr = make_shared<SessionManager>(100); auto metaStore = make_shared<DocumentMetaStoreContext>(make_shared<bucketdb::BucketDBOwner>()); auto indexWriter = std::make_shared<IndexWriter>(indexMgr); auto attrWriter = std::make_shared<AttributeWriter>(attrMgr); @@ -207,7 +208,7 @@ Fixture::initViewSet(ViewSet &views) views._summaryMgr = summaryMgr; views._dmsc = metaStore; IndexSearchable::SP indexSearchable; - auto matchView = std::make_shared<MatchView>(matchers, indexSearchable, attrMgr, sesMgr, metaStore, views._docIdLimit); + auto matchView = std::make_shared<MatchView>(matchers, indexSearchable, attrMgr, _sessionMgr, metaStore, views._docIdLimit); views.searchView.set(SearchView::create (summaryMgr->createSummarySetup(SummaryConfig(), JuniperrcConfig(), views.repo, attrMgr), @@ -349,9 +350,7 @@ struct SearchViewComparer void expect_not_equal_attribute_manager() { EXPECT_NOT_EQUAL(_old->getAttributeManager().get(), _new->getAttributeManager().get()); } - void expect_equal_session_manager() { - EXPECT_EQUAL(_old->getSessionManager().get(), _new->getSessionManager().get()); - } + void expect_equal_document_meta_store() { EXPECT_EQUAL(_old->getDocumentMetaStore().get(), _new->getDocumentMetaStore().get()); } @@ -436,7 +435,6 @@ TEST_F("require that we can reconfigure index searchable", Fixture) cmp.expect_equal_matchers(); cmp.expect_not_equal_index_searchable(); cmp.expect_equal_attribute_manager(); - cmp.expect_equal_session_manager(); cmp.expect_equal_document_meta_store(); } { // verify feed view @@ -471,7 +469,6 @@ TEST_F("require that we can reconfigure attribute manager", Fixture) cmp.expect_not_equal_matchers(); cmp.expect_equal_index_searchable(); cmp.expect_not_equal_attribute_manager(); - cmp.expect_equal_session_manager(); cmp.expect_equal_document_meta_store(); } { // verify feed view @@ -587,7 +584,6 @@ TEST_F("require that we can reconfigure matchers", Fixture) cmp.expect_not_equal_matchers(); cmp.expect_equal_index_searchable(); cmp.expect_equal_attribute_manager(); - cmp.expect_equal_session_manager(); cmp.expect_equal_document_meta_store(); } { // verify feed view 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 43717fc724f..dd402a6e637 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 @@ -93,11 +93,18 @@ struct ConfigDir4 { static vespalib::string dir() { return TEST_PATH("cfg4"); } struct MySubDBOwner : public IDocumentSubDBOwner { + SessionManager _sessionMgr; + MySubDBOwner(); + ~MySubDBOwner() override; document::BucketSpace getBucketSpace() const override { return makeBucketSpace(); } vespalib::string getName() const override { return "owner"; } uint32_t getDistributionKey() const override { return -1; } + SessionManager & session_manager() override { return _sessionMgr; } }; +MySubDBOwner::MySubDBOwner() : _sessionMgr(1) {} +MySubDBOwner::~MySubDBOwner() = default; + struct MySyncProxy : public SyncProxy { void sync(SerialNum) override {} @@ -354,8 +361,7 @@ struct FixtureBase vespalib::ThreadStackExecutor executor(1, 1_Mi); initializer::TaskRunner taskRunner(executor); taskRunner.runTask(task); - auto sessionMgr = std::make_shared<SessionManager>(1); - runInMasterAndSync([&]() { _subDb.initViews(*_snapshot->_cfg, sessionMgr); }); + runInMasterAndSync([&]() { _subDb.initViews(*_snapshot->_cfg); }); } void basicReconfig(SerialNum serialNum) { runInMasterAndSync([&]() { performReconfig(serialNum, make_all_attr_schema(two_attr_schema), ConfigDir2::dir()); }); diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index 916f3106923..7aa18513f73 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -1,13 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <tests/proton/common/dummydbowner.h> -#include <vespa/config-bucketspaces.h> -#include <vespa/config/subscription/sourcespec.h> -#include <vespa/document/config/documenttypes_config_fwd.h> -#include <vespa/document/datatype/documenttype.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/document/test/make_bucket_space.h> -#include <vespa/fnet/transport.h> +#include <vespa/searchcore/proton/test/dummydbowner.h> #include <vespa/searchcore/proton/attribute/flushableattribute.h> #include <vespa/searchcore/proton/common/statusreport.h> #include <vespa/searchcore/proton/docsummary/summaryflushtarget.h> @@ -18,6 +11,7 @@ #include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/reference/i_document_db_reference.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h> #include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/server/document_db_explorer.h> #include <vespa/searchcore/proton/server/documentdb.h> @@ -27,6 +21,13 @@ #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/test/mock_shared_threading_service.h> #include <vespa/searchcorespi/index/indexflushtarget.h> +#include <vespa/config-bucketspaces.h> +#include <vespa/config/subscription/sourcespec.h> +#include <vespa/document/config/documenttypes_config_fwd.h> +#include <vespa/document/datatype/documenttype.h> +#include <vespa/document/repo/documenttyperepo.h> +#include <vespa/document/test/make_bucket_space.h> +#include <vespa/fnet/transport.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/interlock.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> @@ -78,22 +79,6 @@ config_subdir(SerialNum serialNum) return os.str(); } -struct MyDBOwner : public DummyDBOwner -{ - std::shared_ptr<DocumentDBReferenceRegistry> _registry; - MyDBOwner(); - ~MyDBOwner() override; - std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override { - return _registry; - } -}; - -MyDBOwner::MyDBOwner() - : DummyDBOwner(), - _registry(std::make_shared<DocumentDBReferenceRegistry>()) -{} -MyDBOwner::~MyDBOwner() = default; - struct FixtureBase { bool _cleanup; bool _file_config; @@ -119,7 +104,7 @@ FixtureBase::~FixtureBase() struct Fixture : public FixtureBase { DummyWireService _dummy; - MyDBOwner _myDBOwner; + DummyDBOwner _myDBOwner; vespalib::ThreadStackExecutor _summaryExecutor; MockSharedThreadingService _shared_service; HwInfo _hwInfo; |