mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
Fix processing very large entries in queue
This commit is contained in:
parent
a2d888f19f
commit
22a89fca01
@ -57,6 +57,7 @@ bool ReplicatedMergeTreeQueue::isVirtualPart(const MergeTreeData::DataPartPtr &
|
||||
return virtual_parts.getContainingPart(data_part->info) != data_part->name;
|
||||
}
|
||||
|
||||
|
||||
bool ReplicatedMergeTreeQueue::load(zkutil::ZooKeeperPtr zookeeper)
|
||||
{
|
||||
auto queue_path = replica_path + "/queue";
|
||||
@ -68,6 +69,9 @@ bool ReplicatedMergeTreeQueue::load(zkutil::ZooKeeperPtr zookeeper)
|
||||
{
|
||||
std::lock_guard pull_logs_lock(pull_logs_to_queue_mutex);
|
||||
|
||||
/// Reset batch size on initialization to recover from possible errors of too large batch size.
|
||||
current_multi_batch_size = 1;
|
||||
|
||||
String log_pointer_str = zookeeper->get(replica_path + "/log_pointer");
|
||||
log_pointer = log_pointer_str.empty() ? 0 : parse<UInt64>(log_pointer_str);
|
||||
|
||||
@ -496,7 +500,7 @@ int32_t ReplicatedMergeTreeQueue::pullLogsToQueue(zkutil::ZooKeeperPtr zookeeper
|
||||
|
||||
/// Increase the batch size exponentially, so it will saturate to MAX_MULTI_OPS.
|
||||
if (current_multi_batch_size < MAX_MULTI_OPS)
|
||||
current_multi_batch_size = std::min(MAX_MULTI_OPS, current_multi_batch_size * 2);
|
||||
current_multi_batch_size = std::min<size_t>(MAX_MULTI_OPS, current_multi_batch_size * 2);
|
||||
|
||||
String last_entry = *last;
|
||||
if (!startsWith(last_entry, "log-"))
|
||||
|
@ -263,7 +263,7 @@ private:
|
||||
/// If the limit is exceeded, the connection is simply closed.
|
||||
/// The constant is selected with a margin. The default limit in ZK is 1 MB of data in total.
|
||||
/// The average size of the node value in this case is less than 10 kilobytes.
|
||||
static constexpr auto MAX_MULTI_OPS = 100;
|
||||
static constexpr size_t MAX_MULTI_OPS = 100;
|
||||
|
||||
/// Very large queue entries may appear occasionally.
|
||||
/// We cannot process MAX_MULTI_OPS at once because it will fail.
|
||||
|
Loading…
Reference in New Issue
Block a user