mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-30 05:30:51 +00:00
wide parts validation with file opening via disk
This commit is contained in:
parent
e3a91f568e
commit
3f00f064af
@ -395,10 +395,10 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const String & name,
|
|||||||
|
|
||||||
auto disk = data_part->volume->getDisk();
|
auto disk = data_part->volume->getDisk();
|
||||||
String escaped_name = escapeForFileName(name);
|
String escaped_name = escapeForFileName(name);
|
||||||
String mrk_path = fullPath(disk, part_path + escaped_name + marks_file_extension);
|
String mrk_path = part_path + escaped_name + marks_file_extension;
|
||||||
String bin_path = fullPath(disk, part_path + escaped_name + DATA_FILE_EXTENSION);
|
String bin_path = part_path + escaped_name + DATA_FILE_EXTENSION;
|
||||||
DB::ReadBufferFromFile mrk_in(mrk_path);
|
auto mrk_in = disk->readFile(mrk_path);
|
||||||
DB::CompressedReadBufferFromFile bin_in(bin_path, 0, 0, 0, nullptr);
|
DB::CompressedReadBufferFromFile bin_in(disk->readFile(bin_path));
|
||||||
bool must_be_last = false;
|
bool must_be_last = false;
|
||||||
UInt64 offset_in_compressed_file = 0;
|
UInt64 offset_in_compressed_file = 0;
|
||||||
UInt64 offset_in_decompressed_block = 0;
|
UInt64 offset_in_decompressed_block = 0;
|
||||||
@ -407,15 +407,15 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const String & name,
|
|||||||
size_t mark_num;
|
size_t mark_num;
|
||||||
|
|
||||||
const auto & serialization = serializations[name];
|
const auto & serialization = serializations[name];
|
||||||
for (mark_num = 0; !mrk_in.eof(); ++mark_num)
|
for (mark_num = 0; !mrk_in->eof(); ++mark_num)
|
||||||
{
|
{
|
||||||
if (mark_num > index_granularity.getMarksCount())
|
if (mark_num > index_granularity.getMarksCount())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Incorrect number of marks in memory {}, on disk (at least) {}", index_granularity.getMarksCount(), mark_num + 1);
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Incorrect number of marks in memory {}, on disk (at least) {}", index_granularity.getMarksCount(), mark_num + 1);
|
||||||
|
|
||||||
DB::readBinary(offset_in_compressed_file, mrk_in);
|
DB::readBinary(offset_in_compressed_file, *mrk_in);
|
||||||
DB::readBinary(offset_in_decompressed_block, mrk_in);
|
DB::readBinary(offset_in_decompressed_block, *mrk_in);
|
||||||
if (settings.can_use_adaptive_granularity)
|
if (settings.can_use_adaptive_granularity)
|
||||||
DB::readBinary(index_granularity_rows, mrk_in);
|
DB::readBinary(index_granularity_rows, *mrk_in);
|
||||||
else
|
else
|
||||||
index_granularity_rows = data_part->index_granularity_info.fixed_index_granularity;
|
index_granularity_rows = data_part->index_granularity_info.fixed_index_granularity;
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const String & name,
|
|||||||
if (index_granularity_rows != 0)
|
if (index_granularity_rows != 0)
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "We ran out of binary data but still have non empty mark #{} with rows number {}", mark_num, index_granularity_rows);
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "We ran out of binary data but still have non empty mark #{} with rows number {}", mark_num, index_granularity_rows);
|
||||||
|
|
||||||
if (!mrk_in.eof())
|
if (!mrk_in->eof())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Mark #{} must be last, but we still have some to read", mark_num);
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Mark #{} must be last, but we still have some to read", mark_num);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -486,7 +486,7 @@ void MergeTreeDataPartWriterWide::validateColumnOfFixedSize(const String & name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mrk_in.eof())
|
if (!mrk_in->eof())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||||
"Still have something in marks stream, last mark #{} index granularity size {}, last rows {}", mark_num, index_granularity.getMarksCount(), index_granularity_rows);
|
"Still have something in marks stream, last mark #{} index granularity size {}, last rows {}", mark_num, index_granularity.getMarksCount(), index_granularity_rows);
|
||||||
if (!bin_in.eof())
|
if (!bin_in.eof())
|
||||||
|
Loading…
Reference in New Issue
Block a user