diff options
Diffstat (limited to 'storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp')
-rw-r--r-- | storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp b/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp index 8d19d7a356d..bb284bfc108 100644 --- a/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp +++ b/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "servicelayerprocess.h" #include <vespa/config/helper/configgetter.hpp> @@ -34,6 +34,9 @@ bucket_db_options_from_config(const config::ConfigUri& config_uri) { ServiceLayerProcess::ServiceLayerProcess(const config::ConfigUri& configUri) : Process(configUri), _externalVisitors(), + _persistence_cfg_handle(), + _visitor_cfg_handle(), + _filestor_cfg_handle(), _node(), _storage_chain_builder(), _context(std::make_unique<framework::defaultimplementation::RealClock>(), @@ -51,11 +54,59 @@ ServiceLayerProcess::shutdown() } void +ServiceLayerProcess::setupConfig(vespalib::duration subscribe_timeout) +{ + _persistence_cfg_handle = _configSubscriber.subscribe<PersistenceConfig>(_configUri.getConfigId(), subscribe_timeout); + _visitor_cfg_handle = _configSubscriber.subscribe<StorVisitorConfig>(_configUri.getConfigId(), subscribe_timeout); + _filestor_cfg_handle = _configSubscriber.subscribe<StorFilestorConfig>(_configUri.getConfigId(), subscribe_timeout); + // We reuse the StorServerConfig subscription from the parent Process + Process::setupConfig(subscribe_timeout); +} + +void +ServiceLayerProcess::updateConfig() +{ + Process::updateConfig(); + if (_server_cfg_handle->isChanged()) { + _node->on_configure(*_server_cfg_handle->getConfig()); + } + if (_persistence_cfg_handle->isChanged()) { + _node->on_configure(*_persistence_cfg_handle->getConfig()); + } + if (_visitor_cfg_handle->isChanged()) { + _node->on_configure(*_visitor_cfg_handle->getConfig()); + } + if (_filestor_cfg_handle->isChanged()) { + _node->on_configure(*_filestor_cfg_handle->getConfig()); + } +} + +bool +ServiceLayerProcess::configUpdated() +{ + return Process::configUpdated(); +} + +void ServiceLayerProcess::createNode() { add_external_visitors(); setupProvider(); - _node = std::make_unique<ServiceLayerNode>(_configUri, _context, *this, getProvider(), _externalVisitors); + + StorageNode::BootstrapConfigs bc; + bc.bucket_spaces_cfg = _bucket_spaces_cfg_handle->getConfig(); + bc.bouncer_cfg = _bouncer_cfg_handle->getConfig(); + bc.comm_mgr_cfg = _comm_mgr_cfg_handle->getConfig(); + bc.distribution_cfg = _distribution_cfg_handle->getConfig(); + bc.server_cfg = _server_cfg_handle->getConfig(); + + ServiceLayerNode::ServiceLayerBootstrapConfigs sbc; + sbc.storage_bootstrap_configs = std::move(bc); + sbc.persistence_cfg = _persistence_cfg_handle->getConfig(); + sbc.visitor_cfg = _visitor_cfg_handle->getConfig(); + sbc.filestor_cfg = _filestor_cfg_handle->getConfig(); + + _node = std::make_unique<ServiceLayerNode>(_configUri, _context, std::move(sbc), *this, getProvider(), _externalVisitors); if (_storage_chain_builder) { _node->set_storage_chain_builder(std::move(_storage_chain_builder)); } |