Fixed error when parts of unlimited total size could be selected for merge in case of low free disk space [#CLICKHOUSE-2895].

This commit is contained in:
Alexey Milovidov 2017-03-20 23:29:12 +03:00
parent d98c95ddcd
commit d3ae1267eb
2 changed files with 10 additions and 5 deletions

View File

@ -319,7 +319,9 @@ bool StorageMergeTree::merge(
if (partition.empty())
{
selected = merger.selectPartsToMerge(parts, merged_name, aggressive, merger.getMaxPartsSizeForMerge(), can_merge);
size_t max_parts_size_for_merge = merger.getMaxPartsSizeForMerge();
if (max_parts_size_for_merge > 0)
selected = merger.selectPartsToMerge(parts, merged_name, aggressive, max_parts_size_for_merge, can_merge);
}
else
{

View File

@ -1760,10 +1760,13 @@ void StorageReplicatedMergeTree::mergeSelectingThread()
MergeTreeData::DataPartsVector parts;
String merged_name;
if (merger.selectPartsToMerge(
parts, merged_name, false,
merger.getMaxPartsSizeForMerge(data.settings.max_replicated_merges_in_queue, merges_queued),
can_merge)
size_t max_parts_size_for_merge = merger.getMaxPartsSizeForMerge(data.settings.max_replicated_merges_in_queue, merges_queued);
if (max_parts_size_for_merge > 0
&& merger.selectPartsToMerge(
parts, merged_name, false,
max_parts_size_for_merge,
can_merge)
&& createLogEntryToMergeParts(parts, merged_name))
{
success = true;