Minor fixes

This commit is contained in:
Igor Mineev 2019-05-15 19:49:55 +03:00
parent 7b0ddd5b73
commit f74b7331f5
3 changed files with 11 additions and 6 deletions

View File

@ -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<MergeTreeData::DataPart>(data,
reservation->getDisk(), part_name);
MergeTreeData::MutableDataPartPtr new_data_part = std::make_shared<MergeTreeData::DataPart>(data, reservation->getDisk(), part_name);
new_data_part->relative_path = relative_part_path;
new_data_part->is_temp = true;

View File

@ -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;

View File

@ -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<const Disk>(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<UInt64>::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