mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
fix secondary indices corruption in compact parts
This commit is contained in:
parent
dcf94d08e9
commit
2280619ad0
@ -261,6 +261,11 @@ void MergeTreeDataPartWriterOnDisk::calculateAndSerializeSkipIndices(const Block
|
|||||||
{
|
{
|
||||||
limit = current_index_offset;
|
limit = current_index_offset;
|
||||||
}
|
}
|
||||||
|
else if (skip_index_current_data_mark == index_granularity.getMarksCount())
|
||||||
|
{
|
||||||
|
/// Case, when last granule was exceeded and no new granule was created.
|
||||||
|
limit = rows - prev_pos;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
limit = index_granularity.getMarkRows(skip_index_current_data_mark);
|
limit = index_granularity.getMarkRows(skip_index_current_data_mark);
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
20
|
12
tests/queries/0_stateless/01419_skip_index_compact_parts.sql
Normal file
12
tests/queries/0_stateless/01419_skip_index_compact_parts.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
DROP TABLE IF EXISTS index_compact;
|
||||||
|
|
||||||
|
CREATE TABLE index_compact(a UInt32, b UInt32, index i1 b type minmax granularity 1)
|
||||||
|
ENGINE = MergeTree ORDER BY a
|
||||||
|
SETTINGS min_rows_for_wide_part = 1000, index_granularity = 128, merge_max_block_size = 100;
|
||||||
|
|
||||||
|
INSERT INTO index_compact SELECT number, toString(number) FROM numbers(100);
|
||||||
|
INSERT INTO index_compact SELECT number, toString(number) FROM numbers(30);
|
||||||
|
|
||||||
|
OPTIMIZE TABLE index_compact FINAL;
|
||||||
|
|
||||||
|
SELECT count() FROM index_compact WHERE b < 10;
|
Loading…
Reference in New Issue
Block a user