diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-02-02 12:50:21 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-02-02 12:50:21 +0100 |
commit | 8d47e8da15675c97def3f0ffbfd9d35cb942be4a (patch) | |
tree | 915b1b8ca0050b582b1d19e059b0684794357346 /searchcore | |
parent | 2754ecf502e84e1b4d9fe479d1f68ab1d6194882 (diff) |
Add proton::DocumentDB::prepare_reconfig
Diffstat (limited to 'searchcore')
17 files changed, 114 insertions, 56 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 b1fda6e0efb..307695c4f4b 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 @@ -19,6 +19,7 @@ #include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/server/document_subdb_explorer.h> #include <vespa/searchcore/proton/server/document_subdb_initializer.h> +#include <vespa/searchcore/proton/server/document_subdb_reconfig.h> #include <vespa/searchcore/proton/server/emptysearchview.h> #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> #include <vespa/searchcore/proton/server/i_document_subdb_owner.h> @@ -377,8 +378,11 @@ struct FixtureBase cmpResult.documenttypesChanged = true; cmpResult.documentTypeRepoChanged = true; MyDocumentDBReferenceResolver resolver; + ReconfigParams reconfig_params(cmpResult); + auto prepared_reconfig = _subDb.prepare_reconfig(*newCfg->_cfg, *_snapshot->_cfg, reconfig_params); auto tasks = _subDb.applyConfig(*newCfg->_cfg, *_snapshot->_cfg, - serialNum, ReconfigParams(cmpResult), resolver); + serialNum, reconfig_params, resolver, *prepared_reconfig); + prepared_reconfig.reset(); _snapshot = std::move(newCfg); if (!tasks.empty()) { ReprocessingRunner runner; diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.cpp index bd7b14483ad..903c9d0a899 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.cpp @@ -12,5 +12,7 @@ DocumentDBReconfig::DocumentDBReconfig(std::unique_ptr<const DocumentSubDBReconf { } +DocumentDBReconfig::~DocumentDBReconfig() = default; + } diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.h b/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.h index c1f768511c8..21ea117f7e9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_reconfig.h @@ -26,6 +26,7 @@ private: public: DocumentDBReconfig(std::unique_ptr<const DocumentSubDBReconfig> ready_reconfig_in, std::unique_ptr<const DocumentSubDBReconfig> not_ready_reconfig_in); + ~DocumentDBReconfig(); const DocumentSubDBReconfig& ready_reconfig() const { return *_ready_reconfig; } const DocumentSubDBReconfig& not_ready_reconfig() const { return *_not_ready_reconfig; } diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.cpp index 3692fa07c06..2fd222338e7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.cpp @@ -10,5 +10,7 @@ DocumentSubDBReconfig::DocumentSubDBReconfig(std::shared_ptr<Matchers> matchers_ { } +DocumentSubDBReconfig::~DocumentSubDBReconfig() = default; + } diff --git a/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.h b/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.h index ed9faeee6fc..89129a6b0d0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.h @@ -17,6 +17,7 @@ private: public: DocumentSubDBReconfig(std::shared_ptr<Matchers> matchers_in); + ~DocumentSubDBReconfig(); void set_matchers(std::shared_ptr<Matchers> value) { _new_matchers = std::move(value); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 6241af3fcf7..110b0324dc3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -3,6 +3,7 @@ #include "documentdb.h" #include "bootstrapconfig.h" #include "combiningfeedview.h" +#include "document_db_reconfig.h" #include "document_meta_store_read_guards.h" #include "document_subdb_collection_explorer.h" #include "documentdbconfigscout.h" @@ -347,34 +348,18 @@ DocumentDB::initFinish(DocumentDBConfig::SP configSnapshot) startTransactionLogReplay(); } - -void -DocumentDB::newConfigSnapshot(DocumentDBConfig::SP snapshot) +std::unique_ptr<DocumentDBReconfig> +DocumentDB::prepare_reconfig(const DocumentDBConfig& new_config_snapshot) { - // Called by executor thread - _pendingConfigSnapshot.set(std::move(snapshot)); - { - lock_guard guard(_configMutex); - if ( ! _activeConfigSnapshot) { - LOG(debug, - "DocumentDB(%s): Ignoring new available config snapshot. " - "The document database does not have" - " an active config snapshot yet", _docTypeName.toString().c_str()); - return; - } - if (!_state.getAllowReconfig()) { - LOG(warning, - "DocumentDB(%s): Ignoring new available config snapshot. " - "The document database is not allowed to" - " reconfigure yet. Wait until replay is done before" - " you try to reconfigure again", _docTypeName.toString().c_str()); - return; - } + auto active_config_snapshot = getActiveConfig(); + auto cmpres = active_config_snapshot->compare(new_config_snapshot); + if (_state.getState() == DDBState::State::APPLY_LIVE_CONFIG) { + cmpres.importedFieldsChanged = true; } - masterExecute([this] () { performReconfig(_pendingConfigSnapshot.get()); } ); + const ReconfigParams reconfig_params(cmpres); + return _subDBs.prepare_reconfig(new_config_snapshot, *active_config_snapshot, reconfig_params); } - void DocumentDB::enterReprocessState() { @@ -411,10 +396,10 @@ DocumentDB::enterOnlineState() } void -DocumentDB::performReconfig(DocumentDBConfig::SP configSnapshot) +DocumentDB::performReconfig(DocumentDBConfig::SP configSnapshot, std::unique_ptr<DocumentDBReconfig> prepared_reconfig) { // Called by executor thread - applyConfig(std::move(configSnapshot), getCurrentSerialNumber()); + applyConfig(std::move(configSnapshot), getCurrentSerialNumber(), std::move(prepared_reconfig)); if (_state.getState() == DDBState::State::APPLY_LIVE_CONFIG) { enterReprocessState(); } @@ -423,7 +408,7 @@ DocumentDB::performReconfig(DocumentDBConfig::SP configSnapshot) void DocumentDB::applySubDBConfig(const DocumentDBConfig &newConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms) + SerialNum serialNum, const ReconfigParams ¶ms, const DocumentDBReconfig& prepared_reconfig) { auto registry = _owner.getDocumentDBReferenceRegistry(); auto oldRepo = _activeConfigSnapshot->getDocumentTypeRepoSP(); @@ -434,11 +419,11 @@ DocumentDB::applySubDBConfig(const DocumentDBConfig &newConfigSnapshot, assert(newDocType != nullptr); DocumentDBReferenceResolver resolver(*registry, *newDocType, newConfigSnapshot.getImportedFieldsConfig(), *oldDocType, _refCount, _writeService.attributeFieldWriter(), _state.getAllowReconfig()); - _subDBs.applyConfig(newConfigSnapshot, *_activeConfigSnapshot, serialNum, params, resolver); + _subDBs.applyConfig(newConfigSnapshot, *_activeConfigSnapshot, serialNum, params, resolver, prepared_reconfig); } void -DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum) +DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum, std::unique_ptr<const DocumentDBReconfig> prepared_reconfig) { // Always called by executor thread: // Called by performReconfig() by executor thread during normal @@ -456,9 +441,6 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum { lock_guard guard(_configMutex); assert(_activeConfigSnapshot.get()); - if (_state.getState() >= DDBState::State::ONLINE) { - configSnapshot = DocumentDBConfig::makeDelayedAttributeAspectConfig(configSnapshot, *_activeConfigSnapshot); - } if (configSnapshot->getDelayedAttributeAspects()) { _state.setConfigState(DDBState::ConfigState::NEED_RESTART); LOG(info, "DocumentDB(%s): Delaying attribute aspect changes: need restart", @@ -501,7 +483,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum _writeServiceConfig.defaultTaskLimit(), _writeServiceConfig.defaultTaskLimit()); if (params.shouldSubDbsChange()) { - applySubDBConfig(*configSnapshot, serialNum, params); + applySubDBConfig(*configSnapshot, serialNum, params, *prepared_reconfig); if (serialNum < _feedHandler->get_replay_end_serial_num()) { // Not last entry in tls. Reprocessing should already be done. _subDBs.getReprocessingRunner().reset(); @@ -808,7 +790,14 @@ DocumentDB::setIndexSchema(const DocumentDBConfig &configSnapshot, SerialNum ser void DocumentDB::reconfigure(DocumentDBConfig::SP snapshot) { - masterExecute([this, snapshot]() mutable { newConfigSnapshot(std::move(snapshot)); }); + // Called by proton executor thread (c.f. ProtonConfigurer::configureDocumentDB) + _pendingConfigSnapshot.set(snapshot); + auto active_snapshot = getActiveConfig(); + assert(active_snapshot); + assert(_state.getAllowReconfig()); + snapshot = DocumentDBConfig::makeDelayedAttributeAspectConfig(snapshot, *active_snapshot); + auto prepared_reconfig = prepare_reconfig(*snapshot); + masterExecute([this, snapshot, prepared_reconfig = std::move(prepared_reconfig)]() mutable { performReconfig(snapshot, std::move(prepared_reconfig)); }); // Wait for config to be applied, or for document db close std::unique_lock<std::mutex> guard(_configMutex); while ((_activeConfigSnapshotGeneration < snapshot->getGeneration()) && !_state.getClosed()) { @@ -845,7 +834,12 @@ DocumentDB::enterApplyLiveConfigState() lock_guard guard(_configMutex); (void) _state.enterApplyLiveConfigState(); } - masterExecute([this]() { performReconfig(_pendingConfigSnapshot.get()); }); + auto new_config_snapshot = _pendingConfigSnapshot.get(); + auto prepared_reconfig = prepare_reconfig(*new_config_snapshot); + masterExecute([this, new_config_snapshot, prepared_reconfig = std::move(prepared_reconfig)]() mutable + { + performReconfig(std::move(new_config_snapshot), std::move(prepared_reconfig)); + }); } @@ -902,7 +896,8 @@ DocumentDB::replayConfig(search::SerialNum serialNum) configSnapshot = DocumentDBConfigScout::scout(configSnapshot, *_pendingConfigSnapshot.get()); // Ignore configs that are not relevant during replay of transaction log configSnapshot = DocumentDBConfig::makeReplayConfig(configSnapshot); - applyConfig(configSnapshot, serialNum); + auto prepared_reconfig = prepare_reconfig(*configSnapshot); + applyConfig(configSnapshot, serialNum, std::move(prepared_reconfig)); LOG(info, "DocumentDB(%s): Replayed config with serialNum=%" PRIu64, _docTypeName.toString().c_str(), serialNum); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 09e54f518f7..2b3e6ef4052 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -53,6 +53,7 @@ namespace storage::spi { struct BucketExecutor; } namespace proton { class AttributeConfigInspector; +class DocumentDBReconfig; class ExecutorThreadingServiceStats; class IDocumentDBOwner; class ISharedThreadingService; @@ -149,12 +150,13 @@ private: void internalInit(); void initManagers(); void initFinish(DocumentDBConfigSP configSnapshot); - void performReconfig(DocumentDBConfigSP configSnapshot); + void performReconfig(DocumentDBConfigSP configSnapshot, std::unique_ptr<DocumentDBReconfig> prepared_reconfig); void closeSubDBs(); void applySubDBConfig(const DocumentDBConfig &newConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms); - void applyConfig(DocumentDBConfigSP configSnapshot, SerialNum serialNum); + SerialNum serialNum, const ReconfigParams ¶ms, + const DocumentDBReconfig& prepared_reconfig); + void applyConfig(DocumentDBConfigSP configSnapshot, SerialNum serialNum, std::unique_ptr<const DocumentDBReconfig> prepared_reconfig); /** * Save initial config if we don't have any saved config snapshots. @@ -380,7 +382,7 @@ public: bool getDelayedConfig() const { return _state.getDelayedConfig(); } void replayConfig(SerialNum serialNum) override; const DocTypeName & getDocTypeName() const { return _docTypeName; } - void newConfigSnapshot(DocumentDBConfigSP snapshot); + std::unique_ptr<DocumentDBReconfig> prepare_reconfig(const DocumentDBConfig& new_config_snapshot); void reconfigure(DocumentDBConfigSP snapshot) override; int64_t getActiveGeneration() const; /* diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 855a40780cb..b118614b5e0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -2,7 +2,9 @@ #include "documentsubdbcollection.h" #include "combiningfeedview.h" +#include "document_db_reconfig.h" #include "document_subdb_collection_initializer.h" +#include "document_subdb_reconfig.h" #include "i_document_subdb_owner.h" #include "maintenancecontroller.h" #include "searchabledocsubdb.h" @@ -248,20 +250,34 @@ DocumentSubDBCollection::pruneRemovedFields(SerialNum serialNum) } } +std::unique_ptr<DocumentDBReconfig> +DocumentSubDBCollection::prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) +{ + (void) new_config_snapshot; + (void) old_config_snapshot; + (void) reconfig_params; + auto ready_reconfig = getReadySubDB()->prepare_reconfig(new_config_snapshot, old_config_snapshot, reconfig_params); + auto not_ready_reconfig = getNotReadySubDB()->prepare_reconfig(new_config_snapshot, old_config_snapshot, reconfig_params); + return std::make_unique<DocumentDBReconfig>(std::move(ready_reconfig), std::move(not_ready_reconfig)); +} void DocumentSubDBCollection::applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, SerialNum serialNum, const ReconfigParams ¶ms, - IDocumentDBReferenceResolver &resolver) + IDocumentDBReferenceResolver &resolver, + const DocumentDBReconfig& prepared_reconfig) { _reprocessingRunner.reset(); - for (auto subDb : _subDBs) { - IReprocessingTask::List tasks; - tasks = subDb->applyConfig(newConfigSnapshot, oldConfigSnapshot, serialNum, params, resolver); - _reprocessingRunner.addTasks(tasks); - } + auto tasks = getReadySubDB()->applyConfig(newConfigSnapshot, oldConfigSnapshot, serialNum, params, resolver, prepared_reconfig.ready_reconfig()); + _reprocessingRunner.addTasks(tasks); + tasks = getNotReadySubDB()->applyConfig(newConfigSnapshot, oldConfigSnapshot, serialNum, params, resolver, prepared_reconfig.not_ready_reconfig()); + _reprocessingRunner.addTasks(tasks); + auto removed_reconfig = getRemSubDB()->prepare_reconfig(newConfigSnapshot, oldConfigSnapshot, params); + tasks = getRemSubDB()->applyConfig(newConfigSnapshot, oldConfigSnapshot, serialNum, params, resolver, *removed_reconfig); + removed_reconfig.reset(); + _reprocessingRunner.addTasks(tasks); } IFeedView::SP diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index a5ab1b5971c..21f36c7ca3e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -31,6 +31,7 @@ namespace proton { class DocTypeName; class DocumentDBConfig; +class DocumentDBReconfig; class FeedHandler; class HwInfo; class IDocumentRetriever; @@ -136,8 +137,9 @@ public: void pruneRemovedFields(SerialNum serialNum); + std::unique_ptr<DocumentDBReconfig> prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params); void applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver); + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentDBReconfig& prepared_reconfig); IFeedViewSP getFeedView(); IFlushTargetList getFlushTargets(); 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 48ce0f37c28..0727dd493eb 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 @@ -241,7 +241,7 @@ FastAccessDocSubDB::initViews(const DocumentDBConfig &configSnapshot) IReprocessingTask::List FastAccessDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &) + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &, const DocumentSubDBReconfig&) { AllocStrategy alloc_strategy = newConfigSnapshot.get_alloc_config().make_alloc_strategy(_subDbType); reconfigure(newConfigSnapshot.getStoreConfig(), alloc_strategy); 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 2d00a2a412c..0ace6bab33f 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 @@ -111,7 +111,7 @@ public: IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) override; + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) override; proton::IAttributeManager::SP getAttributeManager() const override; IDocumentRetriever::UP getDocumentRetriever() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index c6410073c09..99804fe253f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -25,6 +25,7 @@ namespace proton { namespace matching { class SessionManager; } class DocumentDBConfig; +class DocumentSubDBReconfig; class DocumentSubDbInitializer; class DocumentSubDbInitializerResult; class FeedHandler; @@ -78,9 +79,11 @@ public: virtual void setup(const DocumentSubDbInitializerResult &initResult) = 0; virtual void initViews(const DocumentDBConfig &configSnapshot) = 0; + virtual std::unique_ptr<const DocumentSubDBReconfig> + prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) = 0; virtual IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) = 0; + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) = 0; virtual void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> &calc, OnDone) = 0; virtual std::shared_ptr<ISearchHandler> getSearchView() const = 0; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 506b541bbd3..4b3c1901b4e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -3,6 +3,7 @@ #include "searchabledocsubdb.h" #include "fast_access_document_retriever.h" #include "document_subdb_initializer.h" +#include "document_subdb_reconfig.h" #include "reconfig_params.h" #include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> @@ -132,10 +133,20 @@ reconfigureMatchingMetrics(const RankProfilesConfig &cfg) } } +std::unique_ptr<const DocumentSubDBReconfig> +SearchableDocSubDB::prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) +{ + (void) new_config_snapshot; + (void) old_config_snapshot; + (void) reconfig_params; + return std::make_unique<const DocumentSubDBReconfig>(std::shared_ptr<Matchers>()); +} + IReprocessingTask::List SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) { + (void) prepared_reconfig; AllocStrategy alloc_strategy = newConfigSnapshot.get_alloc_config().make_alloc_strategy(_subDbType); StoreOnlyDocSubDB::reconfigure(newConfigSnapshot.getStoreConfig(), alloc_strategy); IReprocessingTask::List tasks; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index 806d1191072..e3906f84f13 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -102,9 +102,11 @@ public: void setup(const DocumentSubDbInitializerResult &initResult) override; void initViews(const DocumentDBConfig &configSnapshot) override; + std::unique_ptr<const DocumentSubDBReconfig> + prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) override; IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) override; + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) override; void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> &calc, OnDone onDone) override; void clearViews() override; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index a5d679f87af..22aeeec4ef6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -4,6 +4,7 @@ #include "docstorevalidator.h" #include "document_subdb_initializer.h" #include "document_subdb_initializer_result.h" +#include "document_subdb_reconfig.h" #include "emptysearchview.h" #include "i_document_subdb_owner.h" #include "minimal_document_retriever.h" @@ -404,14 +405,24 @@ StoreOnlyDocSubDB::getSubDbName() const { return vespalib::make_string("%s.%s", _owner.getName().c_str(), _subName.c_str()); } +std::unique_ptr<const DocumentSubDBReconfig> +StoreOnlyDocSubDB::prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) +{ + (void) new_config_snapshot; + (void) old_config_snapshot; + (void) reconfig_params; + return std::make_unique<const DocumentSubDBReconfig>(std::shared_ptr<Matchers>()); +} + IReprocessingTask::List StoreOnlyDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) { (void) oldConfigSnapshot; (void) serialNum; (void) params; (void) resolver; + (void) prepared_reconfig; assert(_writeService.master().isCurrentThread()); AllocStrategy alloc_strategy = newConfigSnapshot.get_alloc_config().make_alloc_strategy(_subDbType); reconfigure(newConfigSnapshot.getStoreConfig(), alloc_strategy); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 5a8db23e345..f547ced67c7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -200,9 +200,11 @@ public: void validateDocStore(FeedHandler & feedHandler, SerialNum serialNum) const override; + std::unique_ptr<const DocumentSubDBReconfig> + prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params) override; IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, - SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver) override; + SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig &prepared_reconfig) override; void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> &calc, OnDone onDone) override; ISearchHandler::SP getSearchView() const override { return _iSearchView.get(); } 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 24504c92cb2..85315158c3c 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 @@ -7,6 +7,7 @@ #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/document_subdb_reconfig.h> #include <vespa/searchcore/proton/server/isummaryadapter.h> #include <vespa/searchcore/proton/index/i_index_writer.h> #include <vespa/searchcore/proton/server/ifeedview.h> @@ -51,8 +52,11 @@ struct DummyDocumentSubDb : public IDocumentSubDB } void setup(const DocumentSubDbInitializerResult &) override {} void initViews(const DocumentDBConfig &) override {} + std::unique_ptr<const DocumentSubDBReconfig> prepare_reconfig(const DocumentDBConfig&, const DocumentDBConfig&, const ReconfigParams&) override { + return std::make_unique<const DocumentSubDBReconfig>(std::shared_ptr<Matchers>()); + } IReprocessingTask::List applyConfig(const DocumentDBConfig &, const DocumentDBConfig &, - SerialNum, const ReconfigParams &, IDocumentDBReferenceResolver &) override + SerialNum, const ReconfigParams &, IDocumentDBReferenceResolver &, const DocumentSubDBReconfig&) override { return IReprocessingTask::List(); } |