mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Fixed error #4526
This commit is contained in:
parent
526e6488e0
commit
dbab34e21f
@ -29,6 +29,8 @@ MergeTreeReaderStream::MergeTreeReaderStream(
|
||||
size_t max_mark_range_bytes = 0;
|
||||
size_t sum_mark_range_bytes = 0;
|
||||
|
||||
/// Care should be taken to not load marks when the part is empty (marks_count == 0).
|
||||
|
||||
for (const auto & mark_range : all_mark_ranges)
|
||||
{
|
||||
size_t left_mark = mark_range.begin;
|
||||
@ -54,7 +56,7 @@ MergeTreeReaderStream::MergeTreeReaderStream(
|
||||
|| (right_mark + 1 == marks_count
|
||||
&& getMark(right_mark).offset_in_compressed_file == getMark(mark_range.end).offset_in_compressed_file))
|
||||
{
|
||||
mark_range_bytes = file_size - getMark(left_mark).offset_in_compressed_file;
|
||||
mark_range_bytes = file_size - (left_mark < marks_count ? getMark(left_mark).offset_in_compressed_file : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -119,8 +121,8 @@ void MergeTreeReaderStream::loadMarks()
|
||||
size_t expected_file_size = sizeof(MarkInCompressedFile) * marks_count;
|
||||
if (expected_file_size != file_size)
|
||||
throw Exception(
|
||||
"bad size of marks file `" + mrk_path + "':" + std::to_string(file_size) + ", must be: " + std::to_string(expected_file_size),
|
||||
ErrorCodes::CORRUPTED_DATA);
|
||||
"Bad size of marks file '" + mrk_path + "': " + std::to_string(file_size) + ", must be: " + std::to_string(expected_file_size),
|
||||
ErrorCodes::CORRUPTED_DATA);
|
||||
|
||||
auto res = std::make_shared<MarksInCompressedFile>(marks_count);
|
||||
|
||||
|
@ -23,9 +23,16 @@ MergeTreeSequentialBlockInputStream::MergeTreeSequentialBlockInputStream(
|
||||
, mark_cache(storage.global_context.getMarkCache())
|
||||
{
|
||||
if (!quiet)
|
||||
LOG_TRACE(log, "Reading " << data_part->marks_count << " marks from part " << data_part->name
|
||||
{
|
||||
std::stringstream message;
|
||||
message << "Reading " << data_part->marks_count << " marks from part " << data_part->name
|
||||
<< ", totaly " << data_part->rows_count
|
||||
<< " rows starting from the beginning of the part");
|
||||
<< " rows starting from the beginning of the part, columns: ";
|
||||
for (size_t i = 0, size = columns_to_read.size(); i < size; ++i)
|
||||
message << (i == 0 ? "" : ", ") << columns_to_read[i];
|
||||
|
||||
LOG_TRACE(log, message.rdbuf());
|
||||
}
|
||||
|
||||
addTotalRowsApprox(data_part->rows_count);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user