diff options
14 files changed, 94 insertions, 48 deletions
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 5110d92ce6a..e6a49455c41 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 @@ -18,6 +18,7 @@ #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> #include <vespa/searchcore/proton/server/minimal_document_retriever.h> #include <vespa/searchcore/proton/server/searchabledocsubdb.h> +#include <vespa/searchcore/proton/server/i_document_subdb_owner.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchcore/proton/test/thread_utils.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> @@ -68,7 +69,7 @@ struct ConfigDir3 { static vespalib::string dir() { return TEST_PATH("cfg3"); } struct ConfigDir4 { static vespalib::string dir() { return TEST_PATH("cfg4") ; } }; -struct MySubDBOwner : public IDocumentSubDB::IOwner +struct MySubDBOwner : public IDocumentSubDBOwner { uint32_t _syncCnt; MySubDBOwner() : _syncCnt(0) {} diff --git a/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp b/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp index 680dadda5dd..24ff8fd4272 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp @@ -2,6 +2,7 @@ #include "document_meta_store_read_guards.h" #include "documentsubdbcollection.h" +#include "idocumentsubdb.h" namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index d64a57f78e3..1dbcaa0ad4b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -98,7 +98,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, : IDocumentDBConfigOwner(), IReplayConfig(), FeedHandler::IOwner(), - IDocumentSubDB::IOwner(), + IDocumentSubDBOwner(), IClusterStateChangedHandler(), IWipeOldRemovedFieldsHandler(), search::transactionlog::SyncProxy(), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 3b6c335f1e6..67be2c055ca 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -19,6 +19,7 @@ #include "searchabledocsubdb.h" #include "summaryadapter.h" #include "visibilityhandler.h" +#include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attributemanager.h> #include <vespa/searchcore/proton/attribute/i_attribute_writer.h> @@ -72,7 +73,7 @@ namespace configvalidator { class Result; } class DocumentDB : public IDocumentDBConfigOwner, public IReplayConfig, public FeedHandler::IOwner, - public IDocumentSubDB::IOwner, + public IDocumentSubDBOwner, public IClusterStateChangedHandler, public IWipeOldRemovedFieldsHandler, public search::transactionlog::SyncProxy @@ -458,7 +459,7 @@ public: int64_t getActiveGeneration() const; - // Implements IDocSubDB::IOwner + // Implements IDocumentSubDBOwner void syncFeedView() override; std::shared_ptr<searchcorespi::IIndexManagerFactory> diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 5dd4520e2b0..d96bcbabcb2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -17,7 +17,7 @@ using vespa::config::search::core::ProtonConfig; namespace proton { DocumentSubDBCollection::DocumentSubDBCollection( - IDocumentSubDB::IOwner &owner, + IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const DocTypeName &docTypeName, diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 025bf50257a..3a1b883fb25 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -1,22 +1,30 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "ibucketstatecalculator.h" -#include "idocumentsubdb.h" -#include "ifeedview.h" -#include "searchable_doc_subdb_configurer.h" +#include <vespa/vespalib/util/varholder.h> #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/matching/sessionmanager.h> -#include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/searchlib/common/serialnum.h> -#include <vespa/searchlib/transactionlog/syncproxy.h> #include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> -#include <vespa/searchcore/proton/initializer/initializer_task.h> #include <mutex> +namespace vespalib +{ +class Clock; +class ThreadExecutor; +class ThreadStackExecutorBase; +} + +namespace search { +namespace common { class FileHeaderContext; } +namespace transactionlog { class SyncProxy; } +} + +namespace searchcorespi { +class IFlushTarget; +namespace index { class IThreadingService; } +} + namespace proton { class DocumentDBConfig; class DocumentDBMetricsCollection; @@ -25,6 +33,22 @@ class MetricsWireService; class ICommitable; class IDocumentDBReferenceResolver; class IGetSerialNum; +class DocTypeName; +class HwInfo; +class IFeedView; +struct IBucketStateCalculator; +class IDocumentSubDBOwner; +class IDocumentSubDB; +class IDocumentRetriever; +class IRreprocessingTask; +class ReconfigParams; + +namespace matching { +class QueryLimiter; +class SessionManager; +} + +namespace initializer { class InitializerTask; } class DocumentSubDBCollection { public: @@ -33,8 +57,12 @@ public: typedef search::SerialNum SerialNum; private: + using IFeedViewSP = std::shared_ptr<IFeedView>; + using IBucketStateCalculatorSP = std::shared_ptr<IBucketStateCalculator>; + using SessionManagerSP = std::shared_ptr<matching::SessionManager>; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; SubDBVector _subDBs; - IBucketStateCalculator::SP _calc; + IBucketStateCalculatorSP _calc; const uint32_t _readySubDbId; const uint32_t _remSubDbId; const uint32_t _notReadySubDbId; @@ -47,7 +75,7 @@ private: public: DocumentSubDBCollection( - IDocumentSubDB::IOwner &owner, + IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const DocTypeName &docTypeName, @@ -65,7 +93,7 @@ public: const HwInfo &hwInfo); ~DocumentSubDBCollection(); - void setBucketStateCalculator(const IBucketStateCalculator::SP &calc) { + void setBucketStateCalculator(const IBucketStateCalculatorSP &calc) { _calc = calc; } @@ -93,7 +121,7 @@ public: return *_bucketDBHandler; } - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const vespa::config::search::core::ProtonConfig::Summary &protonSummaryCfg, @@ -101,7 +129,7 @@ public: void initViews(const DocumentDBConfig &configSnapshot, - const matching::SessionManager::SP &sessionManager); + const SessionManagerSP &sessionManager); void clearViews(void); void onReplayDone(void); @@ -119,8 +147,8 @@ public: const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver); - IFeedView::SP getFeedView(); - searchcorespi::IFlushTarget::List getFlushTargets(); + IFeedViewSP getFeedView(); + IFlushTargetList getFlushTargets(); ReprocessingRunner &getReprocessingRunner() { return _reprocessingRunner; } double getReprocessingProgress() const; void close(); 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 dae33b536da..0337673b9da 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 @@ -6,6 +6,7 @@ #include "fast_access_document_retriever.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.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> 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 dad703c174b..02d321f2eea 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 @@ -89,7 +89,7 @@ protected: AttributeCollectionSpec::UP createAttributeSpec(const AttributeSpecs &attrCfg, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); - virtual IFlushTarget::List getFlushTargetsInternal(); + virtual IFlushTargetList getFlushTargetsInternal(); void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); IReprocessingTask::UP diff --git a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h new file mode 100644 index 00000000000..44e00eb77ee --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h @@ -0,0 +1,22 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include <vespa/vespalib/stllike/string.h> +#include <memory> + +namespace searchcorespi { class IIndexManagerFactory; } + +namespace proton { + +class IDocumentSubDBOwner +{ +public: + virtual ~IDocumentSubDBOwner() {} + virtual void syncFeedView() = 0; + 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; +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index 72fad6f621c..7d3be44a7ee 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> #include <vespa/searchcore/proton/matching/matching_stats.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcorespi/flush/iflushtarget.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchlib/util/searchable_stats.h> @@ -15,11 +13,13 @@ namespace search { class Schema; } } + namespace document { class DocumentId; } namespace searchcorespi { - class IIndexManagerFactory; - class IIndexManager; +class IFlushTarget; +class IIndexManagerFactory; +class IIndexManager; } namespace proton { namespace matching { class SessionManager; } @@ -54,23 +54,12 @@ class ReconfigParams; class IDocumentSubDB { public: - class IOwner - { - public: - virtual ~IOwner() {} - virtual void syncFeedView() = 0; - 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; - }; - 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; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; public: IDocumentSubDB() { } virtual ~IDocumentSubDB() { } @@ -101,7 +90,7 @@ public: 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 IFlushTargetList getFlushTargets() = 0; virtual size_t getNumDocs() const = 0; virtual size_t getNumActiveDocs() const = 0; /** diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index c893118e6f4..aedd0678ae0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -4,6 +4,7 @@ #include "fast_access_document_retriever.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.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> diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index d6f0cd179dc..d69e0cbcd8e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -7,6 +7,7 @@ #include "storeonlydocsubdb.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandlerinitializer.h> #include <vespa/searchcore/proton/docsummary/summarymanagerinitializer.h> @@ -75,7 +76,7 @@ StoreOnlyDocSubDB::Config::Config(const DocTypeName &docTypeName, { } StoreOnlyDocSubDB::Config::~Config() { } -StoreOnlyDocSubDB::Context::Context(IDocumentSubDB::IOwner &owner, +StoreOnlyDocSubDB::Context::Context(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const search::common::FileHeaderContext &fileHeaderContext, diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 44ad409cfdb..49428c38d3d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -27,6 +27,7 @@ class MetricsWireService; class LegacyDocumentDBMetrics; class FeedHandler; class DocumentMetaStoreInitializerResult; +class IDocumentSubDBOwner; namespace initializer { class InitializerTask; } namespace bucketdb { class IBucketDBHandlerInitializer; } @@ -38,11 +39,11 @@ namespace documentmetastore { class LidReuseDelayerConfig; } class DocSubDB : public IDocumentSubDB { protected: - IOwner &_owner; + IDocumentSubDBOwner &_owner; search::transactionlog::SyncProxy &_tlSyncer; public: - DocSubDB(IOwner &owner, search::transactionlog::SyncProxy &tlSyncer) + DocSubDB(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer) : IDocumentSubDB(), _owner(owner), _tlSyncer(tlSyncer) @@ -107,7 +108,7 @@ public: }; struct Context { - IDocumentSubDB::IOwner &_owner; + IDocumentSubDBOwner &_owner; search::transactionlog::SyncProxy &_tlSyncer; const IGetSerialNum &_getSerialNum; const search::common::FileHeaderContext &_fileHeaderContext; @@ -119,7 +120,7 @@ public: std::mutex &_configMutex; const HwInfo &_hwInfo; - Context(IDocumentSubDB::IOwner &owner, + Context(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const search::common::FileHeaderContext &fileHeaderContext, @@ -166,7 +167,7 @@ private: TlsSyncer _tlsSyncer; DocumentMetaStoreFlushTarget::SP _dmsFlushTarget; - IFlushTarget::List getFlushTargets() override; + IFlushTargetList getFlushTargets() override; protected: const uint32_t _subDbId; const SubDbType _subDbType; @@ -188,7 +189,7 @@ protected: void setupDocumentMetaStore(std::shared_ptr<DocumentMetaStoreInitializerResult> dmsResult); void initFeedView(const DocumentDBConfig &configSnapshot); - virtual IFlushTarget::List getFlushTargetsInternal(); + virtual IFlushTargetList getFlushTargetsInternal(); StoreOnlyFeedView::Context getStoreOnlyFeedViewContext(const DocumentDBConfig &configSnapshot); StoreOnlyFeedView::PersistentParams getFeedViewPersistentParams(); vespalib::string getSubDbName() const; 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 42f4a4dc0cf..3a3fc00e6f0 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 @@ -73,7 +73,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB const ISummaryAdapter::SP &getSummaryAdapter() const override { return _summaryAdapter; } const IIndexWriter::SP &getIndexWriter() const override { return _indexWriter; } IDocumentMetaStoreContext &getDocumentMetaStoreContext() override { return _metaStoreCtx; } - IFlushTarget::List getFlushTargets() override { return IFlushTarget::List(); } + IFlushTargetList getFlushTargets() override { return IFlushTargetList(); } size_t getNumDocs() const override { return 0; } size_t getNumActiveDocs() const override { return 0; } bool hasDocument(const document::DocumentId &) override { return false; } |