aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 777b9a93be6..e6cd8987c0a 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.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 "filestormanager.h"
#include "filestorhandlerimpl.h"
@@ -62,7 +62,7 @@ private:
}
FileStorManager::
-FileStorManager(const config::ConfigUri & configUri, spi::PersistenceProvider& provider,
+FileStorManager(const StorFilestorConfig& bootstrap_config, spi::PersistenceProvider& provider,
ServiceLayerComponentRegister& compReg, DoneInitializeHandler& init_handler,
HostInfo& hostInfoReporterRegistrar)
: StorageLinkQueued("File store manager", compReg),
@@ -75,13 +75,8 @@ FileStorManager(const config::ConfigUri & configUri, spi::PersistenceProvider& p
_persistenceHandlers(),
_threads(),
_bucketOwnershipNotifier(std::make_unique<BucketOwnershipNotifier>(_component, *this)),
- _configFetcher(std::make_unique<config::ConfigFetcher>(configUri.getContext())),
_use_async_message_handling_on_schedule(false),
_metrics(std::make_unique<FileStorMetrics>()),
- _mem_trap_1(std::make_unique<vespalib::HeapMemoryTrap>(1)),
- _mem_trap_2(std::make_unique<vespalib::HeapMemoryTrap>(2)),
- _mem_trap_3(std::make_unique<vespalib::HeapMemoryTrap>(3)),
- _mem_trap_4(std::make_unique<vespalib::HeapMemoryTrap>(16)),
_filestorHandler(),
_sequencedExecutor(),
_closed(false),
@@ -89,8 +84,7 @@ FileStorManager(const config::ConfigUri & configUri, spi::PersistenceProvider& p
_host_info_reporter(_component.getStateUpdater()),
_resource_usage_listener_registration(provider.register_resource_usage_listener(_host_info_reporter))
{
- _configFetcher->subscribe(configUri.getConfigId(), this);
- _configFetcher->start();
+ on_configure(bootstrap_config);
_component.registerMetric(*_metrics);
_component.registerStatusPage(*this);
_component.getStateUpdater().addStateListener(*this);
@@ -176,7 +170,7 @@ dynamic_throttle_params_from_config(const StorFilestorConfig& config, uint32_t n
#define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("local-exec")))
#endif
-thread_local PersistenceHandler * _G_threadLocalHandler TLS_LINKAGE = nullptr;
+thread_local PersistenceHandler * _g_threadLocalHandler TLS_LINKAGE = nullptr;
size_t
computeAllPossibleHandlerThreads(const vespa::config::content::StorFilestorConfig & cfg) {
@@ -204,26 +198,26 @@ FileStorManager::createRegisteredHandler(const ServiceLayerComponent & component
PersistenceHandler &
FileStorManager::getThreadLocalHandler() {
- if (_G_threadLocalHandler == nullptr) {
- _G_threadLocalHandler = & createRegisteredHandler(_component);
+ if (_g_threadLocalHandler == nullptr) {
+ _g_threadLocalHandler = & createRegisteredHandler(_component);
}
- return *_G_threadLocalHandler;
+ return *_g_threadLocalHandler;
}
void
-FileStorManager::configure(std::unique_ptr<StorFilestorConfig> config)
+FileStorManager::on_configure(const StorFilestorConfig& config)
{
// If true, this is not the first configure.
const bool liveUpdate = ! _threads.empty();
- _use_async_message_handling_on_schedule = config->useAsyncMessageHandlingOnSchedule;
- _host_info_reporter.set_noise_level(config->resourceUsageReporterNoiseLevel);
- const bool use_dynamic_throttling = ((config->asyncOperationThrottlerType == StorFilestorConfig::AsyncOperationThrottlerType::DYNAMIC) ||
- (config->asyncOperationThrottler.type == StorFilestorConfig::AsyncOperationThrottler::Type::DYNAMIC));
- const bool throttle_merge_feed_ops = config->asyncOperationThrottler.throttleIndividualMergeFeedOps;
+ _use_async_message_handling_on_schedule = config.useAsyncMessageHandlingOnSchedule;
+ _host_info_reporter.set_noise_level(config.resourceUsageReporterNoiseLevel);
+ const bool use_dynamic_throttling = ((config.asyncOperationThrottlerType == StorFilestorConfig::AsyncOperationThrottlerType::DYNAMIC) ||
+ (config.asyncOperationThrottler.type == StorFilestorConfig::AsyncOperationThrottler::Type::DYNAMIC));
+ const bool throttle_merge_feed_ops = config.asyncOperationThrottler.throttleIndividualMergeFeedOps;
if (!liveUpdate) {
- _config = std::move(config);
+ _config = std::make_unique<StorFilestorConfig>(config);
uint32_t numThreads = std::max(1, _config->numThreads);
uint32_t numStripes = std::max(1u, numThreads / 2);
_metrics->initDiskMetrics(numStripes, computeAllPossibleHandlerThreads(*_config));
@@ -244,7 +238,7 @@ FileStorManager::configure(std::unique_ptr<StorFilestorConfig> config)
_bucketExecutorRegistration = _provider->register_executor(std::make_shared<BucketExecutorWrapper>(*this));
} else {
assert(_filestorHandler);
- auto updated_dyn_throttle_params = dynamic_throttle_params_from_config(*config, _threads.size());
+ auto updated_dyn_throttle_params = dynamic_throttle_params_from_config(config, _threads.size());
_filestorHandler->reconfigure_dynamic_throttler(updated_dyn_throttle_params);
}
// TODO remove once desired dynamic throttling behavior is set in stone
@@ -832,8 +826,6 @@ void FileStorManager::onClose()
LOG(debug, "Start closing");
_bucketExecutorRegistration.reset();
_resource_usage_listener_registration.reset();
- // Avoid getting config during shutdown
- _configFetcher->close();
LOG(debug, "Closed _configFetcher.");
_filestorHandler->close();
LOG(debug, "Closed _filestorHandler.");