diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-02-10 13:05:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 13:05:43 +0100 |
commit | e2279af9e20e9de36e2d43c6b797c772bfc3e651 (patch) | |
tree | 822648582a99a3d902038557cd3153903b4da0e6 /searchcore | |
parent | d82119dc70327c7ef052e2d6811b51c1116ca605 (diff) | |
parent | 7dfc60c4f28e8ba971c154fe04d57a2d59e12c7d (diff) |
Merge pull request #25975 from vespa-engine/toregge/drop-exlicit-active-config-snapshot-generation
Drop explicit active config snapshot generation in document db. It is
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentdb.cpp | 18 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentdb.h | 3 |
2 files changed, 7 insertions, 14 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 7d63b2f4c5e..9a84383c2f4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -198,7 +198,6 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, _configMutex(), _configCV(), _activeConfigSnapshot(), - _activeConfigSnapshotGeneration(0), _validateAndSanitizeDocStore(protonCfg.validateAndSanitizeDocstore == vespa::config::search::core::ProtonConfig::ValidateAndSanitizeDocstore::YES), _initGate(), _clusterStateHandler(_writeService.master()), @@ -269,14 +268,11 @@ DocumentDB::registerReference() } void -DocumentDB::setActiveConfig(DocumentDBConfig::SP config, int64_t generation) { +DocumentDB::setActiveConfig(DocumentDBConfig::SP config) +{ lock_guard guard(_configMutex); registerReference(); - assert(generation >= config->getGeneration()); _activeConfigSnapshot = std::move(config); - if (_activeConfigSnapshotGeneration < generation) { - _activeConfigSnapshotGeneration = generation; - } _configCV.notify_all(); } @@ -343,8 +339,7 @@ DocumentDB::initFinish(DocumentDBConfig::SP configSnapshot) syncFeedView(); // Check that feed view has been activated. assert(_feedView.get()); - int64_t generation = configSnapshot->getGeneration(); - setActiveConfig(std::move(configSnapshot), generation); + setActiveConfig(std::move(configSnapshot)); startTransactionLogReplay(); } @@ -438,7 +433,6 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum auto start_time = vespalib::steady_clock::now(); DocumentDBConfig::ComparisonResult cmpres; Schema::SP oldSchema; - int64_t generation = configSnapshot->getGeneration(); { lock_guard guard(_configMutex); assert(_activeConfigSnapshot.get()); @@ -507,7 +501,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum } _state.clearDelayedConfig(); } - setActiveConfig(configSnapshot, generation); + setActiveConfig(configSnapshot); if (params.shouldMaintenanceControllerChange() || _maintenanceController.getPaused()) { forwardMaintenanceConfig(); } @@ -817,7 +811,7 @@ DocumentDB::reconfigure(DocumentDBConfig::SP 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()) { + while ((_activeConfigSnapshot->getGeneration() < snapshot->getGeneration()) && !_state.getClosed()) { _configCV.wait(guard); } } @@ -922,7 +916,7 @@ DocumentDB::replayConfig(search::SerialNum serialNum) int64_t DocumentDB::getActiveGeneration() const { lock_guard guard(_configMutex); - return _activeConfigSnapshotGeneration; + return _activeConfigSnapshot ? _activeConfigSnapshot->getGeneration() : 0; } void diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 6e611917a79..ba508045be8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -117,7 +117,6 @@ private: mutable std::mutex _configMutex; // protects _active* below. mutable std::condition_variable _configCV; DocumentDBConfigSP _activeConfigSnapshot; - int64_t _activeConfigSnapshotGeneration; const bool _validateAndSanitizeDocStore; vespalib::Gate _initGate; @@ -145,7 +144,7 @@ private: DocumentDBMetricsUpdater _metricsUpdater; void registerReference(); - void setActiveConfig(DocumentDBConfigSP config, int64_t generation); + void setActiveConfig(DocumentDBConfigSP config); DocumentDBConfigSP getActiveConfig() const; void internalInit(); void initManagers(); |