From 4bf6bbd8fc50e635a1f808bcf0da7a83f8703bbc Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Tue, 21 May 2019 13:21:36 +0000 Subject: Re-enable cluster state transition optimization Made side effects of replica resurrection bug more likely to be observed, but not in itself a believed root cause of any issues. --- storage/src/vespa/storage/distributor/bucketdbupdater.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'storage') diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index b089d3ab83f..33fa80ab484 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -128,7 +128,7 @@ BucketDBUpdater::recheckBucketInfo(uint32_t nodeIdx, void BucketDBUpdater::removeSuperfluousBuckets( const lib::ClusterStateBundle& newState, - [[maybe_unused]] bool is_distribution_config_change) + bool is_distribution_config_change) { const bool move_to_read_only_db = shouldDeferStateEnabling(); const char* up_states = _distributorComponent.getDistributor().getStorageNodeUpStates(); @@ -137,6 +137,16 @@ BucketDBUpdater::removeSuperfluousBuckets( const auto& oldClusterState(elem.second->getClusterState()); const auto& new_cluster_state = newState.getDerivedClusterState(elem.first); + // Running a full DB sweep is expensive, so if the cluster state transition does + // not actually indicate that buckets should possibly be removed, we elide it entirely. + if (!is_distribution_config_change + && db_pruning_may_be_elided(oldClusterState, *new_cluster_state, up_states)) + { + LOG(debug, "Eliding DB pruning for state transition '%s' -> '%s'", + oldClusterState.toString().c_str(), new_cluster_state->toString().c_str()); + continue; + } + auto& bucketDb(elem.second->getBucketDatabase()); auto& readOnlyDb(_distributorComponent.getReadOnlyBucketSpaceRepo().get(elem.first).getBucketDatabase()); -- cgit v1.2.3