Fix psql-dependent metadata sync tests

Ugh. These were… involved.
pull/1439/head
Jason Petersen 2017-05-31 14:23:30 -06:00
parent 61d493000d
commit 992c875e0a
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 168 additions and 145 deletions

View File

@ -240,16 +240,27 @@ SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
1310007 | 1 | 0 | localhost | 57638 | 100007 1310007 | 1 | 0 | localhost | 57638 | 100007
(8 rows) (8 rows)
\d mx_testing_schema.mx_test_table SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Table "mx_testing_schema.mx_test_table"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+--------------------------------------------------------------------------------- --------+---------+---------------------------------------------------------------------------------
col_1 | integer | col_1 | integer |
col_2 | text | not null col_2 | text | not null
col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass)
Indexes: (3 rows)
"mx_test_table_col_1_key" UNIQUE CONSTRAINT, btree (col_1)
"mx_index" btree (col_2) \d mx_testing_schema.mx_test_table_col_1_key
Index "mx_testing_schema.mx_test_table_col_1_key"
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
unique, btree, for table "mx_testing_schema.mx_test_table"
\d mx_testing_schema.mx_index
Index "mx_testing_schema.mx_index"
Column | Type | Definition
--------+------+------------
col_2 | text | col_2
btree, for table "mx_testing_schema.mx_test_table"
-- Check that pg_dist_colocation is not synced -- Check that pg_dist_colocation is not synced
SELECT * FROM pg_dist_colocation ORDER BY colocationid; SELECT * FROM pg_dist_colocation ORDER BY colocationid;
@ -295,15 +306,11 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
-- Check that foreign key metadata exists on the worker -- Check that foreign key metadata exists on the worker
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_testing_schema_2.fk_test_2 SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_testing_schema_2.fk_test_2'::regclass;
Table "mx_testing_schema_2.fk_test_2" Constraint | Definition
Column | Type | Modifiers ---------------------+-----------------------------------------------------------------------------
--------+---------+----------- fk_test_2_col1_fkey | FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3)
col1 | integer | (1 row)
col2 | integer |
col3 | text |
Foreign-key constraints:
"fk_test_2_col1_fkey" FOREIGN KEY (col1, col2) REFERENCES mx_testing_schema.fk_test_1(col1, col3)
\c - - - :master_port \c - - - :master_port
DROP TABLE mx_testing_schema_2.fk_test_2; DROP TABLE mx_testing_schema_2.fk_test_2;
@ -370,16 +377,27 @@ SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
1310007 | 1 | 0 | localhost | 57638 | 100007 1310007 | 1 | 0 | localhost | 57638 | 100007
(8 rows) (8 rows)
\d mx_testing_schema.mx_test_table SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Table "mx_testing_schema.mx_test_table"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+--------------------------------------------------------------------------------- --------+---------+---------------------------------------------------------------------------------
col_1 | integer | col_1 | integer |
col_2 | text | not null col_2 | text | not null
col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass) col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass)
Indexes: (3 rows)
"mx_test_table_col_1_key" UNIQUE CONSTRAINT, btree (col_1)
"mx_index" btree (col_2) \d mx_testing_schema.mx_test_table_col_1_key
Index "mx_testing_schema.mx_test_table_col_1_key"
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
unique, btree, for table "mx_testing_schema.mx_test_table"
\d mx_testing_schema.mx_index
Index "mx_testing_schema.mx_index"
Column | Type | Definition
--------+------+------------
col_2 | text | col_2
btree, for table "mx_testing_schema.mx_test_table"
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass; SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
count count
@ -499,28 +517,46 @@ CREATE INDEX mx_index_1 ON mx_test_schema_1.mx_table_1 (col1);
CREATE TABLE mx_test_schema_2.mx_table_2 (col1 int, col2 text); CREATE TABLE mx_test_schema_2.mx_table_2 (col1 int, col2 text);
CREATE INDEX mx_index_2 ON mx_test_schema_2.mx_table_2 (col2); CREATE INDEX mx_index_2 ON mx_test_schema_2.mx_table_2 (col2);
ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col1) REFERENCES mx_test_schema_1.mx_table_1(col1); ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col1) REFERENCES mx_test_schema_1.mx_table_1(col1);
\d mx_test_schema_1.mx_table_1 SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
Table "mx_test_schema_1.mx_table_1"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+----------- --------+---------+-----------
col1 | integer | col1 | integer |
col2 | text | col2 | text |
Indexes: (2 rows)
"mx_table_1_col1_key" UNIQUE CONSTRAINT, btree (col1)
"mx_index_1" btree (col1)
Referenced by:
TABLE "mx_test_schema_2.mx_table_2" CONSTRAINT "mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_1.mx_table_1_col1_key
Table "mx_test_schema_2.mx_table_2" Index "mx_test_schema_1.mx_table_1_col1_key"
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
unique, btree, for table "mx_test_schema_1.mx_table_1"
\d mx_test_schema_1.mx_index_1
Index "mx_test_schema_1.mx_index_1"
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
btree, for table "mx_test_schema_1.mx_table_1"
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+----------- --------+---------+-----------
col1 | integer | col1 | integer |
col2 | text | col2 | text |
Indexes: (2 rows)
"mx_index_2" btree (col2)
Foreign-key constraints: \d mx_test_schema_2.mx_index_2
"mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) Index "mx_test_schema_2.mx_index_2"
Column | Type | Definition
--------+------+------------
col2 | text | col2
btree, for table "mx_test_schema_2.mx_table_2"
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
Constraint | Definition
------------------+-----------------------------------------------------------------
mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
(1 row)
SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1'); SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1');
create_distributed_table create_distributed_table
@ -578,28 +614,13 @@ ORDER BY
-- Check that metadata of MX tables exist on the metadata worker -- Check that metadata of MX tables exist on the metadata worker
\c - - - :worker_1_port \c - - - :worker_1_port
-- Check that tables are created -- Check that tables are created
\d mx_test_schema_1.mx_table_1 \dt mx_test_schema_?.mx_table_?
Table "mx_test_schema_1.mx_table_1" List of relations
Column | Type | Modifiers Schema | Name | Type | Owner
--------+---------+----------- ------------------+------------+-------+----------
col1 | integer | mx_test_schema_1 | mx_table_1 | table | postgres
col2 | text | mx_test_schema_2 | mx_table_2 | table | postgres
Indexes: (2 rows)
"mx_table_1_col1_key" UNIQUE CONSTRAINT, btree (col1)
"mx_index_1" btree (col1)
Referenced by:
TABLE "mx_test_schema_2.mx_table_2" CONSTRAINT "mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
\d mx_test_schema_2.mx_table_2
Table "mx_test_schema_2.mx_table_2"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer |
col2 | text |
Indexes:
"mx_index_2" btree (col2)
Foreign-key constraints:
"mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
-- Check that table metadata are created -- Check that table metadata are created
SELECT SELECT
@ -665,36 +686,26 @@ SET client_min_messages TO 'ERROR';
CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1); CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1);
CREATE UNIQUE INDEX mx_index_4 ON mx_test_schema_2.mx_table_2(col1); CREATE UNIQUE INDEX mx_index_4 ON mx_test_schema_2.mx_table_2(col1);
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_2.mx_index_3
Table "mx_test_schema_2.mx_table_2" Index "mx_test_schema_2.mx_index_3"
Column | Type | Modifiers Column | Type | Definition
--------+---------+----------- --------+---------+------------
col1 | integer | col1 | integer | col1
col2 | text | hash, for table "mx_test_schema_2.mx_table_2"
Indexes:
"mx_index_4" UNIQUE, btree (col1) \d mx_test_schema_2.mx_index_4
"mx_index_2" btree (col2) Index "mx_test_schema_2.mx_index_4"
"mx_index_3" hash (col1) Column | Type | Definition
Foreign-key constraints: --------+---------+------------
"mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) col1 | integer | col1
unique, btree, for table "mx_test_schema_2.mx_table_2"
-- Check that DROP INDEX statement is propagated -- Check that DROP INDEX statement is propagated
\c - - - :master_port \c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc'; SET citus.multi_shard_commit_protocol TO '2pc';
DROP INDEX mx_test_schema_2.mx_index_3; DROP INDEX mx_test_schema_2.mx_index_3;
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_2.mx_index_3
Table "mx_test_schema_2.mx_table_2"
Column | Type | Modifiers
--------+---------+-----------
col1 | integer |
col2 | text |
Indexes:
"mx_index_4" UNIQUE, btree (col1)
"mx_index_2" btree (col2)
Foreign-key constraints:
"mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
-- Check that ALTER TABLE statements are propagated -- Check that ALTER TABLE statements are propagated
\c - - - :master_port \c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc'; SET citus.multi_shard_commit_protocol TO '2pc';
@ -709,20 +720,19 @@ FOREIGN KEY
REFERENCES REFERENCES
mx_test_schema_2.mx_table_2(col1); mx_test_schema_2.mx_table_2(col1);
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_1.mx_table_1 SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
Table "mx_test_schema_1.mx_table_1"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+----------- --------+---------+-----------
col1 | integer | col1 | integer |
col2 | text | col2 | text |
col3 | integer | col3 | integer |
Indexes: (3 rows)
"mx_table_1_col1_key" UNIQUE CONSTRAINT, btree (col1)
"mx_index_1" btree (col1) SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
Foreign-key constraints: Constraint | Definition
"mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) ------------------+-----------------------------------------------------------------
Referenced by: mx_fk_constraint | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1)
TABLE "mx_test_schema_2.mx_table_2" CONSTRAINT "mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1) (1 row)
-- Check that foreign key constraint with NOT VALID works as well -- Check that foreign key constraint with NOT VALID works as well
\c - - - :master_port \c - - - :master_port
@ -738,20 +748,11 @@ REFERENCES
mx_test_schema_2.mx_table_2(col1) mx_test_schema_2.mx_table_2(col1)
NOT VALID; NOT VALID;
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_1.mx_table_1 SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
Table "mx_test_schema_1.mx_table_1" Constraint | Definition
Column | Type | Modifiers --------------------+---------------------------------------------------------------------------
--------+---------+----------- mx_fk_constraint_2 | FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) NOT VALID
col1 | integer | (1 row)
col2 | text |
col3 | integer |
Indexes:
"mx_table_1_col1_key" UNIQUE CONSTRAINT, btree (col1)
"mx_index_1" btree (col1)
Foreign-key constraints:
"mx_fk_constraint_2" FOREIGN KEY (col1) REFERENCES mx_test_schema_2.mx_table_2(col1) NOT VALID
Referenced by:
TABLE "mx_test_schema_2.mx_table_2" CONSTRAINT "mx_fk_constraint" FOREIGN KEY (col1) REFERENCES mx_test_schema_1.mx_table_1(col1)
-- Check that mark_tables_colocated call propagates the changes to the workers -- Check that mark_tables_colocated call propagates the changes to the workers
\c - - - :master_port \c - - - :master_port
@ -932,13 +933,13 @@ SELECT create_distributed_table('mx_table_with_sequence', 'a');
(1 row) (1 row)
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
Table "public.mx_table_with_sequence"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+-------------------------------------------------------------------- --------+---------+--------------------------------------------------------------------
a | integer | a | integer |
b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass) b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass)
c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass) c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass)
(3 rows)
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
List of relations List of relations
@ -956,13 +957,13 @@ SELECT create_distributed_table('mx_table_with_sequence', 'a');
-- Check that the sequences created on the metadata worker as well -- Check that the sequences created on the metadata worker as well
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
Table "public.mx_table_with_sequence"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+-------------------------------------------------------------------- --------+---------+--------------------------------------------------------------------
a | integer | a | integer |
b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass) b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass)
c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass) c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass)
(3 rows)
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
List of relations List of relations
@ -1006,13 +1007,13 @@ SELECT groupid FROM pg_dist_local_group;
2 2
(1 row) (1 row)
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
Table "public.mx_table_with_sequence"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+-------------------------------------------------------------------- --------+---------+--------------------------------------------------------------------
a | integer | a | integer |
b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass) b | bigint | not null default nextval('mx_table_with_sequence_b_seq'::regclass)
c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass) c | bigint | not null default nextval('mx_table_with_sequence_c_seq'::regclass)
(3 rows)
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
List of relations List of relations
@ -1204,20 +1205,20 @@ SELECT create_reference_table('mx_ref');
(1 row) (1 row)
\d mx_ref \dt mx_ref
Table "public.mx_ref" List of relations
Column | Type | Modifiers Schema | Name | Type | Owner
--------+---------+----------- --------+--------+-------+----------
col_1 | integer | public | mx_ref | table | postgres
col_2 | text | (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_ref \dt mx_ref
Table "public.mx_ref" List of relations
Column | Type | Modifiers Schema | Name | Type | Owner
--------+---------+----------- --------+--------+-------+----------
col_1 | integer | public | mx_ref | table | postgres
col_2 | text | (1 row)
SELECT SELECT
logicalrelid, partmethod, repmodel, shardid, placementid, nodename, nodeport logicalrelid, partmethod, repmodel, shardid, placementid, nodename, nodeport
@ -1243,26 +1244,36 @@ ALTER TABLE mx_ref ADD COLUMN col_3 NUMERIC DEFAULT 0;
NOTICE: using one-phase commit for distributed DDL commands NOTICE: using one-phase commit for distributed DDL commands
HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc' HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc'
CREATE INDEX mx_ref_index ON mx_ref(col_1); CREATE INDEX mx_ref_index ON mx_ref(col_1);
\d mx_ref SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
Table "public.mx_ref"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+----------- --------+---------+-----------
col_1 | integer | col_1 | integer |
col_2 | text | col_2 | text |
col_3 | numeric | default 0 col_3 | numeric | default 0
Indexes: (3 rows)
"mx_ref_index" btree (col_1)
\d mx_ref_index
Index "public.mx_ref_index"
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
btree, for table "public.mx_ref"
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_ref SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
Table "public.mx_ref"
Column | Type | Modifiers Column | Type | Modifiers
--------+---------+----------- --------+---------+-----------
col_1 | integer | col_1 | integer |
col_2 | text | col_2 | text |
col_3 | numeric | default 0 col_3 | numeric | default 0
Indexes: (3 rows)
"mx_ref_index" btree (col_1)
\d mx_ref_index
Index "public.mx_ref_index"
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
btree, for table "public.mx_ref"
-- Check that metada is cleaned successfully upon drop table -- Check that metada is cleaned successfully upon drop table

View File

@ -78,7 +78,9 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition ORDER BY logicalrelid; SELECT * FROM pg_dist_partition ORDER BY logicalrelid;
SELECT * FROM pg_dist_shard ORDER BY shardid; SELECT * FROM pg_dist_shard ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport; SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
\d mx_testing_schema.mx_test_table SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
\d mx_testing_schema.mx_test_table_col_1_key
\d mx_testing_schema.mx_index
-- Check that pg_dist_colocation is not synced -- Check that pg_dist_colocation is not synced
SELECT * FROM pg_dist_colocation ORDER BY colocationid; SELECT * FROM pg_dist_colocation ORDER BY colocationid;
@ -107,7 +109,7 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
-- Check that foreign key metadata exists on the worker -- Check that foreign key metadata exists on the worker
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_testing_schema_2.fk_test_2 SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_testing_schema_2.fk_test_2'::regclass;
\c - - - :master_port \c - - - :master_port
DROP TABLE mx_testing_schema_2.fk_test_2; DROP TABLE mx_testing_schema_2.fk_test_2;
@ -126,7 +128,9 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition ORDER BY logicalrelid; SELECT * FROM pg_dist_partition ORDER BY logicalrelid;
SELECT * FROM pg_dist_shard ORDER BY shardid; SELECT * FROM pg_dist_shard ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport; SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
\d mx_testing_schema.mx_test_table SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
\d mx_testing_schema.mx_test_table_col_1_key
\d mx_testing_schema.mx_index
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass; SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
-- Make sure that start_metadata_sync_to_node cannot be called inside a transaction -- Make sure that start_metadata_sync_to_node cannot be called inside a transaction
@ -190,8 +194,13 @@ CREATE TABLE mx_test_schema_2.mx_table_2 (col1 int, col2 text);
CREATE INDEX mx_index_2 ON mx_test_schema_2.mx_table_2 (col2); CREATE INDEX mx_index_2 ON mx_test_schema_2.mx_table_2 (col2);
ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col1) REFERENCES mx_test_schema_1.mx_table_1(col1); ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col1) REFERENCES mx_test_schema_1.mx_table_1(col1);
\d mx_test_schema_1.mx_table_1 SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_1.mx_table_1_col1_key
\d mx_test_schema_1.mx_index_1
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
\d mx_test_schema_2.mx_index_2
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1'); SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1');
SELECT create_distributed_table('mx_test_schema_2.mx_table_2', 'col1'); SELECT create_distributed_table('mx_test_schema_2.mx_table_2', 'col1');
@ -222,8 +231,7 @@ ORDER BY
\c - - - :worker_1_port \c - - - :worker_1_port
-- Check that tables are created -- Check that tables are created
\d mx_test_schema_1.mx_table_1 \dt mx_test_schema_?.mx_table_?
\d mx_test_schema_2.mx_table_2
-- Check that table metadata are created -- Check that table metadata are created
SELECT SELECT
@ -262,14 +270,15 @@ SET client_min_messages TO 'ERROR';
CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1); CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1);
CREATE UNIQUE INDEX mx_index_4 ON mx_test_schema_2.mx_table_2(col1); CREATE UNIQUE INDEX mx_index_4 ON mx_test_schema_2.mx_table_2(col1);
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_2.mx_index_3
\d mx_test_schema_2.mx_index_4
-- Check that DROP INDEX statement is propagated -- Check that DROP INDEX statement is propagated
\c - - - :master_port \c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc'; SET citus.multi_shard_commit_protocol TO '2pc';
DROP INDEX mx_test_schema_2.mx_index_3; DROP INDEX mx_test_schema_2.mx_index_3;
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_2.mx_table_2 \d mx_test_schema_2.mx_index_3
-- Check that ALTER TABLE statements are propagated -- Check that ALTER TABLE statements are propagated
\c - - - :master_port \c - - - :master_port
@ -285,7 +294,8 @@ FOREIGN KEY
REFERENCES REFERENCES
mx_test_schema_2.mx_table_2(col1); mx_test_schema_2.mx_table_2(col1);
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_1.mx_table_1 SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
-- Check that foreign key constraint with NOT VALID works as well -- Check that foreign key constraint with NOT VALID works as well
\c - - - :master_port \c - - - :master_port
@ -301,7 +311,7 @@ REFERENCES
mx_test_schema_2.mx_table_2(col1) mx_test_schema_2.mx_table_2(col1)
NOT VALID; NOT VALID;
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_test_schema_1.mx_table_1 SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
-- Check that mark_tables_colocated call propagates the changes to the workers -- Check that mark_tables_colocated call propagates the changes to the workers
\c - - - :master_port \c - - - :master_port
@ -417,13 +427,13 @@ DROP TABLE mx_table_with_small_sequence;
-- Create an MX table with (BIGSERIAL) sequences -- Create an MX table with (BIGSERIAL) sequences
CREATE TABLE mx_table_with_sequence(a int, b BIGSERIAL, c BIGSERIAL); CREATE TABLE mx_table_with_sequence(a int, b BIGSERIAL, c BIGSERIAL);
SELECT create_distributed_table('mx_table_with_sequence', 'a'); SELECT create_distributed_table('mx_table_with_sequence', 'a');
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
\ds mx_table_with_sequence_c_seq \ds mx_table_with_sequence_c_seq
-- Check that the sequences created on the metadata worker as well -- Check that the sequences created on the metadata worker as well
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
\ds mx_table_with_sequence_c_seq \ds mx_table_with_sequence_c_seq
@ -437,7 +447,7 @@ SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
\c - - - :worker_2_port \c - - - :worker_2_port
SELECT groupid FROM pg_dist_local_group; SELECT groupid FROM pg_dist_local_group;
\d mx_table_with_sequence SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_sequence'::regclass;
\ds mx_table_with_sequence_b_seq \ds mx_table_with_sequence_b_seq
\ds mx_table_with_sequence_c_seq \ds mx_table_with_sequence_c_seq
SELECT nextval('mx_table_with_sequence_b_seq'); SELECT nextval('mx_table_with_sequence_b_seq');
@ -525,10 +535,10 @@ DROP USER mx_user;
\c - - - :master_port \c - - - :master_port
CREATE TABLE mx_ref (col_1 int, col_2 text); CREATE TABLE mx_ref (col_1 int, col_2 text);
SELECT create_reference_table('mx_ref'); SELECT create_reference_table('mx_ref');
\d mx_ref \dt mx_ref
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_ref \dt mx_ref
SELECT SELECT
logicalrelid, partmethod, repmodel, shardid, placementid, nodename, nodeport logicalrelid, partmethod, repmodel, shardid, placementid, nodename, nodeport
FROM FROM
@ -546,10 +556,12 @@ SELECT shardid AS ref_table_shardid FROM pg_dist_shard WHERE logicalrelid='mx_re
\c - - - :master_port \c - - - :master_port
ALTER TABLE mx_ref ADD COLUMN col_3 NUMERIC DEFAULT 0; ALTER TABLE mx_ref ADD COLUMN col_3 NUMERIC DEFAULT 0;
CREATE INDEX mx_ref_index ON mx_ref(col_1); CREATE INDEX mx_ref_index ON mx_ref(col_1);
\d mx_ref SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
\d mx_ref_index
\c - - - :worker_1_port \c - - - :worker_1_port
\d mx_ref SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
\d mx_ref_index
-- Check that metada is cleaned successfully upon drop table -- Check that metada is cleaned successfully upon drop table
\c - - - :master_port \c - - - :master_port