From 09bdd0f52bab35ab1874356a4c1ce46012a4ca72 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Wed, 9 Oct 2024 17:34:13 +0200 Subject: [PATCH] Remove member variables that were always set to true. --- .../proton/documentdb/document_subdbs_test.cpp | 2 +- .../proton/server/documentsubdbcollection.cpp | 4 ++-- .../proton/server/fast_access_doc_subdb.cpp | 16 ++++++---------- .../proton/server/fast_access_doc_subdb.h | 8 -------- .../proton/server/searchabledocsubdb.cpp | 8 +++----- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp index c3837ff18ba8..52262b821e9a 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs_test.cpp @@ -191,7 +191,7 @@ struct MyFastAccessConfig { FastAccessConfig _cfg; explicit MyFastAccessConfig(SubDbType subDbType) - : _cfg(MyStoreOnlyConfig(subDbType)._cfg, true, true, FastAccessAttributesOnly) + : _cfg(MyStoreOnlyConfig(subDbType)._cfg, FastAccessAttributesOnly) { } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index db71f4325b44..d062e7e0ab36 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -58,7 +58,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( _subDBs.push_back (new SearchableDocSubDB(FastAccessDocSubDB::Config( StoreOnlyDocSubDB::Config(docTypeName, "0.ready", baseDir,_readySubDbId, SubDbType::READY), - true, true, false), + false), SearchableDocSubDB::Context( FastAccessDocSubDB::Context(context, metrics.ready.attributes, @@ -73,7 +73,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( _subDBs.push_back (new FastAccessDocSubDB(FastAccessDocSubDB::Config( StoreOnlyDocSubDB::Config(docTypeName, "2.notready", baseDir,_notReadySubDbId, SubDbType::NOTREADY), - true, true, true), + true), FastAccessDocSubDB::Context(context, metrics.notReady.attributes, metricsWireService, 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 7c9af86dee28..e6fb52486475 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 @@ -81,7 +81,7 @@ FastAccessDocSubDB::createAttributeManagerInitializer(const DocumentDBConfig &co documentMetaStoreInitTask, documentMetaStore, *baseAttrMgr, - (_hasAttributes ? configSnapshot.getAttributesConfig() : AttributesConfig()), + configSnapshot.getAttributesConfig(), alloc_strategy, _fastAccessAttributesOnly, _writeService.master(), @@ -115,12 +115,10 @@ get_attribute_names(const proton::IAttributeManager& mgr) void FastAccessDocSubDB::setupAttributeManager(AttributeManager::SP attrMgrResult) { - if (_addMetrics) { - // register attribute metrics - auto list = get_attribute_names(*attrMgrResult); - for (const auto &attr : list) { - _metricsWireService.addAttribute(_subAttributeMetrics, attr); - } + // register attribute metrics + auto list = get_attribute_names(*attrMgrResult); + for (const auto &attr : list) { + _metricsWireService.addAttribute(_subAttributeMetrics, attr); } _initAttrMgr = attrMgrResult; } @@ -197,13 +195,11 @@ FastAccessDocSubDB::createReprocessingTask(IReprocessingInitializer &initializer FastAccessDocSubDB::FastAccessDocSubDB(const Config &cfg, const Context &ctx) : Parent(cfg._storeOnlyCfg, ctx._storeOnlyCtx), - _hasAttributes(cfg._hasAttributes), _fastAccessAttributesOnly(cfg._fastAccessAttributesOnly), _initAttrMgr(), _fastAccessFeedView(), _configurer(_fastAccessFeedView, getSubDbName()), _subAttributeMetrics(ctx._subAttributeMetrics), - _addMetrics(cfg._addMetrics), _metricsWireService(ctx._metricsWireService), _attribute_interlock(std::move(ctx._attribute_interlock)), _docIdLimit(0) @@ -278,7 +274,7 @@ FastAccessDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const tasks.push_back(IReprocessingTask::SP(createReprocessingTask(*initializer, newConfigSnapshot.getDocumentTypeRepoSP()).release())); } - if (_addMetrics) { + { proton::IAttributeManager::SP newMgr = extractAttributeManager(_fastAccessFeedView.get()); reconfigureAttributeMetrics(*newMgr, *oldMgr); } 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 692667ff2b40..fa94476405c3 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 @@ -32,16 +32,10 @@ class FastAccessDocSubDB : public StoreOnlyDocSubDB struct Config { const StoreOnlyDocSubDB::Config _storeOnlyCfg; - const bool _hasAttributes; - const bool _addMetrics; const bool _fastAccessAttributesOnly; Config(const StoreOnlyDocSubDB::Config &storeOnlyCfg, - bool hasAttributes, - bool addMetrics, bool fastAccessAttributesOnly) : _storeOnlyCfg(storeOnlyCfg), - _hasAttributes(hasAttributes), - _addMetrics(addMetrics), _fastAccessAttributesOnly(fastAccessAttributesOnly) { } }; @@ -68,7 +62,6 @@ class FastAccessDocSubDB : public StoreOnlyDocSubDB using AttributesConfig = vespa::config::search::AttributesConfig; using Configurer = FastAccessDocSubDBConfigurer; - const bool _hasAttributes; const bool _fastAccessAttributesOnly; std::shared_ptr _initAttrMgr; Configurer::FeedViewVarHolder _fastAccessFeedView; @@ -88,7 +81,6 @@ class FastAccessDocSubDB : public StoreOnlyDocSubDB protected: using Parent = StoreOnlyDocSubDB; - const bool _addMetrics; MetricsWireService &_metricsWireService; std::shared_ptr _attribute_interlock; DocIdLimit _docIdLimit; diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 11cab648b521..e288f53dbda4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -152,7 +152,7 @@ SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const StoreOnlyDocSubDB::reconfigure(newConfigSnapshot.getStoreConfig(), alloc_strategy); IReprocessingTask::List tasks; applyFlushConfig(newConfigSnapshot.getMaintenanceConfigSP()->getFlushConfig()); - if (prepared_reconfig.has_matchers_changed() && _addMetrics) { + if (prepared_reconfig.has_matchers_changed()) { reconfigureMatchingMetrics(newConfigSnapshot.getRankProfilesConfig()); } if (prepared_reconfig.has_attribute_manager_changed()) { @@ -162,7 +162,7 @@ SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot, const if (initializer && initializer->hasReprocessors()) { tasks.emplace_back(createReprocessingTask(*initializer, newConfigSnapshot.getDocumentTypeRepoSP())); } - if (_addMetrics) { + { proton::IAttributeManager::SP newMgr = getAttributeManager(); reconfigureAttributeMetrics(*newMgr, *oldMgr); } @@ -218,9 +218,7 @@ SearchableDocSubDB::initViews(const DocumentDBConfig &configSnapshot) std::lock_guard guard(_configMutex); initFeedView(std::move(attrWriter), configSnapshot); } - if (_addMetrics) { - reconfigureMatchingMetrics(configSnapshot.getRankProfilesConfig()); - } + reconfigureMatchingMetrics(configSnapshot.getRankProfilesConfig()); } void