diff options
author | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-10-11 11:57:31 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-10-11 11:57:31 +0000 |
commit | d3c78fe08333ecd0acd846d237e1f8f0b5a0d787 (patch) | |
tree | c60f81a1205c3d53080f48de43174e829d3b2c4f /storage | |
parent | f1e4ed010405ebba594abb53edc44c25b5ecaf03 (diff) |
Don't start config thread until _after_ components are set up
Avoids race where new config received after initial fetch but before
node is fully set up gets lost.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/storageserver/storagenode.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index 85f54431cfb..847222217d2 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -90,7 +90,6 @@ StorageNode::subscribeToConfigs() _configFetcher->subscribe<vespa::config::content::UpgradingConfig>(_configUri.getConfigId(), this); _configFetcher->subscribe<vespa::config::content::core::StorServerConfig>(_configUri.getConfigId(), this); _configFetcher->subscribe<vespa::config::content::core::StorPrioritymappingConfig>(_configUri.getConfigId(), this); - _configFetcher->start(); vespalib::LockGuard configLockGuard(_configLock); _serverConfig = std::move(_newServerConfig); @@ -195,6 +194,9 @@ StorageNode::initialize() initializeStatusWebServer(); + // All components are set up, so we can start async config subscription. + _configFetcher->start(); + // Write pid file as the last thing we do. If we fail initialization // due to an exception we won't run shutdown. Thus we won't remove the // pid file if something throws after writing it in initialization. @@ -247,11 +249,10 @@ StorageNode::updateUpgradeFlag(const vespa::config::content::UpgradingConfig& co void StorageNode::handleLiveConfigUpdate() { - // Make sure we don't conflict with initialize or shutdown threads. + // Make sure we don't conflict with initialize or shutdown threads. vespalib::LockGuard configLockGuard(_configLock); - // If storage haven't initialized, ignore. Initialize code will handle - // this config. - if (_chain.get() == 0) return; + + assert(_chain.get() != nullptr); // If we get here, initialize is done running. We have to handle changes // we want to handle. |