diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-09 13:29:59 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-12 02:55:46 +0100 |
commit | cdbddff2612dbaf16d6f26c92041040ed9a131b2 (patch) | |
tree | b3c949439e81e8f8ff11094c665b05be6c1d9c86 | |
parent | 887053e9be8e0ac9995224ecd89586bfab911fc0 (diff) |
Decouple so that not all config is pulled in everywhere.
27 files changed, 339 insertions, 554 deletions
diff --git a/searchcore/src/tests/proton/config/config.cpp b/searchcore/src/tests/proton/config/config.cpp index 86379e50c9d..f280c609070 100644 --- a/searchcore/src/tests/proton/config/config.cpp +++ b/searchcore/src/tests/proton/config/config.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("config_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/linkedptr.h> #include <map> @@ -11,6 +9,12 @@ LOG_SETUP("config_test"); #include <vespa/searchcore/proton/server/protonconfigurer.h> #include <vespa/vespalib/util/varholder.h> #include <vespa/fileacquirer/config-filedistributorrpc.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-summary.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> using namespace config; using namespace proton; 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 152b1f5cf29..fa610496227 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 @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("document_subdbs_test"); #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/initializer/task_runner.h> @@ -12,11 +9,11 @@ LOG_SETUP("document_subdbs_test"); #include <vespa/searchcore/proton/server/document_subdb_explorer.h> #include <vespa/searchcore/proton/server/emptysearchview.h> #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> -#include <vespa/searchcore/proton/server/idocumentsubdb.h> #include <vespa/searchcore/proton/server/minimal_document_retriever.h> #include <vespa/searchcore/proton/server/searchabledocsubdb.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchcore/proton/test/thread_utils.h> +#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/searchlib/index/docbuilder.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp index 8fd10b49409..859e54dec5a 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("documentdbconfig_test"); - #include <vespa/searchcore/proton/server/documentdbconfig.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-rank-profiles.h> using namespace document; using namespace proton; diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp index 25c55fa2dbc..31d580b0756 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("documentdbconfigscout_test"); - #include <vespa/searchcore/proton/server/documentdbconfig.h> #include <vespa/searchcore/proton/server/documentdbconfigscout.h> #include <vespa/searchcore/proton/test/documentdb_config_builder.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-attributes.h> using namespace document; using namespace proton; diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index 075ad8232b4..8d6d8293d82 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("fileconfigmanager_test"); #include "config-mycfg.h" #include <vespa/searchcore/proton/server/fileconfigmanager.h> @@ -9,6 +6,13 @@ LOG_SETUP("fileconfigmanager_test"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/searchcore/proton/common/schemautil.h> +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> + using namespace config; using namespace document; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp index 5f7e97cd5d5..2bd652b59c7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_initializer.cpp @@ -1,24 +1,22 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "document_subdb_initializer.h" #include "idocumentsubdb.h" #include <future> #include <vespa/searchlib/common/lambdatask.h> +#include <vespa/searchcorespi/index/i_thread_service.h> using search::makeLambdaTask; namespace proton { -DocumentSubDbInitializer::DocumentSubDbInitializer(IDocumentSubDB &subDB, - searchcorespi::index::IThreadService &master) +DocumentSubDbInitializer::DocumentSubDbInitializer(IDocumentSubDB &subDB, searchcorespi::index::IThreadService &master) : InitTask(), _result(), _documentMetaStoreInitTask(), _subDB(subDB), _master(master) -{ -} +{ } void DocumentSubDbInitializer:: @@ -38,4 +36,4 @@ DocumentSubDbInitializer::run() (void) future.get(); } -} // namespace proton +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 07c3cd7f946..22643c9fba2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -441,7 +441,7 @@ public: // Implements IDocSubDB::IOwner void syncFeedView() override; - searchcorespi::IIndexManagerFactory::SP + std::shared_ptr<searchcorespi::IIndexManagerFactory> getIndexManagerFactory(const vespalib::stringref & name) const override; vespalib::string getName() const override { return _docTypeName.getName(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index 3fb0df44aa6..adc2ee8a438 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -1,7 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdbconfig.h" +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/document/config/config-documenttypes.h> using namespace config; using namespace vespa::config::search::summary; @@ -29,8 +35,7 @@ DocumentDBConfig::ComparisonResult::ComparisonResult() _tuneFileDocumentDBChanged(false), _schemaChanged(false), _maintenanceChanged(false) -{ -} +{ } DocumentDBConfig::DocumentDBConfig( int64_t generation, @@ -66,8 +71,7 @@ DocumentDBConfig::DocumentDBConfig( _maintenance(maintenance), _extraConfigs(extraConfigs), _orig() -{ -} +{ } DocumentDBConfig:: @@ -89,8 +93,9 @@ DocumentDBConfig(const DocumentDBConfig &cfg) _maintenance(cfg._maintenance), _extraConfigs(cfg._extraConfigs), _orig(cfg._orig) -{ -} +{ } + +DocumentDBConfig::~DocumentDBConfig() { } bool DocumentDBConfig::operator==(const DocumentDBConfig & rhs) const diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index 67b2a87b2f7..9515f2ec85a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -3,21 +3,31 @@ #pragma once #include "document_db_maintenance_config.h" -#include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/searchlib/common/tunefileinfo.h> -#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/config/config-ranking-constants.h> #include <vespa/searchcore/proton/matching/ranking_constants.h> -#include <vespa/config-attributes.h> -#include <vespa/config-indexschema.h> -#include <vespa/config-rank-profiles.h> -#include <vespa/config-summary.h> -#include <vespa/config-summarymap.h> #include <vespa/config/retriever/configkeyset.h> #include <vespa/config/retriever/configsnapshot.h> +namespace vespa { + namespace config { + namespace search { + namespace internal { + class InternalSummaryType; + class InternalSummarymapType; + class InternalRankProfilesType; + class InternalAttributesType; + class InternalIndexschemaType; + } + namespace summary { namespace internal { class InternalJuniperrcType; } } + } + } +} + +namespace document { namespace internal { class InternalDocumenttypesType; } } + namespace proton { class DocumentDBConfig @@ -43,14 +53,21 @@ public: }; using SP = std::shared_ptr<DocumentDBConfig>; - using IndexschemaConfigSP = std::shared_ptr<vespa::config::search::IndexschemaConfig>; - using AttributesConfigSP = std::shared_ptr<vespa::config::search::AttributesConfig>; - using RankProfilesConfigSP = std::shared_ptr<vespa::config::search::RankProfilesConfig>; + using IndexschemaConfig = const vespa::config::search::internal::InternalIndexschemaType; + using IndexschemaConfigSP = std::shared_ptr<IndexschemaConfig>; + using AttributesConfig = const vespa::config::search::internal::InternalAttributesType; + using AttributesConfigSP = std::shared_ptr<AttributesConfig>; + using RankProfilesConfig = const vespa::config::search::internal::InternalRankProfilesType; + using RankProfilesConfigSP = std::shared_ptr<RankProfilesConfig>; using RankingConstants = matching::RankingConstants; - using SummaryConfigSP = std::shared_ptr<vespa::config::search::SummaryConfig>; - using SummarymapConfigSP = std::shared_ptr<vespa::config::search::SummarymapConfig>; - using JuniperrcConfigSP = std::shared_ptr<vespa::config::search::summary::JuniperrcConfig>; - using DocumenttypesConfigSP = std::shared_ptr<document::DocumenttypesConfig>; + using SummaryConfig = const vespa::config::search::internal::InternalSummaryType; + using SummaryConfigSP = std::shared_ptr<SummaryConfig>; + using SummarymapConfig = const vespa::config::search::internal::InternalSummarymapType; + using SummarymapConfigSP = std::shared_ptr<SummarymapConfig>; + using JuniperrcConfig = const vespa::config::search::summary::internal::InternalJuniperrcType; + using JuniperrcConfigSP = std::shared_ptr<JuniperrcConfig>; + using DocumenttypesConfig = const document::internal::InternalDocumenttypesType; + using DocumenttypesConfigSP = std::shared_ptr<DocumenttypesConfig>; using MaintenanceConfigSP = DocumentDBMaintenanceConfig::SP; private: @@ -99,6 +116,7 @@ public: const config::ConfigSnapshot & extraConfig = config::ConfigSnapshot()); DocumentDBConfig(const DocumentDBConfig &cfg); + ~DocumentDBConfig(); const vespalib::string & getConfigId() const { return _configId; } void setConfigId(const vespalib::string &configId) { _configId = configId; } @@ -107,75 +125,33 @@ public: int64_t getGeneration(void) const { return _generation; } - const vespa::config::search::RankProfilesConfig & - getRankProfilesConfig() const { return *_rankProfiles; } - + const RankProfilesConfig &getRankProfilesConfig() const { return *_rankProfiles; } const RankingConstants &getRankingConstants() const { return *_rankingConstants; } - - const vespa::config::search::IndexschemaConfig & - getIndexschemaConfig() const { return *_indexschema; } - - const vespa::config::search::AttributesConfig & - getAttributesConfig() const { return *_attributes; } - - const vespa::config::search::SummaryConfig & - getSummaryConfig() const { return *_summary; } - - const vespa::config::search::SummarymapConfig & - getSummarymapConfig() const { return *_summarymap; } - - const vespa::config::search::summary::JuniperrcConfig & - getJuniperrcConfig() const { return *_juniperrc; } - - const document::DocumenttypesConfig & - getDocumenttypesConfig(void) const { return *_documenttypes; } - - const RankProfilesConfigSP & - getRankProfilesConfigSP(void) const { return _rankProfiles; } - + const IndexschemaConfig &getIndexschemaConfig() const { return *_indexschema; } + const AttributesConfig &getAttributesConfig() const { return *_attributes; } + const SummaryConfig &getSummaryConfig() const { return *_summary; } + const SummarymapConfig &getSummarymapConfig() const { return *_summarymap; } + const JuniperrcConfig &getJuniperrcConfig() const { return *_juniperrc; } + const DocumenttypesConfig &getDocumenttypesConfig() const { return *_documenttypes; } + const RankProfilesConfigSP &getRankProfilesConfigSP() const { return _rankProfiles; } const RankingConstants::SP &getRankingConstantsSP() const { return _rankingConstants; } - - const IndexschemaConfigSP & - getIndexschemaConfigSP(void) const { return _indexschema; } - - const AttributesConfigSP & - getAttributesConfigSP(void) const { return _attributes; } - - const SummaryConfigSP & - getSummaryConfigSP(void) const { return _summary; } - - const SummarymapConfigSP & - getSummarymapConfigSP(void) const { return _summarymap; } - - const JuniperrcConfigSP & - getJuniperrcConfigSP(void) const { return _juniperrc; } - - const DocumenttypesConfigSP & - getDocumenttypesConfigSP(void) const { return _documenttypes; } - - const document::DocumentTypeRepo::SP & - getDocumentTypeRepoSP() const { return _repo; } - - const document::DocumentType * - getDocumentType() const { return _repo->getDocumentType(getDocTypeName()); } - - const search::index::Schema::SP & - getSchemaSP(void) const { return _schema; } - - const MaintenanceConfigSP & - getMaintenanceConfigSP(void) const { return _maintenance; } - - const search::TuneFileDocumentDB::SP & - getTuneFileDocumentDBSP(void) const { return _tuneFileDocumentDB; } - - bool - operator==(const DocumentDBConfig &rhs) const; + const IndexschemaConfigSP &getIndexschemaConfigSP() const { return _indexschema; } + const AttributesConfigSP &getAttributesConfigSP() const { return _attributes; } + const SummaryConfigSP &getSummaryConfigSP() const { return _summary; } + const SummarymapConfigSP &getSummarymapConfigSP() const { return _summarymap; } + const JuniperrcConfigSP &getJuniperrcConfigSP() const { return _juniperrc; } + const DocumenttypesConfigSP &getDocumenttypesConfigSP() const { return _documenttypes; } + const document::DocumentTypeRepo::SP &getDocumentTypeRepoSP() const { return _repo; } + const document::DocumentType *getDocumentType() const { return _repo->getDocumentType(getDocTypeName()); } + const search::index::Schema::SP &getSchemaSP() const { return _schema; } + const MaintenanceConfigSP &getMaintenanceConfigSP() const { return _maintenance; } + const search::TuneFileDocumentDB::SP &getTuneFileDocumentDBSP() const { return _tuneFileDocumentDB; } + bool operator==(const DocumentDBConfig &rhs) const; /** * Compare this snapshot with the given one. */ - ComparisonResult - compare(const DocumentDBConfig &rhs) const; + ComparisonResult compare(const DocumentDBConfig &rhs) const; bool valid(void) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index 9a030555c50..2c9bc482e74 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -1,14 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdbconfigmanager.h" -#include <vespa/log/log.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchlib/index/schemautil.h> -LOG_SETUP(".proton.server.documentdbconfigmanager"); #include <vespa/config/helper/legacy.h> #include <vespa/config/file_acquirer/file_acquirer.h> #include <vespa/vespalib/time/time_box.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/log/log.h> + +LOG_SETUP(".proton.server.documentdbconfigmanager"); using namespace config; using namespace vespa::config::search::core; @@ -283,7 +286,14 @@ DocumentDBConfigManager(const vespalib::string &configId, _ignoreForwardedConfig(true), _pendingConfigLock(), _extraConfigKeys() -{ +{ } + +DocumentDBConfigManager::~DocumentDBConfigManager() { } + +DocumentDBConfig::SP +DocumentDBConfigManager::getConfig() const { + vespalib::LockGuard lock(_pendingConfigLock); + return _pendingConfigSnapshot; } void diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h index 525505fcfb0..58ba059de4a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h @@ -28,24 +28,21 @@ private: config::ConfigKeySet _extraConfigKeys; search::index::Schema::SP - buildNewSchema(const vespa::config::search::AttributesConfig & newAttributesConfig, - const vespa::config::search::SummaryConfig & newSummaryConfig, - const vespa::config::search::IndexschemaConfig & newIndexschemaConfig); + buildNewSchema(const DocumentDBConfig::AttributesConfig & newAttributesConfig, + const DocumentDBConfig::SummaryConfig & newSummaryConfig, + const DocumentDBConfig::IndexschemaConfig & newIndexschemaConfig); search::index::Schema::SP - buildSchema(const vespa::config::search::AttributesConfig & newAttributesConfig, - const vespa::config::search::SummaryConfig & newSummaryConfig, - const vespa::config::search::IndexschemaConfig & newIndexschemaConfig); + buildSchema(const DocumentDBConfig::AttributesConfig & newAttributesConfig, + const DocumentDBConfig::SummaryConfig & newSummaryConfig, + const DocumentDBConfig::IndexschemaConfig & newIndexschemaConfig); public: DocumentDBConfigManager(const vespalib::string &configId, const vespalib::string &docTypeName); + ~DocumentDBConfigManager(); void update(const config::ConfigSnapshot & snapshot); - DocumentDBConfig::SP - getConfig() const { - vespalib::LockGuard lock(_pendingConfigLock); - return _pendingConfigSnapshot; - } + DocumentDBConfig::SP getConfig() const; void forwardConfig(const BootstrapConfig::SP & config); const config::ConfigKeySet createConfigKeySet(void) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 4e3e32c2c4c..7c8386c40bf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -36,7 +36,7 @@ private: const uint32_t _readySubDbId; const uint32_t _remSubDbId; const uint32_t _notReadySubDbId; - typedef std::shared_ptr<std::vector<IDocumentRetriever::SP> > RetrieversSP; + typedef std::shared_ptr<std::vector<std::shared_ptr<IDocumentRetriever>> > RetrieversSP; vespalib::VarHolder<RetrieversSP> _retrievers; typedef std::vector<std::shared_ptr<IReprocessingTask>> ReprocessingTasks; ReprocessingRunner _reprocessingRunner; @@ -71,7 +71,7 @@ public: void maintenanceSync(MaintenanceController &mc, ICommitable &commit); // Internally synchronized - std::shared_ptr<std::vector<IDocumentRetriever::SP> > getRetrievers() { + RetrieversSP getRetrievers() { return _retrievers.get(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp index 2713c571dbf..24c000e5d4a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp @@ -1,13 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.fast_access_doc_subdb"); - #include "attributeadapterfactory.h" #include "emptysearchview.h" #include "fast_access_doc_subdb.h" #include "fast_access_document_retriever.h" +#include "document_subdb_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> #include <vespa/searchcore/proton/attribute/attribute_factory.h> #include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h> @@ -20,6 +17,8 @@ LOG_SETUP(".proton.server.fast_access_doc_subdb"); #include <vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h> #include <vespa/searchcore/proton/reprocessing/reprocess_documents_task.h> #include <vespa/searchlib/docstore/document_store_visitor_progress.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.fast_access_doc_subdb"); using proton::matching::SessionManager; using search::AttributeGuard; @@ -40,12 +39,9 @@ struct AttributeGuardComp AttributeGuardComp(const vespalib::string &n) : name(n) - { - } + { } - bool - operator()(const AttributeGuard &rhs) const - { + bool operator()(const AttributeGuard &rhs) const { return name == rhs->getName(); }; }; @@ -193,8 +189,7 @@ FastAccessDocSubDB::createReprocessingTask(IReprocessingInitializer &initializer docIdLimit)); } -FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, - const Context &ctx) +FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, const Context &ctx) : Parent(cfg._storeOnlyCfg, ctx._storeOnlyCtx), _hasAttributes(cfg._hasAttributes), _fastAccessAttributesOnly(cfg._fastAccessAttributesOnly), @@ -205,8 +200,9 @@ FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, _addMetrics(cfg._addMetrics), _metricsWireService(ctx._metricsWireService), _docIdLimit(0) -{ -} +{ } + +FastAccessDocSubDB::~FastAccessDocSubDB() { } DocumentSubDbInitializer::UP FastAccessDocSubDB::createInitializer(const DocumentDBConfig &configSnapshot, diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index bb0b2a9ed5b..040569a70a0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -38,8 +38,7 @@ public: _hasAttributes(hasAttributes), _addMetrics(addMetrics), _fastAccessAttributesOnly(fastAccessAttributesOnly) - { - } + { } }; struct Context @@ -56,8 +55,7 @@ public: _subAttributeMetrics(subAttributeMetrics), _totalAttributeMetrics(totalAttributeMetrics), _metricsWireService(metricsWireService) - { - } + { } }; private: @@ -71,80 +69,60 @@ private: AttributeMetrics &_subAttributeMetrics; AttributeMetrics *_totalAttributeMetrics; - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createAttributeManagerInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - initializer::InitializerTask::SP documentMetaStoreInitTask, + std::shared_ptr<initializer::InitializerTask> documentMetaStoreInitTask, DocumentMetaStore::SP documentMetaStore, std::shared_ptr<AttributeManager::SP> attrMgrResult) const; void setupAttributeManager(AttributeManager::SP attrMgrResult); - - void initFeedView(const IAttributeWriter::SP &writer, - const DocumentDBConfig &configSnapshot); - + void initFeedView(const IAttributeWriter::SP &writer, const DocumentDBConfig &configSnapshot); protected: typedef StoreOnlyDocSubDB Parent; - typedef vespa::config::search::core::ProtonConfig ProtonConfig; const bool _addMetrics; MetricsWireService &_metricsWireService; DocIdLimit _docIdLimit; - AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, - SerialNum serialNum) const; - + AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); - virtual IFlushTarget::List getFlushTargetsInternal(); - - void reconfigureAttributeMetrics(const proton::IAttributeManager &newMgr, - const proton::IAttributeManager &oldMgr); + void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); IReprocessingTask::UP createReprocessingTask(IReprocessingInitializer &initializer, const document::DocumentTypeRepo::SP &docTypeRepo) const; public: - FastAccessDocSubDB(const Config &cfg, - const Context &ctx); + FastAccessDocSubDB(const Config &cfg, const Context &ctx); - virtual ~FastAccessDocSubDB() {} + ~FastAccessDocSubDB(); - virtual DocumentSubDbInitializer::UP + virtual std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core::ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core::ProtonConfig::Index &indexCfg) const override; - - virtual void setup(const DocumentSubDbInitializerResult &initResult) override; - - virtual void initViews(const DocumentDBConfig &configSnapshot, - const proton::matching::SessionManager::SP &sessionManager); - - virtual IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, - const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, - const ReconfigParams params); - - virtual proton::IAttributeManager::SP getAttributeManager() const; - - virtual IDocumentRetriever::UP getDocumentRetriever(); - - virtual void - onReplayDone(); - - virtual void - onReprocessDone(SerialNum serialNum); - - virtual SerialNum - getOldestFlushedSerial(); - - virtual SerialNum - getNewestFlushedSerial(); + const Schema::SP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, + const ProtonConfig::Index &indexCfg) const override; + + void setup(const DocumentSubDbInitializerResult &initResult) override; + + void initViews(const DocumentDBConfig &configSnapshot, + const matching::SessionManager::SP &sessionManager) override; + + IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, + const DocumentDBConfig &oldConfigSnapshot, + SerialNum serialNum, + const ReconfigParams params) override; + + proton::IAttributeManager::SP getAttributeManager() const override; + IDocumentRetriever::UP getDocumentRetriever() override; + void onReplayDone() override; + void onReprocessDone(SerialNum serialNum) override; + SerialNum getOldestFlushedSerial() override; + SerialNum getNewestFlushedSerial() override; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 4813519c3fe..3e0619cee48 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -1,18 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "fileconfigmanager.h" #include <vespa/config/print/fileconfigwriter.h> #include <vespa/config/print/fileconfigsnapshotreader.h> #include <vespa/config/print/fileconfigsnapshotwriter.h> -#include <vespa/config/print/configformatter.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/log/log.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchlib/index/schemautil.h> #include <vespa/vespalib/io/fileutil.h> -#include <utime.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/searchsummary/config/config-juniperrc.h> #include <fstream> +#include <vespa/log/log.h> LOG_SETUP(".proton.server.fileconfigmanager"); using document::DocumentTypeRepo; diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index da49aa2a725..5838a66040e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -1,41 +1,45 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "document_subdb_initializer.h" -#include "ifeedview.h" -#include "searchable_doc_subdb_configurer.h" #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/attribute/i_attribute_manager.h> -#include <vespa/searchcore/proton/docsummary/isummarymanager.h> -#include <vespa/searchcore/proton/docsummary/summarymanager.h> #include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> -#include <vespa/searchcore/proton/index/i_index_writer.h> -#include <vespa/searchcore/proton/matchengine/imatchhandler.h> #include <vespa/searchcore/proton/matching/matching_stats.h> -#include <vespa/searchcore/proton/matching/sessionmanager.h> -#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcore/proton/summaryengine/isearchhandler.h> #include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchcorespi/index/iindexmanager.h> -#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchlib/util/searchable_stats.h> -namespace document -{ - -class DocumentId; +namespace search { + namespace index { + class Schema; + } } +namespace document { class DocumentId; } -namespace proton -{ +namespace searchcorespi { + class IIndexManagerFactory; + class IIndexManager; +} +namespace proton { + namespace matching { class SessionManager; } class FeedHandler; class DocumentDBConfig; class FileConfigManager; class IReplayConfig; +class IIndexWriter; +class IDcoumentRetriever; +class DocumentSubDbInitializer; +class DocumentSubDbInitializerResult; +class ReconfigParams; +class IFeedView; +class ISearchHandler; +class ISummaryManager; +class ISummaryAdapter; +class IDocumentMetaStoreContext; +class IDocumentRetriever; +class IAttributeManager; /** * Interface for a document sub database that handles a subset of the documents that belong to a @@ -53,128 +57,73 @@ public: public: virtual ~IOwner() {} virtual void syncFeedView() = 0; - virtual searchcorespi::IIndexManagerFactory::SP + virtual std::shared_ptr<searchcorespi::IIndexManagerFactory> getIndexManagerFactory(const vespalib::stringref &name) const = 0; virtual vespalib::string getName() const = 0; virtual uint32_t getDistributionKey() const = 0; }; - typedef std::unique_ptr<IDocumentSubDB> UP; - typedef search::SerialNum SerialNum; - + using UP = std::unique_ptr<IDocumentSubDB>; + using SerialNum = search::SerialNum; + using Schema = search::index::Schema; + using SchemaSP = std::shared_ptr<Schema>; + using ProtonConfig = vespa::config::search::core::ProtonConfig; + using IFlushTarget = searchcorespi::IFlushTarget; public: IDocumentSubDB() { } - virtual ~IDocumentSubDB() { } - virtual uint32_t getSubDbId() const = 0; - virtual vespalib::string getName() const = 0; - virtual DocumentSubDbInitializer::UP - createInitializer(const DocumentDBConfig &configSnapshot, - SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core:: - ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core:: - ProtonConfig::Index &indexCfg) const = 0; + virtual std::unique_ptr<DocumentSubDbInitializer> + createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const SchemaSP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, const ProtonConfig::Index &indexCfg) const = 0; // Called by master thread virtual void setup(const DocumentSubDbInitializerResult &initResult) = 0; - - virtual void - initViews(const DocumentDBConfig &configSnapshot, - const proton::matching::SessionManager::SP &sessionManager) = 0; + virtual void initViews(const DocumentDBConfig &configSnapshot, const std::shared_ptr<matching::SessionManager> &sessionManager) = 0; virtual IReprocessingTask::List - applyConfig(const DocumentDBConfig &newConfigSnapshot, - const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, - const ReconfigParams params) = 0; - - virtual ISearchHandler::SP - getSearchView(void) const = 0; - - virtual IFeedView::SP - getFeedView(void) const = 0; - - virtual void - clearViews(void) = 0; - - virtual const ISummaryManager::SP & - getSummaryManager() const = 0; - - virtual proton::IAttributeManager::SP - getAttributeManager(void) const = 0; - - virtual const IIndexManager::SP & - getIndexManager(void) const = 0; - - virtual const ISummaryAdapter::SP & - getSummaryAdapter(void) const = 0; - - virtual const IIndexWriter::SP & - getIndexWriter(void) const = 0; - - virtual IDocumentMetaStoreContext & - getDocumentMetaStoreContext() = 0; - - virtual IFlushTarget::List - getFlushTargets(void) = 0; - - virtual size_t - getNumDocs(void) const = 0; - - virtual size_t - getNumActiveDocs(void) const = 0; - + applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, + SerialNum serialNum, const ReconfigParams params) = 0; + + virtual std::shared_ptr<ISearchHandler> getSearchView() const = 0; + virtual std::shared_ptr<IFeedView> getFeedView() const = 0; + virtual void clearViews() = 0; + virtual const std::shared_ptr<ISummaryManager> &getSummaryManager() const = 0; + virtual std::shared_ptr<IAttributeManager> getAttributeManager() const = 0; + virtual const std::shared_ptr<searchcorespi::IIndexManager> &getIndexManager() const = 0; + virtual const std::shared_ptr<ISummaryAdapter> &getSummaryAdapter() const = 0; + virtual const std::shared_ptr<IIndexWriter> &getIndexWriter() const = 0; + virtual IDocumentMetaStoreContext &getDocumentMetaStoreContext() = 0; + virtual IFlushTarget::List getFlushTargets() = 0; + virtual size_t getNumDocs() const = 0; + virtual size_t getNumActiveDocs() const = 0; /** * Needed by FeedRouter::handleRemove(). * TODO: remove together with FeedEngine. **/ - virtual bool - hasDocument(const document::DocumentId &id) = 0; - - virtual void - onReplayDone(void) = 0; - - virtual void - onReprocessDone(SerialNum serialNum) = 0; + virtual bool hasDocument(const document::DocumentId &id) = 0; + virtual void onReplayDone() = 0; + virtual void onReprocessDone(SerialNum serialNum) = 0; /* * Get oldest flushed serial for components. */ - virtual SerialNum - getOldestFlushedSerial(void) = 0; + virtual SerialNum getOldestFlushedSerial() = 0; /* * Get newest flushed serial. Used to validate that we've not lost * last part of transaction log. */ - virtual SerialNum - getNewestFlushedSerial() = 0; - - virtual void - wipeHistory(SerialNum wipeSerial, - const search::index::Schema &newHistorySchema, - const search::index::Schema &wipeSchema) = 0; - - virtual void - setIndexSchema(const search::index::Schema::SP &schema, - const search::index::Schema::SP &fusionSchema) = 0; - - virtual search::SearchableStats - getSearchableStats(void) const = 0; - - virtual IDocumentRetriever::UP - getDocumentRetriever(void) = 0; - - virtual matching::MatchingStats - getMatcherStats(const vespalib::string &rankProfile) const = 0; + virtual SerialNum getNewestFlushedSerial() = 0; + virtual void wipeHistory(SerialNum wipeSerial, const Schema &newHistorySchema, const Schema &wipeSchema) = 0; + virtual void setIndexSchema(const SchemaSP &schema, const SchemaSP &fusionSchema) = 0; + virtual search::SearchableStats getSearchableStats() const = 0; + virtual std::unique_ptr<IDocumentRetriever> getDocumentRetriever() = 0; + virtual matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const = 0; virtual void close() = 0; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp index 09cd3770919..44e3bdcee29 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.lid_space_compaction_handler"); - #include "lid_space_compaction_handler.h" #include "document_scan_iterator.h" +#include "ifeedview.h" +#include <vespa/searchcore/proton/docsummary/isummarymanager.h> +#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h> using document::BucketId; using document::Document; @@ -40,8 +39,7 @@ LidSpaceCompactionHandler::createMoveOperation(const search::DocumentMetaData &d IFeedView::SP feedView = _subDb.getFeedView(); const ISummaryManager::SP &summaryMan = _subDb.getSummaryManager(); const uint32_t moveFromLid = document.lid; - Document::UP doc = summaryMan->getBackingStore().read(moveFromLid, - *feedView->getDocumentTypeRepo()); + Document::UP doc = summaryMan->getBackingStore().read(moveFromLid, *feedView->getDocumentTypeRepo()); MoveOperation::UP op(new MoveOperation(document.bucketId, document.timestamp, Document::SP(doc.release()), DbDocumentId(_subDb.getSubDbId(), moveFromLid), diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 6d664e675aa..1fe64739d2d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -1,19 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.searchabledocsubdb"); - #include "searchabledocsubdb.h" #include "fast_access_document_retriever.h" +#include "document_subdb_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/flushengine/threadedflushtarget.h> #include <vespa/searchcore/proton/index/index_manager_initializer.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h> -#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> -#include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/tensor/default_tensor_engine.h> @@ -36,13 +31,10 @@ using vespalib::IllegalStateException; using vespalib::ThreadStackExecutorBase; using namespace searchcorespi; - namespace proton { -SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, - const Context &ctx) - : FastAccessDocSubDB(cfg._fastUpdCfg, - ctx._fastUpdCtx), +SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, const Context &ctx) + : FastAccessDocSubDB(cfg._fastUpdCfg, ctx._fastUpdCtx), IIndexManager::Reconfigurer(), _indexMgr(), _indexWriter(), @@ -55,8 +47,7 @@ SearchableDocSubDB::SearchableDocSubDB(const Config &cfg, getSubDbName(), ctx._fastUpdCtx._storeOnlyCtx._owner.getDistributionKey()), _numSearcherThreads(cfg._numSearcherThreads), _warmupExecutor(ctx._warmupExecutor) -{ -} +{ } SearchableDocSubDB::~SearchableDocSubDB() { diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index ac7ba612120..f3b5854395b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -48,12 +48,10 @@ public: const FastAccessDocSubDB::Config _fastUpdCfg; const size_t _numSearcherThreads; - Config(const FastAccessDocSubDB::Config &fastUpdCfg, - size_t numSearcherThreads) + Config(const FastAccessDocSubDB::Config &fastUpdCfg, size_t numSearcherThreads) : _fastUpdCfg(fastUpdCfg), _numSearcherThreads(numSearcherThreads) - { - } + { } }; struct Context { @@ -70,8 +68,7 @@ public: _queryLimiter(queryLimiter), _clock(clock), _warmupExecutor(warmupExecutor) - { - } + { } }; private: @@ -89,49 +86,34 @@ private: vespalib::ThreadExecutor &_warmupExecutor; // Note: lifetime of indexManager must be handled by caller. - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createIndexManagerInitializer(const DocumentDBConfig &configSnapshot, const search::index::Schema::SP &unionSchema, const vespa::config::search::core::ProtonConfig::Index &indexCfg, std::shared_ptr<searchcorespi::IIndexManager::SP> indexManager) const; void setupIndexManager(searchcorespi::IIndexManager::SP indexManager); - - void - initFeedView(const IAttributeWriter::SP &attrWriter, - const DocumentDBConfig &configSnapshot); - - void - reconfigureMatchingMetrics(const vespa::config::search::RankProfilesConfig &config); + void initFeedView(const IAttributeWriter::SP &attrWriter, const DocumentDBConfig &configSnapshot); + void reconfigureMatchingMetrics(const vespa::config::search::RankProfilesConfig &config); /** * Implements IndexManagerReconfigurer API. */ - virtual bool - reconfigure(vespalib::Closure0<bool>::UP closure); - - void - reconfigureIndexSearchable(); - - void - syncViews(); - + bool reconfigure(vespalib::Closure0<bool>::UP closure) override; + void reconfigureIndexSearchable(); + void syncViews(); protected: - virtual IFlushTarget::List - getFlushTargetsInternal(); + IFlushTarget::List getFlushTargetsInternal(); using Parent::updateLidReuseDelayer; - virtual void - updateLidReuseDelayer(const LidReuseDelayerConfig &config) override; + void updateLidReuseDelayer(const LidReuseDelayerConfig &config) override; public: - SearchableDocSubDB(const Config &cfg, - const Context &ctx); + SearchableDocSubDB(const Config &cfg, const Context &ctx); - virtual ~SearchableDocSubDB(); - virtual DocumentSubDbInitializer::UP + std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const search::index::Schema::SP &unionSchema, diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index c6d827359e5..c89db63024c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -1,15 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.storeonlydocsubdb"); - #include "emptysearchview.h" #include "docstorevalidator.h" #include "document_subdb_initializer_result.h" #include "minimal_document_retriever.h" #include "storeonlydocsubdb.h" -#include <vespa/searchcore/proton/common/eventlogger.h> +#include "document_subdb_initializer.h" +#include "reconfig_params.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandlerinitializer.h> #include <vespa/searchcore/proton/docsummary/summarymanagerinitializer.h> @@ -19,14 +16,13 @@ LOG_SETUP(".proton.server.storeonlydocsubdb"); #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> -#include <vespa/searchcorespi/index/iindexmanager.h> #include <vespa/searchlib/attribute/configconverter.h> -#include <vespa/searchlib/common/lambdatask.h> #include <vespa/searchlib/docstore/document_store_visitor_progress.h> #include <vespa/searchlib/util/fileheadertk.h> -#include <vespa/vespalib/data/fileheader.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.storeonlydocsubdb"); using vespa::config::search::AttributesConfig; using vespa::config::search::core::ProtonConfig; @@ -50,19 +46,16 @@ using proton::documentmetastore::LidReuseDelayer; using fastos::TimeStamp; using proton::initializer::InitializerTask; -namespace proton -{ +namespace proton { -namespace -{ +namespace { IIndexManager::SP nullIndexManager; IIndexWriter::SP nullIndexWriter; } -StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, - const Context &ctx) +StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx) : DocSubDB(ctx._owner, ctx._tlSyncer), _docTypeName(cfg._docTypeName), _subName(cfg._subName), @@ -361,6 +354,10 @@ StoreOnlyDocSubDB::initFeedView(const DocumentDBConfig &configSnapshot) _iFeedView.set(StoreOnlyFeedView::SP(feedView.release())); } +vespalib::string +StoreOnlyDocSubDB::getSubDbName() const { + return vespalib::make_string("%s.%s", _owner.getName().c_str(), _subName.c_str()); +} void StoreOnlyDocSubDB::updateLidReuseDelayer(const DocumentDBConfig * diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 49e8a03c8ec..00dcb10941c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -3,12 +3,9 @@ #include "documentdbconfig.h" #include "idocumentsubdb.h" -#include "ifeedview.h" +#include "storeonlyfeedview.h" #include "summaryadapter.h" #include "tlssyncer.h" -#include <memory> -#include <vector> -#include <vespa/searchcore/config/config-proton.h> #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/subdbtype.h> @@ -19,24 +16,19 @@ #include <vespa/searchcore/proton/matchengine/imatchhandler.h> #include <vespa/searchcore/proton/summaryengine/isearchhandler.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> +#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchlib/common/fileheadercontext.h> #include <vespa/vespalib/util/varholder.h> - -namespace proton -{ +namespace proton { class MetricsWireService; class LegacyDocumentDBMetrics; class FeedHandler; +class DocumentMetaStoreInitializerResult; +namespace initializer { class InitializerTask; } -namespace bucketdb -{ - -class IBucketDBHandlerInitializer; - -} - +namespace bucketdb { class IBucketDBHandlerInitializer; } namespace documentmetastore { class LidReuseDelayerConfig; } /** @@ -59,7 +51,6 @@ public: void close() override { } }; - class StoreOnlyDocSubDB; /** @@ -77,10 +68,9 @@ class StoreOnlySubDBFileHeaderContext : public search::common::FileHeaderContext public: StoreOnlySubDBFileHeaderContext(StoreOnlyDocSubDB &owner, - const search::common::FileHeaderContext & - parentFileHeaderContext, - const DocTypeName &docTypeName, - const vespalib::string &baseDir) + const search::common::FileHeaderContext & parentFileHeaderContext, + const DocTypeName &docTypeName, + const vespalib::string &baseDir) : search::common::FileHeaderContext(), _owner(owner), _parentFileHeaderContext(parentFileHeaderContext), @@ -94,9 +84,7 @@ public: _subDB = baseDir; } - virtual void - addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const; + void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; }; /** @@ -132,8 +120,7 @@ public: _attributeGrowNumDocs(attributeGrowNumDocs), _subDbId(subDbId), _subDbType(subDbType) - { - } + { } }; struct Context { @@ -172,8 +159,7 @@ public: _metrics(metrics), _configLock(configLock), _hwInfo(hwInfo) - { - } + { } }; @@ -208,104 +194,65 @@ private: TlsSyncer _tlsSyncer; DocumentMetaStoreFlushTarget::SP _dmsFlushTarget; - virtual IFlushTarget::List - getFlushTargets(); + IFlushTarget::List getFlushTargets() override; protected: - const uint32_t _subDbId; - const SubDbType _subDbType; + const uint32_t _subDbId; + const SubDbType _subDbType; StoreOnlySubDBFileHeaderContext _fileHeaderContext; std::unique_ptr<documentmetastore::ILidReuseDelayer> _lidReuseDelayer; CommitTimeTracker _commitTimeTracker; - initializer::InitializerTask::SP - createSummaryManagerInitializer(const vespa::config::search::core:: - ProtonConfig::Summary protonSummaryCfg, + std::shared_ptr<initializer::InitializerTask> + createSummaryManagerInitializer(const ProtonConfig::Summary protonSummaryCfg, const search::TuneFileSummary &tuneFile, search::IBucketizer::SP bucketizer, - std::shared_ptr<SummaryManager::SP> result) - const; + std::shared_ptr<SummaryManager::SP> result) const; - void - setupSummaryManager(SummaryManager::SP summaryManager); + void setupSummaryManager(SummaryManager::SP summaryManager); - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createDocumentMetaStoreInitializer(const search::TuneFileAttributes &tuneFile, - std::shared_ptr<DocumentMetaStoreInitializerResult::SP> result) const; - - void - setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP dmsResult); - - void - initFeedView(const DocumentDBConfig &configSnapshot); - - virtual IFlushTarget::List - getFlushTargetsInternal(); + std::shared_ptr<std::shared_ptr<DocumentMetaStoreInitializerResult>> result) const; + void setupDocumentMetaStore(std::shared_ptr<DocumentMetaStoreInitializerResult> dmsResult); + void initFeedView(const DocumentDBConfig &configSnapshot); + virtual IFlushTarget::List getFlushTargetsInternal(); StoreOnlyFeedView::Context getStoreOnlyFeedViewContext(const DocumentDBConfig &configSnapshot); - StoreOnlyFeedView::PersistentParams getFeedViewPersistentParams(); - - vespalib::string getSubDbName() const { - return vespalib::make_string("%s.%s", - _owner.getName().c_str(), _subName.c_str()); - } - - void - updateLidReuseDelayer(const DocumentDBConfig *newConfigSnapshot); + vespalib::string getSubDbName() const; + void updateLidReuseDelayer(const DocumentDBConfig *newConfigSnapshot); using LidReuseDelayerConfig = documentmetastore::LidReuseDelayerConfig; - virtual void - updateLidReuseDelayer(const LidReuseDelayerConfig &config); + virtual void updateLidReuseDelayer(const LidReuseDelayerConfig &config); public: - StoreOnlyDocSubDB(const Config &cfg, - const Context &ctx); - - virtual + StoreOnlyDocSubDB(const Config &cfg, const Context &ctx); ~StoreOnlyDocSubDB(); - virtual uint32_t getSubDbId() const { return _subDbId; } + uint32_t getSubDbId() const override { return _subDbId; } + vespalib::string getName() const override { return _subName; } - virtual vespalib::string getName() const { return _subName; } - - virtual DocumentSubDbInitializer::UP + std::unique_ptr<DocumentSubDbInitializer> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, - const search::index::Schema::SP &unionSchema, - const vespa::config::search::core:: - ProtonConfig::Summary &protonSummaryCfg, - const vespa::config::search::core:: - ProtonConfig::Index &indexCfg) const override; - - virtual void setup(const DocumentSubDbInitializerResult &initResult) - override; + const Schema::SP &unionSchema, + const ProtonConfig::Summary &protonSummaryCfg, + const ProtonConfig::Index &indexCfg) const override; - virtual void - initViews(const DocumentDBConfig &configSnapshot, - const matching::SessionManager::SP &sessionManager); + void setup(const DocumentSubDbInitializerResult &initResult) override; + void initViews(const DocumentDBConfig &configSnapshot, const std::shared_ptr<matching::SessionManager> &sessionManager) override; - virtual IReprocessingTask::List + IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, SerialNum serialNum, - const ReconfigParams params); - - virtual ISearchHandler::SP - getSearchView() const - { - return _iSearchView.get(); - } + const ReconfigParams params) override; - virtual IFeedView::SP - getFeedView() const - { - return _iFeedView.get(); - } + ISearchHandler::SP getSearchView() const override { return _iSearchView.get(); } + IFeedView::SP getFeedView() const override { return _iFeedView.get(); } - virtual void - clearViews() - { + void clearViews() override { _iFeedView.clear(); _iSearchView.clear(); } @@ -316,74 +263,26 @@ public: * * @return The summary manager. */ - virtual const ISummaryManager::SP & - getSummaryManager() const - { - return _iSummaryMgr; - } - - virtual proton::IAttributeManager::SP - getAttributeManager() const; - - virtual const IIndexManager::SP & - getIndexManager() const; - - virtual const ISummaryAdapter::SP & - getSummaryAdapter() const - { - return _summaryAdapter; - } - - virtual const IIndexWriter::SP & - getIndexWriter() const; - - virtual IDocumentMetaStoreContext & - getDocumentMetaStoreContext() - { - return *_metaStoreCtx; - } - - virtual size_t - getNumDocs() const; - - virtual size_t - getNumActiveDocs() const override; - - virtual bool - hasDocument(const document::DocumentId &id); - - virtual void - onReplayDone(); - - virtual void - onReprocessDone(SerialNum serialNum); - - virtual SerialNum - getOldestFlushedSerial(); - - virtual SerialNum - getNewestFlushedSerial(); - - virtual void - wipeHistory(SerialNum wipeSerial, - const search::index::Schema &newHistorySchema, - const search::index::Schema &wipeSchema); - - virtual void - setIndexSchema(const search::index::Schema::SP &schema, - const search::index::Schema::SP &fusionSchema); - - virtual search::SearchableStats - getSearchableStats() const; - - virtual IDocumentRetriever::UP - getDocumentRetriever(); - - virtual matching::MatchingStats - getMatcherStats(const vespalib::string &rankProfile) const; - + const ISummaryManager::SP &getSummaryManager() const override { return _iSummaryMgr; } + IAttributeManager::SP getAttributeManager() const override; + const std::shared_ptr<searchcorespi::IIndexManager> & getIndexManager() const override; + const ISummaryAdapter::SP & getSummaryAdapter() const override { return _summaryAdapter; } + const std::shared_ptr<IIndexWriter> & getIndexWriter() const override; + IDocumentMetaStoreContext & getDocumentMetaStoreContext() override { return *_metaStoreCtx; } + size_t getNumDocs() const override; + size_t getNumActiveDocs() const override; + bool hasDocument(const document::DocumentId &id) override; + void onReplayDone() override; + void onReprocessDone(SerialNum serialNum) override; + SerialNum getOldestFlushedSerial() override; + SerialNum getNewestFlushedSerial() override; + + void wipeHistory(SerialNum wipeSerial, const Schema &newHistorySchema, const Schema &wipeSchema) override; + void setIndexSchema(const Schema::SP &schema, const Schema::SP &fusionSchema) override; + search::SearchableStats getSearchableStats() const override; + IDocumentRetriever::UP getDocumentRetriever() override; + matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; void close() override; }; -} // namespace proton - +} // namespace proton
\ No newline at end of file diff --git a/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h b/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h index 1010755b493..31dbd4ca383 100644 --- a/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h +++ b/searchcore/src/vespa/searchcore/proton/server/tlssyncer.h @@ -24,13 +24,13 @@ class TlsSyncer : public ITlsSyncer const IGetSerialNum &_getSerialNum; search::transactionlog::SyncProxy &_proxy; public: - virtual ~TlsSyncer(void) = default; + virtual ~TlsSyncer() = default; TlsSyncer(vespalib::ThreadExecutor &executor, const IGetSerialNum &getSerialNum, search::transactionlog::SyncProxy &proxy); - virtual void sync() override; + void sync() override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp index 4ec0ae006ea..5deb59aad6f 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp @@ -1,7 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "documentdb_config_builder.h" +#include <vespa/config-summary.h> +#include <vespa/config-summarymap.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/searchsummary/config/config-juniperrc.h> +#include <vespa/document/config/config-documenttypes.h> using document::DocumenttypesConfig; using search::TuneFileDocumentDB; @@ -36,8 +42,7 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, _configId(configId), _docTypeName(docTypeName), _extraConfig() -{ -} +{ } DocumentDBConfig::SP DocumentDBConfigBuilder::build() 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 454e0dc01fb..d1f84031417 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 @@ -3,6 +3,19 @@ #include <vespa/searchcore/proton/server/idocumentsubdb.h> #include <vespa/searchcore/proton/server/executorthreadingservice.h> +#include <vespa/searchcore/proton/docsummary/isummarymanager.h> +#include <vespa/searchcorespi/index/iindexmanager.h> +#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/server/document_subdb_initializer.h> +#include <vespa/searchcore/proton/server/isummaryadapter.h> +#include <vespa/searchcore/proton/index/i_index_writer.h> +#include <vespa/searchcore/proton/server/ifeedview.h> +#include <vespa/searchcore/proton/matching/sessionmanager.h> +#include <vespa/searchcore/proton/summaryengine/isearchhandler.h> +#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> +#include <vespa/searchcore/proton/server/reconfig_params.h> + + namespace proton { @@ -10,6 +23,7 @@ namespace test { struct DummyDocumentSubDb : public IDocumentSubDB { + using IIndexManager = searchcorespi::IIndexManager; uint32_t _subDbId; DocumentMetaStoreContext _metaStoreCtx; ISummaryManager::SP _summaryManager; @@ -18,8 +32,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB IIndexWriter::SP _indexWriter; std::unique_ptr<ExecutorThreadingService> _writeService; - DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, - uint32_t subDbId) + DummyDocumentSubDb(std::shared_ptr<BucketDBOwner> bucketDB, uint32_t subDbId) : _subDbId(subDbId), _metaStoreCtx(bucketDB), _summaryManager(), diff --git a/searchcorespi/src/vespa/searchcorespi/flush/flushtask.h b/searchcorespi/src/vespa/searchcorespi/flush/flushtask.h index cfcd6fd914d..86ce3ea8768 100644 --- a/searchcorespi/src/vespa/searchcorespi/flush/flushtask.h +++ b/searchcorespi/src/vespa/searchcorespi/flush/flushtask.h @@ -2,7 +2,6 @@ #pragma once #include <vespa/vespalib/util/executor.h> -#include <vespa/vespalib/util/closure.h> #include <vespa/searchlib/common/serialnum.h> namespace searchcorespi { @@ -12,8 +11,7 @@ class FlushTask : public vespalib::Executor::Task public: typedef std::unique_ptr<FlushTask> UP; - virtual search::SerialNum - getFlushSerial() const = 0; + virtual search::SerialNum getFlushSerial() const = 0; }; } // namespace searchcorespi diff --git a/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h b/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h index 724ffe5e2bd..313f7a5b0db 100644 --- a/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h +++ b/searchcorespi/src/vespa/searchcorespi/flush/iflushtarget.h @@ -2,9 +2,6 @@ #pragma once #include "flushstats.h" -#include <string> -#include <vespa/searchlib/common/serialnum.h> -#include <vespa/vespalib/util/executor.h> #include "flushtask.h" namespace searchcorespi { @@ -79,8 +76,7 @@ public: : _name(name), _type(Type::OTHER), _component(Component::OTHER) - { - } + { } /** * Constructs a new instance of this class. @@ -95,8 +91,7 @@ public: : _name(name), _type(type), _component(component) - { - } + { } /** * Virtual destructor required for inheritance. diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index 39e3d116d44..c7e0a304db6 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "iindexmanager.h" #include "activediskindexes.h" #include "fusionspec.h" #include "idiskindex.h" @@ -11,9 +12,8 @@ #include "imemoryindex.h" #include "warmupindexcollection.h" #include "ithreadingservice.h" -#include <vespa/searchcorespi/index/iindexmanager.h> -#include <vespa/searchcorespi/index/indexsearchable.h> -#include <vespa/searchcorespi/index/indexcollection.h> +#include "indexsearchable.h" +#include "indexcollection.h" #include <vespa/searchcorespi/flush/iflushtarget.h> #include <vespa/searchcorespi/flush/flushstats.h> #include <vespa/searchlib/attribute/fixedsourceselector.h> |