mirror of https://github.com/citusdata/citus.git
Merge pull request #2962 from citusdata/fix-2958
Correctly add schema when distributing sequence definitonspull/2951/head
commit
6e4fbeb8b9
|
@ -206,7 +206,7 @@ pg_get_sequencedef_string(Oid sequenceRelationId)
|
|||
pgSequenceForm = pg_get_sequencedef(sequenceRelationId);
|
||||
|
||||
/* build our DDL command */
|
||||
qualifiedSequenceName = generate_relation_name(sequenceRelationId, NIL);
|
||||
qualifiedSequenceName = generate_qualified_relation_name(sequenceRelationId);
|
||||
|
||||
sequenceDef = psprintf(CREATE_SEQUENCE_COMMAND, qualifiedSequenceName,
|
||||
pgSequenceForm->seqincrement, pgSequenceForm->seqmin,
|
||||
|
|
|
@ -67,6 +67,10 @@ check-base-vg: all
|
|||
--valgrind --pg_ctl-timeout=360 --connection-timeout=500000 --valgrind-path=valgrind --valgrind-log-file=$(VALGRIND_LOG_FILE) \
|
||||
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/base_schedule $(EXTRA_TESTS)
|
||||
|
||||
check-base-mx: all
|
||||
$(pg_regress_multi_check) --load-extension=citus \
|
||||
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/mx_base_schedule $(EXTRA_TESTS)
|
||||
|
||||
check-empty: all
|
||||
$(pg_regress_multi_check) --load-extension=citus \
|
||||
-- $(MULTI_REGRESS_OPTS) $(EXTRA_TESTS)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
--
|
||||
-- Setup MX data syncing
|
||||
--
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
start_metadata_sync_to_node
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
start_metadata_sync_to_node
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
|
@ -31,7 +31,8 @@ INSERT INTO distributed_table VALUES (1, '1', 20);
|
|||
INSERT INTO second_distributed_table VALUES (1, '1');
|
||||
-- a simple test for
|
||||
CREATE TABLE collections_list (
|
||||
key int,
|
||||
key bigserial,
|
||||
ser bigserial,
|
||||
ts timestamptz,
|
||||
collection_id integer,
|
||||
value numeric,
|
||||
|
@ -44,7 +45,7 @@ SELECT create_distributed_table('collections_list', 'key');
|
|||
(1 row)
|
||||
|
||||
CREATE TABLE collections_list_0
|
||||
PARTITION OF collections_list (key, ts, collection_id, value)
|
||||
PARTITION OF collections_list (key, ser, ts, collection_id, value)
|
||||
FOR VALUES IN ( 0 );
|
||||
-- connection worker and get ready for the tests
|
||||
\c - - - :worker_1_port
|
||||
|
@ -1085,9 +1086,16 @@ LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_e
|
|||
LOG: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500)
|
||||
COMMIT;
|
||||
-- sanity check: local execution on partitions
|
||||
INSERT INTO collections_list (collection_id) VALUES (0) RETURNING *;
|
||||
LOG: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470011 (key, ser, collection_id) VALUES ('3940649673949185'::bigint, '3940649673949185'::bigint, 0) RETURNING key, ser, ts, collection_id, value
|
||||
key | ser | ts | collection_id | value
|
||||
------------------+------------------+----+---------------+-------
|
||||
3940649673949185 | 3940649673949185 | | 0 |
|
||||
(1 row)
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
||||
LOG: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, collection_id) VALUES (1, 0)
|
||||
LOG: executing the command locally: INSERT INTO local_shard_execution.collections_list_1470009 (key, ser, collection_id) VALUES ('1'::bigint, '3940649673949186'::bigint, 0)
|
||||
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
||||
LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_0_1470013 collections_list_0 WHERE (key OPERATOR(pg_catalog.=) 1)
|
||||
count
|
||||
|
@ -1100,9 +1108,18 @@ LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_e
|
|||
LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_1470011 collections_list WHERE true
|
||||
count
|
||||
-------
|
||||
1
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SELECT * FROM collections_list ORDER BY 1,2,3,4;
|
||||
LOG: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_1470009 collections_list WHERE true
|
||||
LOG: executing the command locally: SELECT key, ser, ts, collection_id, value FROM local_shard_execution.collections_list_1470011 collections_list WHERE true
|
||||
key | ser | ts | collection_id | value
|
||||
------------------+------------------+----+---------------+-------
|
||||
1 | 3940649673949186 | | 0 |
|
||||
3940649673949185 | 3940649673949185 | | 0 |
|
||||
(2 rows)
|
||||
|
||||
COMMIT;
|
||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
||||
-- one of them will be executed remotely, and the other is locally
|
||||
|
|
|
@ -31,21 +31,22 @@ INSERT INTO distributed_table VALUES (1, '1', 20);
|
|||
INSERT INTO second_distributed_table VALUES (1, '1');
|
||||
-- a simple test for
|
||||
CREATE TABLE collections_list (
|
||||
key int,
|
||||
key bigserial,
|
||||
ser bigserial,
|
||||
ts timestamptz,
|
||||
collection_id integer,
|
||||
value numeric,
|
||||
PRIMARY KEY(key, collection_id)
|
||||
) PARTITION BY LIST (collection_id );
|
||||
ERROR: primary key constraints are not supported on partitioned tables
|
||||
LINE 6: PRIMARY KEY(key, collection_id)
|
||||
LINE 7: PRIMARY KEY(key, collection_id)
|
||||
^
|
||||
SELECT create_distributed_table('collections_list', 'key');
|
||||
ERROR: relation "collections_list" does not exist
|
||||
LINE 1: SELECT create_distributed_table('collections_list', 'key');
|
||||
^
|
||||
CREATE TABLE collections_list_0
|
||||
PARTITION OF collections_list (key, ts, collection_id, value)
|
||||
PARTITION OF collections_list (key, ser, ts, collection_id, value)
|
||||
FOR VALUES IN ( 0 );
|
||||
ERROR: relation "collections_list" does not exist
|
||||
-- connection worker and get ready for the tests
|
||||
|
@ -1071,6 +1072,10 @@ LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_e
|
|||
LOG: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500)
|
||||
COMMIT;
|
||||
-- sanity check: local execution on partitions
|
||||
INSERT INTO collections_list (collection_id) VALUES (0) RETURNING *;
|
||||
ERROR: relation "collections_list" does not exist
|
||||
LINE 1: INSERT INTO collections_list (collection_id) VALUES (0) RETU...
|
||||
^
|
||||
BEGIN;
|
||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
||||
ERROR: relation "collections_list" does not exist
|
||||
|
@ -1079,6 +1084,8 @@ LINE 1: INSERT INTO collections_list (key, collection_id) VALUES (1,...
|
|||
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
SELECT count(*) FROM collections_list;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
SELECT * FROM collections_list ORDER BY 1,2,3,4;
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
COMMIT;
|
||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
||||
|
|
|
@ -64,7 +64,7 @@ SELECT unnest(master_metadata_snapshot()) order by 1;
|
|||
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('public.mx_test_table'::regclass, 'h', column_name_to_column('public.mx_test_table','col_1'), 0, 's')
|
||||
INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007)
|
||||
INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('public.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('public.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('public.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('public.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('public.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('public.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('public.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('public.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647')
|
||||
SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE')
|
||||
SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS public.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE')
|
||||
SELECT worker_create_truncate_trigger('public.mx_test_table')
|
||||
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
||||
TRUNCATE pg_dist_node CASCADE
|
||||
|
@ -85,7 +85,7 @@ SELECT unnest(master_metadata_snapshot()) order by 1;
|
|||
INSERT INTO pg_dist_partition (logicalrelid, partmethod, partkey, colocationid, repmodel) VALUES ('public.mx_test_table'::regclass, 'h', column_name_to_column('public.mx_test_table','col_1'), 0, 's')
|
||||
INSERT INTO pg_dist_placement (shardid, shardstate, shardlength, groupid, placementid) VALUES (1310000, 1, 0, 1, 100000),(1310001, 1, 0, 2, 100001),(1310002, 1, 0, 1, 100002),(1310003, 1, 0, 2, 100003),(1310004, 1, 0, 1, 100004),(1310005, 1, 0, 2, 100005),(1310006, 1, 0, 1, 100006),(1310007, 1, 0, 2, 100007)
|
||||
INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ('public.mx_test_table'::regclass, 1310000, 't', '-2147483648', '-1610612737'),('public.mx_test_table'::regclass, 1310001, 't', '-1610612736', '-1073741825'),('public.mx_test_table'::regclass, 1310002, 't', '-1073741824', '-536870913'),('public.mx_test_table'::regclass, 1310003, 't', '-536870912', '-1'),('public.mx_test_table'::regclass, 1310004, 't', '0', '536870911'),('public.mx_test_table'::regclass, 1310005, 't', '536870912', '1073741823'),('public.mx_test_table'::regclass, 1310006, 't', '1073741824', '1610612735'),('public.mx_test_table'::regclass, 1310007, 't', '1610612736', '2147483647')
|
||||
SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE')
|
||||
SELECT worker_apply_sequence_command ('CREATE SEQUENCE IF NOT EXISTS public.mx_test_table_col_3_seq INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 NO CYCLE')
|
||||
SELECT worker_create_truncate_trigger('public.mx_test_table')
|
||||
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
||||
TRUNCATE pg_dist_node CASCADE
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# ----------
|
||||
# Only run few basic tests to set up a testing environment
|
||||
# ----------
|
||||
test: multi_cluster_management
|
||||
test: multi_test_helpers
|
||||
|
||||
# the following test has to be run sequentially
|
||||
test: base_enable_mx
|
|
@ -0,0 +1,6 @@
|
|||
--
|
||||
-- Setup MX data syncing
|
||||
--
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
|
|
@ -22,7 +22,8 @@ INSERT INTO second_distributed_table VALUES (1, '1');
|
|||
|
||||
-- a simple test for
|
||||
CREATE TABLE collections_list (
|
||||
key int,
|
||||
key bigserial,
|
||||
ser bigserial,
|
||||
ts timestamptz,
|
||||
collection_id integer,
|
||||
value numeric,
|
||||
|
@ -32,7 +33,7 @@ CREATE TABLE collections_list (
|
|||
SELECT create_distributed_table('collections_list', 'key');
|
||||
|
||||
CREATE TABLE collections_list_0
|
||||
PARTITION OF collections_list (key, ts, collection_id, value)
|
||||
PARTITION OF collections_list (key, ser, ts, collection_id, value)
|
||||
FOR VALUES IN ( 0 );
|
||||
|
||||
-- connection worker and get ready for the tests
|
||||
|
@ -652,10 +653,13 @@ BEGIN;
|
|||
COMMIT;
|
||||
|
||||
-- sanity check: local execution on partitions
|
||||
INSERT INTO collections_list (collection_id) VALUES (0) RETURNING *;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
||||
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
||||
SELECT count(*) FROM collections_list;
|
||||
SELECT * FROM collections_list ORDER BY 1,2,3,4;
|
||||
COMMIT;
|
||||
|
||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
||||
|
|
Loading…
Reference in New Issue