Merge pull request #17410 from ClickHouse/test_mutation_for_empty_partitions

Add test for mutation with empty partition
This commit is contained in:
alesapin 2020-11-26 16:42:43 +03:00 committed by GitHub
commit 90bddce5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,5 @@
10
10
10
24
CREATE TABLE default.replicated_mutations_empty_partitions\n(\n `key` UInt64,\n `value` UInt64\n)\nENGINE = ReplicatedMergeTree(\'/clickhouse/test/01586_replicated_mutations_empty_partitions\', \'1\')\nPARTITION BY key\nORDER BY key\nSETTINGS index_granularity = 8192

View File

@ -0,0 +1,32 @@
DROP TABLE IF EXISTS replicated_mutations_empty_partitions;
CREATE TABLE replicated_mutations_empty_partitions
(
key UInt64,
value String
)
ENGINE = ReplicatedMergeTree('/clickhouse/test/01586_replicated_mutations_empty_partitions', '1')
ORDER BY key
PARTITION by key;
INSERT INTO replicated_mutations_empty_partitions SELECT number, toString(number) FROM numbers(10);
SELECT count(distinct value) FROM replicated_mutations_empty_partitions;
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/01586_replicated_mutations_empty_partitions/block_numbers';
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '3';
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '4';
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '5';
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '9';
-- still ten records
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/01586_replicated_mutations_empty_partitions/block_numbers';
ALTER TABLE replicated_mutations_empty_partitions MODIFY COLUMN value UInt64 SETTINGS replication_alter_partitions_sync=2;
SELECT sum(value) FROM replicated_mutations_empty_partitions;
SHOW CREATE TABLE replicated_mutations_empty_partitions;
DROP TABLE IF EXISTS replicated_mutations_empty_partitions;