From f74b7331f5cfa298d73ebf920a65165ce69d59db Mon Sep 17 00:00:00 2001 From: Igor Mineev Date: Wed, 15 May 2019 19:49:55 +0300 Subject: [PATCH] Minor fixes --- dbms/src/Storages/MergeTree/DataPartsExchange.cpp | 9 ++++----- dbms/src/Storages/MergeTree/DataPartsExchange.h | 2 +- dbms/src/Storages/MergeTree/DiskSpaceMonitor.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dbms/src/Storages/MergeTree/DataPartsExchange.cpp b/dbms/src/Storages/MergeTree/DataPartsExchange.cpp index 03868d285e6..96db155b014 100644 --- a/dbms/src/Storages/MergeTree/DataPartsExchange.cpp +++ b/dbms/src/Storages/MergeTree/DataPartsExchange.cpp @@ -230,7 +230,7 @@ MergeTreeData::MutableDataPartPtr Fetcher::fetchPart( protocol_error = false; auto reservation = data.reserveSpaceForPart(sum_files_size); - return downloadPart(part_name, replica_path, to_detached, tmp_prefix_, reservation, in); + return downloadPart(part_name, replica_path, to_detached, tmp_prefix_, std::move(reservation), in); } catch (...) ///@TODO_IGR catch exception { @@ -264,7 +264,7 @@ MergeTreeData::MutableDataPartPtr Fetcher::fetchPart( /// We don't know real size of part auto reservation = data.reserveOnMaxDiskWithoutReservation(); - return downloadPart(part_name, replica_path, to_detached, tmp_prefix_, reservation, in); + return downloadPart(part_name, replica_path, to_detached, tmp_prefix_, std::move(reservation), in); } MergeTreeData::MutableDataPartPtr Fetcher::downloadPart( @@ -272,7 +272,7 @@ MergeTreeData::MutableDataPartPtr Fetcher::downloadPart( const String & replica_path, bool to_detached, const String & tmp_prefix_, - const DiskSpaceMonitor::ReservationPtr & reservation, + const DiskSpaceMonitor::ReservationPtr reservation, PooledReadWriteBufferFromHTTP & in) { @@ -296,8 +296,7 @@ MergeTreeData::MutableDataPartPtr Fetcher::downloadPart( part_file.createDirectory(); - MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, - reservation->getDisk(), part_name); + MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared(data, reservation->getDisk(), part_name); new_data_part->relative_path = relative_part_path; new_data_part->is_temp = true; diff --git a/dbms/src/Storages/MergeTree/DataPartsExchange.h b/dbms/src/Storages/MergeTree/DataPartsExchange.h index c0c36cf8c37..e8d028d9dd6 100644 --- a/dbms/src/Storages/MergeTree/DataPartsExchange.h +++ b/dbms/src/Storages/MergeTree/DataPartsExchange.h @@ -70,7 +70,7 @@ private: const String & replica_path, bool to_detached, const String & tmp_prefix_, - const DiskSpaceMonitor::ReservationPtr & reservation, + const DiskSpaceMonitor::ReservationPtr reservation, PooledReadWriteBufferFromHTTP & in); MergeTreeData & data; diff --git a/dbms/src/Storages/MergeTree/DiskSpaceMonitor.cpp b/dbms/src/Storages/MergeTree/DiskSpaceMonitor.cpp index 3c1e7c42968..c897d370a49 100644 --- a/dbms/src/Storages/MergeTree/DiskSpaceMonitor.cpp +++ b/dbms/src/Storages/MergeTree/DiskSpaceMonitor.cpp @@ -38,6 +38,8 @@ DiskSelector::DiskSelector(const Poco::Util::AbstractConfiguration & config, con { if (path.empty()) throw Exception("Disk path can not be empty. Disk " + disk_name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); + if (path.back() != '/') + throw Exception("Disk path must end with /. Disk " + disk_name, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG); disks.emplace(disk_name, std::make_shared(disk_name, path, keep_free_space_bytes)); } } @@ -120,6 +122,10 @@ Schema::Volume::Volume(const Poco::Util::AbstractConfiguration & config, const s { max_data_part_size = std::numeric_limits::max(); } + constexpr UInt64 SIZE_8MB = 1ull << 23; + if (max_data_part_size < SIZE_8MB) { + LOG_WARNING(logger, "Volume max_data_part_size is too low (" << max_data_part_size << " < " << SIZE_8MB << ")"); + } } DiskSpaceMonitor::ReservationPtr Schema::Volume::reserve(UInt64 expected_size) const