2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS replicated_truncate1;
|
|
|
|
DROP TABLE IF EXISTS replicated_truncate2;
|
2018-04-21 00:35:20 +00:00
|
|
|
|
2020-08-26 17:45:20 +00:00
|
|
|
CREATE TABLE replicated_truncate1 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test_00623/truncate', 'r1', d, k, 8192);
|
|
|
|
CREATE TABLE replicated_truncate2 (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree('/clickhouse/tables/test_00623/truncate', 'r2', d, k, 8192);
|
2018-04-21 00:35:20 +00:00
|
|
|
|
|
|
|
SELECT '======Before Truncate======';
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO replicated_truncate1 VALUES ('2015-01-01', 10, 42);
|
2018-04-21 00:35:20 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SYSTEM SYNC REPLICA replicated_truncate2;
|
2018-06-09 18:17:27 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM replicated_truncate1 ORDER BY k;
|
|
|
|
SELECT * FROM replicated_truncate2 ORDER BY k;
|
2018-04-21 00:35:20 +00:00
|
|
|
|
|
|
|
SELECT '======After Truncate And Empty======';
|
2019-04-16 14:13:13 +00:00
|
|
|
TRUNCATE TABLE replicated_truncate1;
|
2018-06-09 18:17:27 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM replicated_truncate1 ORDER BY k;
|
|
|
|
SELECT * FROM replicated_truncate2 ORDER BY k;
|
2018-04-21 00:35:20 +00:00
|
|
|
|
|
|
|
SELECT '======After Truncate And Insert Data======';
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO replicated_truncate1 VALUES ('2015-01-01', 10, 42);
|
2018-06-09 18:17:27 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SYSTEM SYNC REPLICA replicated_truncate2;
|
2018-06-09 18:17:27 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM replicated_truncate1 ORDER BY k;
|
|
|
|
SELECT * FROM replicated_truncate2 ORDER BY k;
|
2018-04-21 00:35:20 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS replicated_truncate1;
|
|
|
|
DROP TABLE IF EXISTS replicated_truncate2;
|