summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-05-21 13:21:36 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-05-21 13:23:15 +0000
commit4bf6bbd8fc50e635a1f808bcf0da7a83f8703bbc (patch)
tree7988c179f207fcf02f897f89ce2f9b969080b31c /storage
parent20cd5dda7e3adda277b0d116075c89c3886dc26e (diff)
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.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/bucketdbupdater.cpp12
1 files changed, 11 insertions, 1 deletions
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());