Merge pull request #20279 from ClickHouse/relax_check_in_data_writer

Relax check in data writer for non adaptive tables
This commit is contained in:
alesapin 2021-02-11 10:57:07 +03:00 committed by GitHub
commit 121c5c9605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 2 deletions

View File

@ -140,7 +140,7 @@ void MergeTreeDataPartWriterWide::shiftCurrentMark(const Granules & granules_wri
/// If we didn't finished last granule than we will continue to write it from new block
if (!last_granule.is_complete)
{
if (settings.blocks_are_granules_size)
if (settings.can_use_adaptive_granularity && settings.blocks_are_granules_size)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Incomplete granules are not allowed while blocks are granules size. "
"Mark number {} (rows {}), rows written in last mark {}, rows to write in last mark from block {} (from row {}), total marks currently {}",
last_granule.mark_number, index_granularity.getMarkRows(last_granule.mark_number), rows_written_in_last_mark,
@ -506,7 +506,7 @@ void MergeTreeDataPartWriterWide::finishDataSerialization(IMergeTreeDataPart::Ch
WrittenOffsetColumns offset_columns;
if (rows_written_in_last_mark > 0)
{
if (settings.blocks_are_granules_size)
if (settings.can_use_adaptive_granularity && settings.blocks_are_granules_size)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Incomplete granule is not allowed while blocks are granules size even for last granule. "
"Mark number {} (rows {}), rows written for last mark {}, total marks {}",
getCurrentMark(), index_granularity.getMarkRows(getCurrentMark()), rows_written_in_last_mark, index_granularity.getMarksCount());

View File

@ -0,0 +1,6 @@
1 1
2 2
1 1
2 2
1 1
2 2

View File

@ -0,0 +1,30 @@
DROP TABLE IF EXISTS old_school_table;
CREATE TABLE old_school_table
(
key UInt64,
value String
)
ENGINE = MergeTree()
ORDER BY key
SETTINGS index_granularity_bytes = 0, enable_mixed_granularity_parts = 0, min_bytes_for_wide_part = 0,
vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 1;
INSERT INTO old_school_table VALUES (1, '1');
INSERT INTO old_school_table VALUES (2, '2');
OPTIMIZE TABLE old_school_table FINAL;
SELECT * FROM old_school_table ORDER BY key;
OPTIMIZE TABLE old_school_table FINAL; -- just to be sure
SELECT * FROM old_school_table ORDER BY key;
ALTER TABLE old_school_table MODIFY SETTING vertical_merge_algorithm_min_rows_to_activate = 10000, vertical_merge_algorithm_min_columns_to_activate = 10000;
OPTIMIZE TABLE old_school_table FINAL; -- and horizontal merge
SELECT * FROM old_school_table ORDER BY key;
DROP TABLE IF EXISTS old_school_table;