mirror of https://github.com/citusdata/citus.git
Move worker execution to after master, fix tests
Some tests relied on worker errors though local commands were invalid. Fixed those by ensuring preconditions were met to have command work correctly. Otherwise most test changes are related to slight changes in local/remote error ordering.pull/1278/head
parent
419a4c3745
commit
f181b24859
|
@ -168,6 +168,7 @@ multi_ProcessUtility(Node *parsetree,
|
|||
bool commandMustRunAsOwner = false;
|
||||
Oid savedUserId = InvalidOid;
|
||||
int savedSecurityContext = 0;
|
||||
DDLJob *ddlJob = NULL;
|
||||
|
||||
if (IsA(parsetree, TransactionStmt))
|
||||
{
|
||||
|
@ -252,8 +253,6 @@ multi_ProcessUtility(Node *parsetree,
|
|||
*/
|
||||
if (EnableDDLPropagation)
|
||||
{
|
||||
DDLJob *ddlJob = NULL;
|
||||
|
||||
if (IsA(parsetree, IndexStmt))
|
||||
{
|
||||
ddlJob = PlanIndexStmt((IndexStmt *) parsetree, queryString);
|
||||
|
@ -312,11 +311,6 @@ multi_ProcessUtility(Node *parsetree,
|
|||
errhint("Connect to worker nodes directly to manually "
|
||||
"move all tables.")));
|
||||
}
|
||||
|
||||
if (ddlJob != NULL)
|
||||
{
|
||||
ExecuteDistributedDDLJob(ddlJob);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -381,6 +375,11 @@ multi_ProcessUtility(Node *parsetree,
|
|||
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
||||
}
|
||||
|
||||
if (ddlJob != NULL)
|
||||
{
|
||||
ExecuteDistributedDDLJob(ddlJob);
|
||||
}
|
||||
|
||||
/* we run VacuumStmt after standard hook to benefit from its checks and locking */
|
||||
if (IsA(parsetree, VacuumStmt))
|
||||
{
|
||||
|
|
|
@ -163,14 +163,10 @@ ERROR: creating unique indexes on append-partitioned tables is currently unsupp
|
|||
CREATE INDEX lineitem_orderkey_index ON lineitem (l_orderkey);
|
||||
ERROR: relation "lineitem_orderkey_index" already exists
|
||||
CREATE INDEX try_index ON lineitem USING gist (l_orderkey);
|
||||
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'
|
||||
ERROR: data type bigint has no default operator class for access method "gist"
|
||||
HINT: You must specify an operator class for the index or define a default operator class for the data type.
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
CREATE INDEX try_index ON lineitem (non_existent_column);
|
||||
ERROR: column "non_existent_column" does not exist
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
CREATE INDEX ON lineitem (l_orderkey);
|
||||
ERROR: creating index without a name on a distributed table is currently unsupported
|
||||
-- Verify that none of failed indexes got created on the master node
|
||||
|
@ -205,6 +201,8 @@ DROP INDEX CONCURRENTLY lineitem_orderkey_index;
|
|||
ERROR: dropping indexes concurrently on distributed tables is currently unsupported
|
||||
-- Verify that we can succesfully drop indexes
|
||||
DROP INDEX lineitem_orderkey_index;
|
||||
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'
|
||||
DROP INDEX lineitem_orderkey_index_new;
|
||||
DROP INDEX lineitem_partkey_desc_index;
|
||||
DROP INDEX lineitem_partial_index;
|
||||
|
|
|
@ -43,9 +43,9 @@ SELECT master_create_worker_shards('lineitem_hash', 2, 1);
|
|||
(1 row)
|
||||
|
||||
CREATE INDEX lineitem_hash_time_index ON lineitem_hash (l_shipdate);
|
||||
DEBUG: building index "lineitem_hash_time_index" on table "lineitem_hash"
|
||||
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'
|
||||
DEBUG: building index "lineitem_hash_time_index" on table "lineitem_hash"
|
||||
CREATE TABLE orders_hash (
|
||||
o_orderkey bigint not null,
|
||||
o_custkey integer not null,
|
||||
|
|
|
@ -610,9 +610,9 @@ HINT: You can enable two-phase commit for extra safety with: SET citus.multi_sh
|
|||
|
||||
\c - - - :master_port
|
||||
ALTER TABLE test_schema_support.nation_hash DROP COLUMN IF EXISTS non_existent_column;
|
||||
NOTICE: column "non_existent_column" of relation "nation_hash" does not exist, skipping
|
||||
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'
|
||||
NOTICE: column "non_existent_column" of relation "nation_hash" does not exist, skipping
|
||||
ALTER TABLE test_schema_support.nation_hash DROP COLUMN IF EXISTS new_col;
|
||||
-- verify column is dropped
|
||||
\d test_schema_support.nation_hash;
|
||||
|
@ -665,9 +665,9 @@ HINT: You can enable two-phase commit for extra safety with: SET citus.multi_sh
|
|||
\c - - - :master_port
|
||||
SET search_path TO test_schema_support;
|
||||
ALTER TABLE nation_hash DROP COLUMN IF EXISTS non_existent_column;
|
||||
NOTICE: column "non_existent_column" of relation "nation_hash" does not exist, skipping
|
||||
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'
|
||||
NOTICE: column "non_existent_column" of relation "nation_hash" does not exist, skipping
|
||||
ALTER TABLE nation_hash DROP COLUMN IF EXISTS new_col;
|
||||
-- verify column is dropped
|
||||
\d test_schema_support.nation_hash;
|
||||
|
|
|
@ -140,6 +140,9 @@ SELECT * FROM mx_ref_table ORDER BY col_1;
|
|||
|
||||
\c - - - :master_port
|
||||
DROP TABLE mx_ref_table;
|
||||
CREATE UNIQUE INDEX mx_test_uniq_index ON mx_table(col_1);
|
||||
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'
|
||||
\c - - - :worker_1_port
|
||||
-- DDL commands
|
||||
\d mx_table
|
||||
|
@ -149,8 +152,10 @@ DROP TABLE mx_ref_table;
|
|||
col_1 | integer |
|
||||
col_2 | text |
|
||||
col_3 | bigint | not null default nextval('mx_table_col_3_seq'::regclass)
|
||||
Indexes:
|
||||
"mx_test_uniq_index" UNIQUE, btree (col_1)
|
||||
|
||||
CREATE INDEX mx_test_index ON mx_table(col_1);
|
||||
CREATE INDEX mx_test_index ON mx_table(col_2);
|
||||
ERROR: operation is not allowed on this node
|
||||
HINT: Connect to the coordinator and run it again.
|
||||
ALTER TABLE mx_table ADD COLUMN col_4 int;
|
||||
|
@ -166,6 +171,8 @@ HINT: Connect to the coordinator and run it again.
|
|||
col_1 | integer |
|
||||
col_2 | text |
|
||||
col_3 | bigint | not null default nextval('mx_table_col_3_seq'::regclass)
|
||||
Indexes:
|
||||
"mx_test_uniq_index" UNIQUE, btree (col_1)
|
||||
|
||||
-- master_modify_multiple_shards
|
||||
SELECT master_modify_multiple_shards('UPDATE mx_table SET col_2=''none''');
|
||||
|
@ -223,6 +230,9 @@ SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
|||
|
||||
-- master_remove_node
|
||||
\c - - - :master_port
|
||||
DROP INDEX mx_test_uniq_index;
|
||||
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'
|
||||
SELECT master_add_node('localhost', 5432);
|
||||
master_add_node
|
||||
--------------------------------------------
|
||||
|
|
|
@ -261,8 +261,7 @@ ALTER TABLE IF EXISTS non_existent_table ADD COLUMN new_column INTEGER;
|
|||
NOTICE: relation "non_existent_table" does not exist, skipping
|
||||
ALTER TABLE IF EXISTS lineitem_alter ALTER COLUMN int_column2 SET DATA TYPE INTEGER;
|
||||
ALTER TABLE lineitem_alter DROP COLUMN non_existent_column;
|
||||
ERROR: column "non_existent_column" of relation "lineitem_alter_220000" does not exist
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
ERROR: column "non_existent_column" of relation "lineitem_alter" does not exist
|
||||
ALTER TABLE lineitem_alter DROP COLUMN IF EXISTS non_existent_column;
|
||||
NOTICE: column "non_existent_column" of relation "lineitem_alter" does not exist, skipping
|
||||
ALTER TABLE lineitem_alter DROP COLUMN IF EXISTS int_column2;
|
||||
|
@ -360,13 +359,13 @@ DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT, ADD|DROP CON
|
|||
-- types
|
||||
ALTER TABLE lineitem_alter ADD COLUMN new_column non_existent_type;
|
||||
ERROR: type "non_existent_type" does not exist
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
LINE 1: ALTER TABLE lineitem_alter ADD COLUMN new_column non_existen...
|
||||
^
|
||||
ALTER TABLE lineitem_alter ALTER COLUMN null_column SET NOT NULL;
|
||||
ERROR: column "null_column" contains null values
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
ALTER TABLE lineitem_alter ALTER COLUMN l_partkey SET DEFAULT 'a';
|
||||
ERROR: invalid input syntax for integer: "a"
|
||||
CONTEXT: while executing command on localhost:57638
|
||||
-- Verify that we error out on statements involving RENAME
|
||||
ALTER TABLE lineitem_alter RENAME TO lineitem_renamed;
|
||||
ERROR: renaming distributed tables or their objects is currently unsupported
|
||||
|
|
|
@ -91,11 +91,12 @@ SELECT * FROM mx_ref_table ORDER BY col_1;
|
|||
|
||||
\c - - - :master_port
|
||||
DROP TABLE mx_ref_table;
|
||||
CREATE UNIQUE INDEX mx_test_uniq_index ON mx_table(col_1);
|
||||
\c - - - :worker_1_port
|
||||
|
||||
-- DDL commands
|
||||
\d mx_table
|
||||
CREATE INDEX mx_test_index ON mx_table(col_1);
|
||||
CREATE INDEX mx_test_index ON mx_table(col_2);
|
||||
ALTER TABLE mx_table ADD COLUMN col_4 int;
|
||||
ALTER TABLE mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col_1) REFERENCES mx_table(col_1);
|
||||
\d mx_table
|
||||
|
@ -122,6 +123,7 @@ SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
|||
|
||||
-- master_remove_node
|
||||
\c - - - :master_port
|
||||
DROP INDEX mx_test_uniq_index;
|
||||
SELECT master_add_node('localhost', 5432);
|
||||
|
||||
\c - - - :worker_1_port
|
||||
|
|
Loading…
Reference in New Issue