mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Updated to clear current_row_sources when cleanedup rows are added
This commit is contained in:
parent
8ef910e1fa
commit
142a4631f1
@ -28,7 +28,6 @@ ReplacingSortedAlgorithm::ReplacingSortedAlgorithm(
|
||||
, cleanup(cleanup_)
|
||||
, cleanedup_rows_count(cleanedup_rows_count_)
|
||||
{
|
||||
|
||||
if (!is_deleted_column.empty())
|
||||
is_deleted_column_number = header_.getPositionByName(is_deleted_column);
|
||||
if (!version_column.empty())
|
||||
@ -84,7 +83,10 @@ IMergingAlgorithm::Status ReplacingSortedAlgorithm::merge()
|
||||
if (!cleanup || !value)
|
||||
insertRow();
|
||||
else if (cleanup && cleanedup_rows_count != nullptr)
|
||||
{
|
||||
*cleanedup_rows_count += current_row_sources.size();
|
||||
current_row_sources.resize(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
insertRow();
|
||||
@ -142,7 +144,10 @@ IMergingAlgorithm::Status ReplacingSortedAlgorithm::merge()
|
||||
if (!cleanup || !value)
|
||||
insertRow();
|
||||
else if (cleanup && cleanedup_rows_count != nullptr)
|
||||
{
|
||||
*cleanedup_rows_count += current_row_sources.size();
|
||||
current_row_sources.resize(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
insertRow();
|
||||
|
@ -7,7 +7,7 @@ create table tab_00577 (date Date, version UInt64, val UInt64) engine = Replacin
|
||||
insert into tab_00577 values ('2018-01-01', 2, 2), ('2018-01-01', 1, 1);
|
||||
insert into tab_00577 values ('2018-01-01', 0, 0);
|
||||
select * from tab_00577 order by version;
|
||||
OPTIMIZE TABLE tab_00577;
|
||||
OPTIMIZE TABLE tab_00577 FINAL CLEANUP;
|
||||
select * from tab_00577;
|
||||
drop table tab_00577;
|
||||
|
||||
@ -15,7 +15,8 @@ drop table tab_00577;
|
||||
DROP TABLE IF EXISTS testCleanupR1;
|
||||
CREATE TABLE testCleanupR1 (uid String, version UInt32, is_deleted UInt8)
|
||||
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/{database}/tables/test_cleanup/', 'r1', version, is_deleted)
|
||||
ORDER BY uid SETTINGS enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 1, vertical_merge_algorithm_min_columns_to_activate = 0;
|
||||
ORDER BY uid SETTINGS enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 0, vertical_merge_algorithm_min_columns_to_activate = 0, min_rows_for_wide_part = 0,
|
||||
min_bytes_for_wide_part = 0;
|
||||
INSERT INTO testCleanupR1 (*) VALUES ('d1', 1, 0),('d2', 1, 0),('d3', 1, 0),('d4', 1, 0);
|
||||
INSERT INTO testCleanupR1 (*) VALUES ('d3', 2, 1);
|
||||
INSERT INTO testCleanupR1 (*) VALUES ('d1', 2, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user