ClickHouse/tests/queries/0_stateless/02311_system_zookeeper_insert.sql

38 lines
1.9 KiB
MySQL
Raw Normal View History

2022-05-27 11:48:14 +00:00
-- Tags: zookeeper
2022-05-27 10:53:12 +00:00
set allow_unrestricted_reads_from_keeper = 'true';
drop table if exists test_zkinsert;
create table test_zkinsert (
name String,
path String,
value String
) ENGINE Memory;
2022-05-27 10:53:12 +00:00
-- test recursive create and big transaction
insert into test_zkinsert (name, path, value) values ('c', '/1-insert-testc/c/c/c/c/c/c', 11), ('e', '/1-insert-testc/c/c/d', 10), ('c', '/1-insert-testc/c/c/c/c/c/c/c', 10), ('c', '/1-insert-testc/c/c/c/c/c/c', 9), ('f', '/1-insert-testc/c/c/d', 11), ('g', '/1-insert-testc/c/c/d', 12), ('g', '/1-insert-testc/c/c/e', 13), ('g', '/1-insert-testc/c/c/f', 14), ('g', '/1-insert-testc/c/c/kk', 14);
2022-05-27 10:53:12 +00:00
-- insert same value, suppose to have no side effects
insert into system.zookeeper (name, path, value) SELECT name, '/' || currentDatabase() || path, value from test_zkinsert;
2022-05-27 16:53:07 +00:00
SELECT * FROM (SELECT path, name, value FROM system.zookeeper ORDER BY path, name) WHERE path LIKE '/' || currentDatabase() || '/1-insert-test%';
2022-05-27 10:53:12 +00:00
SELECT '-------------------------';
-- test inserting into root path
insert into test_zkinsert (name, path, value) values ('testc', '/2-insert-testx', 'x');
insert into test_zkinsert (name, path, value) values ('testz', '/2-insert-testx', 'y');
insert into test_zkinsert (name, path, value) values ('testc', '/2-insert-testz//c/cd/dd//', 'y');
insert into test_zkinsert (name, value, path) values ('testz', 'z', '/2-insert-testx');
insert into system.zookeeper (name, path, value) SELECT name, '/' || currentDatabase() || path, value from test_zkinsert;
2022-05-27 10:53:12 +00:00
SELECT * FROM (SELECT path, name, value FROM system.zookeeper ORDER BY path, name) WHERE path LIKE '/' || currentDatabase() || '/2-insert-test%';
2022-05-27 10:53:12 +00:00
-- test exceptions
insert into system.zookeeper (name, path, value) values ('a/b/c', '/', 'y'); -- { serverError 36 }
insert into system.zookeeper (name, path, value) values ('/', '/a/b/c', 'z'); -- { serverError 36 }
set allow_unrestricted_reads_from_keeper = 'false';
drop table if exists test_zkinsert;