-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9048 from ClickHouse/fix_mutation_order
Fix primary.idx corruption after delete mutation
- Loading branch information
Showing
5 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
dbms/tests/queries/0_stateless/01077_mutations_index_consistency.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
43200 | ||
0 | ||
43200 | ||
43200 |
60 changes: 60 additions & 0 deletions
60
dbms/tests/queries/0_stateless/01077_mutations_index_consistency.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
. $CURDIR/../shell_config.sh | ||
|
||
|
||
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS movement" | ||
|
||
$CLICKHOUSE_CLIENT -n --query "CREATE TABLE movement (date DateTime('Europe/Moscow')) Engine = MergeTree ORDER BY (toStartOfHour(date));" | ||
|
||
$CLICKHOUSE_CLIENT --query "insert into movement select toDateTime('2020-01-22 00:00:00') + number%(23*3600) from numbers(1000000);" | ||
|
||
$CLICKHOUSE_CLIENT --query "OPTIMIZE TABLE movement FINAL" | ||
|
||
$CLICKHOUSE_CLIENT -n --query " | ||
SELECT | ||
count(), | ||
toStartOfHour(date) AS Hour | ||
FROM movement | ||
WHERE (date >= toDateTime('2020-01-22T10:00:00')) AND (date <= toDateTime('2020-01-22T23:00:00')) | ||
GROUP BY Hour | ||
ORDER BY Hour DESC | ||
" | grep "16:00:00" | cut -f1 | ||
|
||
|
||
$CLICKHOUSE_CLIENT --query "alter table movement delete where date >= toDateTime('2020-01-22T16:00:00') and date < toDateTime('2020-01-22T17:00:00') SETTINGS mutations_sync = 2" | ||
|
||
$CLICKHOUSE_CLIENT -n --query " | ||
SELECT | ||
count(), | ||
toStartOfHour(date) AS Hour | ||
FROM movement | ||
WHERE (date >= toDateTime('2020-01-22T10:00:00')) AND (date <= toDateTime('2020-01-22T23:00:00')) | ||
GROUP BY Hour | ||
ORDER BY Hour DESC | ||
" | grep "16:00:00" | wc -l | ||
|
||
|
||
$CLICKHOUSE_CLIENT -n --query " | ||
SELECT | ||
count(), | ||
toStartOfHour(date) AS Hour | ||
FROM movement | ||
WHERE (date >= toDateTime('2020-01-22T10:00:00')) AND (date <= toDateTime('2020-01-22T23:00:00')) | ||
GROUP BY Hour | ||
ORDER BY Hour DESC | ||
" | grep "22:00:00" | cut -f1 | ||
|
||
|
||
$CLICKHOUSE_CLIENT -n --query " | ||
SELECT | ||
count(), | ||
toStartOfHour(date) AS Hour | ||
FROM movement | ||
GROUP BY Hour | ||
ORDER BY Hour DESC | ||
" | grep "22:00:00" | cut -f1 | ||
|
||
|
||
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS movement" |