Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save den-crane/702e4c8a1162dae7c2edf48a7c2dd00d to your computer and use it in GitHub Desktop.
Save den-crane/702e4c8a1162dae7c2edf48a7c2dd00d to your computer and use it in GitHub Desktop.
system restore replica
CREATE TABLE test(A Int64)
ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/test', '{replica}')
ORDER BY tuple();
R1: insert into test values(1); detach table test;
R2: insert into test values(2); detach table test;
SYSTEM DROP REPLICA 'R1' FROM ZKPATH '/clickhouse/tables/test';
SYSTEM DROP REPLICA 'R2' FROM ZKPATH '/clickhouse/tables/test';
R1: attach table test; select count() from test;
--
1
R2: attach table test; select count() from test;
--
2
R1: system restore replica test;
R2: system restore replica test;
R1/R2: select count() from test;
--
1
R2: select name from system.detached_parts where table = 'test';
--
all_1_1_0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment