Lowered max_delay_to_insert to one second, because higher values are non practical and could be harmful for usual failover logic in client apps [#CLICKHOUSE-3091].

This commit is contained in:
Alexey Milovidov 2017-06-22 19:17:01 +03:00
parent 941c281221
commit c96719685c
2 changed files with 6 additions and 6 deletions

View File

@ -1487,20 +1487,20 @@ void MergeTreeData::delayInsertIfNeeded(Poco::Event * until)
const size_t max_k = settings.parts_to_throw_insert - settings.parts_to_delay_insert; /// always > 0
const size_t k = 1 + parts_count - settings.parts_to_delay_insert; /// from 1 to max_k
const double delay_sec = ::pow(settings.max_delay_to_insert, static_cast<double>(k) / max_k);
const double delay_milliseconds = ::pow(settings.max_delay_to_insert * 1000, static_cast<double>(k) / max_k);
ProfileEvents::increment(ProfileEvents::DelayedInserts);
ProfileEvents::increment(ProfileEvents::DelayedInsertsMilliseconds, delay_sec * 1000);
ProfileEvents::increment(ProfileEvents::DelayedInsertsMilliseconds, delay_milliseconds);
CurrentMetrics::Increment metric_increment(CurrentMetrics::DelayedInserts);
LOG_INFO(log, "Delaying inserting block by "
<< std::fixed << std::setprecision(4) << delay_sec << " sec. because there are " << parts_count << " parts");
<< std::fixed << std::setprecision(4) << delay_milliseconds << " ms. because there are " << parts_count << " parts");
if (until)
until->tryWait(delay_sec * 1000);
until->tryWait(delay_milliseconds);
else
std::this_thread::sleep_for(std::chrono::duration<double>(delay_sec));
std::this_thread::sleep_for(std::chrono::duration<std::chrono::milliseconds>(delay_milliseconds));
}
MergeTreeData::DataPartPtr MergeTreeData::getActiveContainingPart(const String & part_name)

View File

@ -48,7 +48,7 @@ struct MergeTreeSettings
size_t parts_to_throw_insert = 300;
/// Max delay of inserting data into MergeTree table in seconds, if there are a lot of unmerged parts.
size_t max_delay_to_insert = 200;
size_t max_delay_to_insert = 1;
/** Replication settings. */