Preparation

This commit is contained in:
Alexey Milovidov 2024-10-20 23:08:22 +02:00
parent b03d055aab
commit 8f038e2e1c
2 changed files with 8 additions and 7 deletions

View File

@ -34,7 +34,7 @@ void MergeTreeDataPartWriterOnDisk::Stream<only_plain_file>::preFinalize()
/// Also the order is important
compressed_hashing.finalize();
compressor.finalize();
compressor->finalize();
plain_hashing.finalize();
if constexpr (!only_plain_file)
@ -92,8 +92,8 @@ MergeTreeDataPartWriterOnDisk::Stream<false>::Stream(
marks_file_extension{marks_file_extension_},
plain_file(data_part_storage->writeFile(data_path_ + data_file_extension, max_compress_block_size_, query_write_settings)),
plain_hashing(*plain_file),
compressor(plain_hashing, compression_codec_, max_compress_block_size_, query_write_settings.use_adaptive_write_buffer, query_write_settings.adaptive_write_buffer_initial_size),
compressed_hashing(compressor),
compressor(std::make_unique<CompressedWriteBuffer>(plain_hashing, compression_codec_, max_compress_block_size_, query_write_settings.use_adaptive_write_buffer, query_write_settings.adaptive_write_buffer_initial_size)),
compressed_hashing(*compressor),
marks_file(data_part_storage->writeFile(marks_path_ + marks_file_extension, 4096, query_write_settings)),
marks_hashing(*marks_file),
marks_compressor(marks_hashing, marks_compression_codec_, marks_compress_block_size_, query_write_settings.use_adaptive_write_buffer, query_write_settings.adaptive_write_buffer_initial_size),
@ -115,8 +115,8 @@ MergeTreeDataPartWriterOnDisk::Stream<true>::Stream(
data_file_extension{data_file_extension_},
plain_file(data_part_storage->writeFile(data_path_ + data_file_extension, max_compress_block_size_, query_write_settings)),
plain_hashing(*plain_file),
compressor(plain_hashing, compression_codec_, max_compress_block_size_, query_write_settings.use_adaptive_write_buffer, query_write_settings.adaptive_write_buffer_initial_size),
compressed_hashing(compressor),
compressor(std::make_unique<CompressedWriteBuffer>(plain_hashing, compression_codec_, max_compress_block_size_, query_write_settings.use_adaptive_write_buffer, query_write_settings.adaptive_write_buffer_initial_size)),
compressed_hashing(*compressor),
compress_marks(false)
{
}

View File

@ -44,7 +44,7 @@ public:
/// Helper class, which holds chain of buffers to write data file with marks.
/// It is used to write: one column, skip index or all columns (in compact format).
template<bool only_plain_file>
template <bool only_plain_file>
struct Stream
{
Stream(
@ -76,7 +76,8 @@ public:
/// compressed_hashing -> compressor -> plain_hashing -> plain_file
std::unique_ptr<WriteBufferFromFileBase> plain_file;
HashingWriteBuffer plain_hashing;
CompressedWriteBuffer compressor;
/// This could be either CompressedWriteBuffer or ParallelCompressedWriteBuffer
std::unique_ptr<WriteBuffer> compressor;
HashingWriteBuffer compressed_hashing;
/// marks_compressed_hashing -> marks_compressor -> marks_hashing -> marks_file