Skip to content

Commit

Permalink
Merge pull request #32561 from vespa-engine/toregge/remove-member-var…
Browse files Browse the repository at this point in the history
…iables-that-were-always-set-to-true

Remove member variables that were always set to true.
  • Loading branch information
geirst authored Oct 9, 2024
2 parents f109fe7 + 09bdd0f commit 4d14ac6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct MyFastAccessConfig
{
FastAccessConfig _cfg;
explicit MyFastAccessConfig(SubDbType subDbType)
: _cfg(MyStoreOnlyConfig(subDbType)._cfg, true, true, FastAccessAttributesOnly)
: _cfg(MyStoreOnlyConfig(subDbType)._cfg, FastAccessAttributesOnly)
{
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ FastAccessDocSubDB::createAttributeManagerInitializer(const DocumentDBConfig &co
documentMetaStoreInitTask,
documentMetaStore,
*baseAttrMgr,
(_hasAttributes ? configSnapshot.getAttributesConfig() : AttributesConfig()),
configSnapshot.getAttributesConfig(),
alloc_strategy,
_fastAccessAttributesOnly,
_writeService.master(),
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{ }
};
Expand All @@ -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<AttributeManager> _initAttrMgr;
Configurer::FeedViewVarHolder _fastAccessFeedView;
Expand All @@ -88,7 +81,6 @@ class FastAccessDocSubDB : public StoreOnlyDocSubDB
protected:
using Parent = StoreOnlyDocSubDB;

const bool _addMetrics;
MetricsWireService &_metricsWireService;
std::shared_ptr<search::attribute::Interlock> _attribute_interlock;
DocIdLimit _docIdLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -218,9 +218,7 @@ SearchableDocSubDB::initViews(const DocumentDBConfig &configSnapshot)
std::lock_guard<std::mutex> guard(_configMutex);
initFeedView(std::move(attrWriter), configSnapshot);
}
if (_addMetrics) {
reconfigureMatchingMetrics(configSnapshot.getRankProfilesConfig());
}
reconfigureMatchingMetrics(configSnapshot.getRankProfilesConfig());
}

void
Expand Down

0 comments on commit 4d14ac6

Please sign in to comment.