diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-02-10 11:42:01 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-02-10 11:42:01 +0100 |
commit | 7dfc60c4f28e8ba971c154fe04d57a2d59e12c7d (patch) | |
tree | 1b304d36a5879284875dfb28a7161e5dcf7c4ec5 /searchcore | |
parent | 6cafa7d885b5e0fe2ca7e33a786d0fa79d0e48ff (diff) |
Drop explicit active config snapshot generation in document db. It is
already part of the active config snapshot.
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(); |