mirror of https://github.com/citusdata/citus.git
parent
579a40dfa5
commit
e4cfea3751
|
@ -206,7 +206,7 @@ pg_get_sequencedef_string(Oid sequenceRelationId)
|
||||||
pgSequenceForm = pg_get_sequencedef(sequenceRelationId);
|
pgSequenceForm = pg_get_sequencedef(sequenceRelationId);
|
||||||
|
|
||||||
/* build our DDL command */
|
/* build our DDL command */
|
||||||
qualifiedSequenceName = generate_relation_name(sequenceRelationId, NIL);
|
qualifiedSequenceName = generate_qualified_relation_name(sequenceRelationId);
|
||||||
|
|
||||||
sequenceDef = psprintf(CREATE_SEQUENCE_COMMAND, qualifiedSequenceName,
|
sequenceDef = psprintf(CREATE_SEQUENCE_COMMAND, qualifiedSequenceName,
|
||||||
pgSequenceForm->seqincrement, pgSequenceForm->seqmin,
|
pgSequenceForm->seqincrement, pgSequenceForm->seqmin,
|
||||||
|
|
|
@ -31,7 +31,8 @@ INSERT INTO distributed_table VALUES (1, '1', 20);
|
||||||
INSERT INTO second_distributed_table VALUES (1, '1');
|
INSERT INTO second_distributed_table VALUES (1, '1');
|
||||||
-- a simple test for
|
-- a simple test for
|
||||||
CREATE TABLE collections_list (
|
CREATE TABLE collections_list (
|
||||||
key int,
|
key bigserial,
|
||||||
|
ser bigserial,
|
||||||
ts timestamptz,
|
ts timestamptz,
|
||||||
collection_id integer,
|
collection_id integer,
|
||||||
value numeric,
|
value numeric,
|
||||||
|
@ -44,7 +45,7 @@ SELECT create_distributed_table('collections_list', 'key');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
CREATE TABLE collections_list_0
|
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 );
|
FOR VALUES IN ( 0 );
|
||||||
-- connection worker and get ready for the tests
|
-- connection worker and get ready for the tests
|
||||||
\c - - - :worker_1_port
|
\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)
|
LOG: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500)
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- sanity check: local execution on partitions
|
-- 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;
|
BEGIN;
|
||||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
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;
|
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)
|
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
|
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
|
LOG: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.collections_list_1470011 collections_list WHERE true
|
||||||
count
|
count
|
||||||
-------
|
-------
|
||||||
1
|
2
|
||||||
(1 row)
|
(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;
|
COMMIT;
|
||||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
-- 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
|
-- 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');
|
INSERT INTO second_distributed_table VALUES (1, '1');
|
||||||
-- a simple test for
|
-- a simple test for
|
||||||
CREATE TABLE collections_list (
|
CREATE TABLE collections_list (
|
||||||
key int,
|
key bigserial,
|
||||||
|
ser bigserial,
|
||||||
ts timestamptz,
|
ts timestamptz,
|
||||||
collection_id integer,
|
collection_id integer,
|
||||||
value numeric,
|
value numeric,
|
||||||
PRIMARY KEY(key, collection_id)
|
PRIMARY KEY(key, collection_id)
|
||||||
) PARTITION BY LIST (collection_id );
|
) PARTITION BY LIST (collection_id );
|
||||||
ERROR: primary key constraints are not supported on partitioned tables
|
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');
|
SELECT create_distributed_table('collections_list', 'key');
|
||||||
ERROR: relation "collections_list" does not exist
|
ERROR: relation "collections_list" does not exist
|
||||||
LINE 1: SELECT create_distributed_table('collections_list', 'key');
|
LINE 1: SELECT create_distributed_table('collections_list', 'key');
|
||||||
^
|
^
|
||||||
CREATE TABLE collections_list_0
|
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 );
|
FOR VALUES IN ( 0 );
|
||||||
ERROR: relation "collections_list" does not exist
|
ERROR: relation "collections_list" does not exist
|
||||||
-- connection worker and get ready for the tests
|
-- 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)
|
LOG: executing the command locally: DELETE FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (key OPERATOR(pg_catalog.=) 500)
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- sanity check: local execution on partitions
|
-- 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;
|
BEGIN;
|
||||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
||||||
ERROR: relation "collections_list" does not exist
|
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;
|
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
||||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||||
SELECT count(*) FROM collections_list;
|
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
|
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
-- 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_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_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')
|
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_create_truncate_trigger('public.mx_test_table')
|
||||||
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
||||||
TRUNCATE pg_dist_node CASCADE
|
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_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_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')
|
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_create_truncate_trigger('public.mx_test_table')
|
||||||
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
SELECT worker_drop_distributed_table(logicalrelid::regclass::text) FROM pg_dist_partition
|
||||||
TRUNCATE pg_dist_node CASCADE
|
TRUNCATE pg_dist_node CASCADE
|
||||||
|
|
|
@ -22,7 +22,8 @@ INSERT INTO second_distributed_table VALUES (1, '1');
|
||||||
|
|
||||||
-- a simple test for
|
-- a simple test for
|
||||||
CREATE TABLE collections_list (
|
CREATE TABLE collections_list (
|
||||||
key int,
|
key bigserial,
|
||||||
|
ser bigserial,
|
||||||
ts timestamptz,
|
ts timestamptz,
|
||||||
collection_id integer,
|
collection_id integer,
|
||||||
value numeric,
|
value numeric,
|
||||||
|
@ -32,7 +33,7 @@ CREATE TABLE collections_list (
|
||||||
SELECT create_distributed_table('collections_list', 'key');
|
SELECT create_distributed_table('collections_list', 'key');
|
||||||
|
|
||||||
CREATE TABLE collections_list_0
|
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 );
|
FOR VALUES IN ( 0 );
|
||||||
|
|
||||||
-- connection worker and get ready for the tests
|
-- connection worker and get ready for the tests
|
||||||
|
@ -652,10 +653,13 @@ BEGIN;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- sanity check: local execution on partitions
|
-- sanity check: local execution on partitions
|
||||||
|
INSERT INTO collections_list (collection_id) VALUES (0) RETURNING *;
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
INSERT INTO collections_list (key, collection_id) VALUES (1,0);
|
||||||
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
SELECT count(*) FROM collections_list_0 WHERE key = 1;
|
||||||
SELECT count(*) FROM collections_list;
|
SELECT count(*) FROM collections_list;
|
||||||
|
SELECT * FROM collections_list ORDER BY 1,2,3,4;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
-- the final queries for the following CTEs are going to happen on the intermediate results only
|
||||||
|
|
Loading…
Reference in New Issue