Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I hate REPLACE_RANGE and actual_part_name
- Loading branch information
Showing
4 changed files
with
94 additions
and
21 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
8 changes: 8 additions & 0 deletions
8
tests/queries/0_stateless/02916_move_partition_inactive_replica.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,8 @@ | ||
all_0_0_0 0 | ||
all_0_1_1 1 | ||
all_1_1_0 0 | ||
all_2_2_0 0 | ||
all_2_3_1 1 | ||
all_3_3_0 0 | ||
0 | ||
40 1580 |
46 changes: 46 additions & 0 deletions
46
tests/queries/0_stateless/02916_move_partition_inactive_replica.sql
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,46 @@ | ||
-- Tags: no-parallel | ||
|
||
create database if not exists shard_0; | ||
create database if not exists shard_1; | ||
|
||
drop table if exists shard_0.from_1; | ||
drop table if exists shard_1.from_1; | ||
drop table if exists shard_0.to; | ||
drop table if exists shard_1.to; | ||
|
||
create table shard_0.from_1 (x UInt32) engine = ReplicatedMergeTree('/clickhouse/tables/from_1_' || currentDatabase(), '0') order by x settings old_parts_lifetime=1, max_cleanup_delay_period=1, cleanup_delay_period=1; | ||
create table shard_1.from_1 (x UInt32) engine = ReplicatedMergeTree('/clickhouse/tables/from_1_' || currentDatabase(), '1') order by x settings old_parts_lifetime=1, max_cleanup_delay_period=1, cleanup_delay_period=1; | ||
|
||
system stop merges shard_0.from_1; | ||
insert into shard_0.from_1 select number + 20 from numbers(10); | ||
insert into shard_0.from_1 select number + 30 from numbers(10); | ||
|
||
insert into shard_0.from_1 select number + 40 from numbers(10); | ||
insert into shard_0.from_1 select number + 50 from numbers(10); | ||
|
||
system sync replica shard_1.from_1; | ||
|
||
create table shard_0.to (x UInt32) engine = ReplicatedMergeTree('/clickhouse/tables/to_' || currentDatabase(), '0') order by x settings old_parts_lifetime=1, max_cleanup_delay_period=1, cleanup_delay_period=1, max_parts_to_merge_at_once=2; | ||
|
||
create table shard_1.to (x UInt32) engine = ReplicatedMergeTree('/clickhouse/tables/to_' || currentDatabase(), '1') order by x settings old_parts_lifetime=1, max_cleanup_delay_period=1, cleanup_delay_period=1, max_parts_to_merge_at_once=2; | ||
|
||
detach table shard_1.to; | ||
|
||
alter table shard_0.from_1 on cluster test_cluster_two_shards_different_databases move partition tuple() to table shard_0.to format Null settings distributed_ddl_output_mode='never_throw', distributed_ddl_task_timeout = 1; | ||
|
||
drop table if exists shard_0.from_1; | ||
drop table if exists shard_1.from_1; | ||
OPTIMIZE TABLE shard_0.to; | ||
OPTIMIZE TABLE shard_0.to; | ||
select name, active from system.parts where database='shard_0' and table='to' order by name; | ||
|
||
system restart replica shard_0.to; | ||
|
||
select sleep(3); | ||
|
||
attach table shard_1.to; | ||
system sync replica shard_1.to; | ||
select count(), sum(x) from shard_1.to; | ||
|
||
drop table if exists shard_0.to; | ||
drop table if exists shard_1.to; |