未验证 提交 258170b3 编写于 作者: F filimonov 提交者: Mikhail Filimonov

Update ReplicatedMergeTreeMergeStrategyPicker.cpp

上级 234c671e
...@@ -91,13 +91,6 @@ void ReplicatedMergeTreeMergeStrategyPicker::refreshState() ...@@ -91,13 +91,6 @@ void ReplicatedMergeTreeMergeStrategyPicker::refreshState()
{ {
auto threshold = storage.getSettings()->execute_merges_on_single_replica_time_threshold.totalSeconds(); auto threshold = storage.getSettings()->execute_merges_on_single_replica_time_threshold.totalSeconds();
auto now = time(nullptr);
/// the setting is not changed, and last state refresh was done recently
if (threshold == execute_merges_on_single_replica_time_threshold
&& now - last_refresh_time < REFRESH_STATE_MINIMUM_INTERVAL_SECONDS)
return;
if (threshold == 0) if (threshold == 0)
{ {
/// we can reset the settings w/o lock (it's atomic) /// we can reset the settings w/o lock (it's atomic)
...@@ -105,6 +98,13 @@ void ReplicatedMergeTreeMergeStrategyPicker::refreshState() ...@@ -105,6 +98,13 @@ void ReplicatedMergeTreeMergeStrategyPicker::refreshState()
return; return;
} }
auto now = time(nullptr);
/// the setting was already enabled, and last state refresh was done recently
if (execute_merges_on_single_replica_time_threshold != 0
&& now - last_refresh_time < REFRESH_STATE_MINIMUM_INTERVAL_SECONDS)
return;
auto zookeeper = storage.getZooKeeper(); auto zookeeper = storage.getZooKeeper();
auto all_replicas = zookeeper->getChildren(storage.zookeeper_path + "/replicas"); auto all_replicas = zookeeper->getChildren(storage.zookeeper_path + "/replicas");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册