-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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 #63600 from ClickHouse/cherrypick/23.8/e2756e02c2e…
…d1147fb21f5a2594524df9f9b437e Cherry pick #63426 to 23.8: Fix backup/restore of projection part in case projection was removed from table metadata, but part still has projection
- Loading branch information
Showing
7 changed files
with
120 additions
and
12 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
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
7 changes: 7 additions & 0 deletions
7
tests/queries/0_stateless/03145_non_loaded_projection_backup.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,7 @@ | ||
7 | ||
Found unexpected projection directories: pp.proj | ||
BACKUP_CREATED | ||
RESTORED | ||
7 | ||
Found unexpected projection directories: pp.proj | ||
0 |
53 changes: 53 additions & 0 deletions
53
tests/queries/0_stateless/03145_non_loaded_projection_backup.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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
# shellcheck source=../shell_config.sh | ||
. "$CURDIR"/../shell_config.sh | ||
|
||
$CLICKHOUSE_CLIENT -nm -q " | ||
drop table if exists tp_1; | ||
create table tp_1 (x Int32, y Int32, projection p (select x, y order by x)) engine = MergeTree order by y partition by intDiv(y, 100); | ||
system stop merges tp_1; | ||
insert into tp_1 select number, number from numbers(3); | ||
set mutations_sync = 2; | ||
alter table tp_1 add projection pp (select x, count() group by x); | ||
insert into tp_1 select number, number from numbers(4); | ||
select count() from tp_1; | ||
-- Here we have a part with written projection pp | ||
alter table tp_1 detach partition '0'; | ||
-- Move part to detached | ||
alter table tp_1 clear projection pp; | ||
-- Remove projection from table metadata | ||
alter table tp_1 drop projection pp; | ||
-- Now, we don't load projection pp for attached part, but it is written on disk | ||
alter table tp_1 attach partition '0'; | ||
" | ||
|
||
$CLICKHOUSE_CLIENT -nm -q " | ||
set send_logs_level='fatal'; | ||
check table tp_1 settings check_query_single_value_result = 0;" | grep -o "Found unexpected projection directories: pp.proj" | ||
|
||
backup_id="$CLICKHOUSE_TEST_UNIQUE_NAME" | ||
$CLICKHOUSE_CLIENT -q " | ||
backup table tp_1 to Disk('backups', '$backup_id'); | ||
" | grep -o "BACKUP_CREATED" | ||
|
||
$CLICKHOUSE_CLIENT -nm -q " | ||
set send_logs_level='fatal'; | ||
drop table tp_1; | ||
restore table tp_1 from Disk('backups', '$backup_id'); | ||
" | grep -o "RESTORED" | ||
|
||
$CLICKHOUSE_CLIENT -q "select count() from tp_1;" | ||
$CLICKHOUSE_CLIENT -nm -q " | ||
set send_logs_level='fatal'; | ||
check table tp_1 settings check_query_single_value_result = 0;" | grep -o "Found unexpected projection directories: pp.proj" | ||
$CLICKHOUSE_CLIENT -nm -q " | ||
set send_logs_level='fatal'; | ||
check table tp_1" | ||
$CLICKHOUSE_CLIENT -nm -q " | ||
set send_logs_level='fatal'; | ||
drop table tp_1" |