diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-03-26 12:38:33 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-03-26 12:38:57 +0000 |
commit | a599019904e9f3673b8d834efd28350604d8b7fd (patch) | |
tree | ab4547d6f88e0cecf1d2a33094f16bb087009855 /storage | |
parent | 239a3c7977af8a2fdb17d66cbf986a400a75617a (diff) |
Address code review feedback for distributor changes
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/distributor/bucketdbupdater.cpp | 21 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/bucketdbupdater.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index 4e99ea093af..e9595b4a960 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -172,6 +172,14 @@ BucketDBUpdater::completeTransitionTimer() } void +BucketDBUpdater::clearReadOnlyBucketRepoDatabases() +{ + for (auto& space : _distributorComponent.getReadOnlyBucketSpaceRepo()) { + space.second->getBucketDatabase().clear(); + } +} + +void BucketDBUpdater::storageDistributionChanged() { ensureTransitionTimerStarted(); @@ -195,9 +203,7 @@ BucketDBUpdater::storageDistributionChanged() void BucketDBUpdater::replyToPreviousPendingClusterStateIfAny() { - if (_pendingClusterState.get() && - _pendingClusterState->getCommand().get()) - { + if (_pendingClusterState.get() && _pendingClusterState->hasCommand()) { _distributorComponent.sendUp( std::make_shared<api::SetSystemStateReply>(*_pendingClusterState->getCommand())); } @@ -276,10 +282,13 @@ BucketDBUpdater::onActivateClusterStateVersion(const std::shared_ptr<api::Activa replyToActivationWithActualVersion(*cmd, pending_version); return true; } - } else { + } else if (shouldDeferStateEnabling()) { // Likely just a resend, but log warn for now to get a feel of how common it is. LOG(warning, "Received cluster state activation command for version %u, which " "has no corresponding pending state. Likely resent operation.", cmd->version()); + } else { + LOG(debug, "Received cluster state activation command for version %u, but distributor " + "config does not have deferred activation enabled. Treating as no-op.", cmd->version()); } // Fall through to next link in call chain that cares about this message. return false; @@ -591,9 +600,7 @@ BucketDBUpdater::activatePendingClusterState() _outdatedNodesMap.clear(); sendAllQueuedBucketRechecks(); completeTransitionTimer(); - for (auto& space : _distributorComponent.getReadOnlyBucketSpaceRepo()) { - space.second->getBucketDatabase().clear(); - } + clearReadOnlyBucketRepoDatabases(); } void diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index ee98e398f6d..393e1e2524e 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -145,6 +145,7 @@ private: BucketListMerger::BucketList& existing) const; void ensureTransitionTimerStarted(); void completeTransitionTimer(); + void clearReadOnlyBucketRepoDatabases(); /** * Adds all buckets contained in the bucket database * that are either contained |