Merge pull request #7558 from excitoon/patch-1

Made mutation to choose the same disk in `ReplicatedMergeTree`.
This commit is contained in:
alesapin 2019-11-01 13:52:45 +03:00 committed by GitHub
commit 6ef0a92535
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1139,7 +1139,8 @@ bool StorageReplicatedMergeTree::tryExecutePartMutation(const StorageReplicatedM
MutationCommands commands = queue.getMutationCommands(source_part, new_part_info.mutation); MutationCommands commands = queue.getMutationCommands(source_part, new_part_info.mutation);
/// Can throw an exception. /// Can throw an exception.
DiskSpace::ReservationPtr reserved_space = reserveSpace(estimated_space_for_result); /// Once we mutate part, we must reserve space on the same disk, because mutations can possibly create hardlinks.
DiskSpace::ReservationPtr reserved_space = source_part->disk->reserve(estimated_space_for_result);
auto table_lock = lockStructureForShare(false, RWLockImpl::NO_QUERY); auto table_lock = lockStructureForShare(false, RWLockImpl::NO_QUERY);