New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix primary.idx corruption after delete mutation #9048
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f3a3599
Fix primary.idx corruption after delete mutation
alesapin 1ada6e6
Missed change
alesapin dea937a
Don't use ORDER BY for empty key
alesapin 5a96eaf
Add missed locks for ReplicatedMergeTree alter
alesapin 2dca542
Correctly accuire lock
alesapin 19de74d
Remove redundant lock
alesapin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this check for, something like
order by tuple()
? Can we just remove this check and pass the order by always, or does it break something? Btw I found thatorder by tuple()
doesn't seem to work, becausetuple
requires at least one argument, butorder by 1
does.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we cannot order by
tuple()
and in this case we don't need order by at all.