mirror of https://github.com/citusdata/citus.git
Stabilize single node tests (#6741)
First of all, we set next_shard_id for single_node_truncate.sql because shard ids in the test output were changing whenever we modify a prior test file, such as single_node.sql. Then the flaky test detector started complaining about single_node_truncate.sql. We fix that by specifying the correct test dependency for it in run_test.py. We also do the same for single_node.sql.pull/6744/head^2
commit
0d401344c2
|
@ -84,6 +84,8 @@ if __name__ == "__main__":
|
||||||
),
|
),
|
||||||
"create_role_propagation": TestDeps(None, ["multi_cluster_management"]),
|
"create_role_propagation": TestDeps(None, ["multi_cluster_management"]),
|
||||||
"single_node_enterprise": TestDeps(None),
|
"single_node_enterprise": TestDeps(None),
|
||||||
|
"single_node": TestDeps(None),
|
||||||
|
"single_node_truncate": TestDeps(None),
|
||||||
"multi_extension": TestDeps(None, repeatable=False),
|
"multi_extension": TestDeps(None, repeatable=False),
|
||||||
"multi_test_helpers": TestDeps(None),
|
"multi_test_helpers": TestDeps(None),
|
||||||
"multi_insert_select": TestDeps("base_schedule"),
|
"multi_insert_select": TestDeps("base_schedule"),
|
||||||
|
|
|
@ -1829,6 +1829,7 @@ SELECT pg_sleep(0.1);
|
||||||
-- backend(s) that execute on the shards will be terminated
|
-- backend(s) that execute on the shards will be terminated
|
||||||
-- so show that there no internal backends
|
-- so show that there no internal backends
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90730500;
|
||||||
SELECT count(*) from should_commit;
|
SELECT count(*) from should_commit;
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -1882,6 +1883,7 @@ BEGIN;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90830500;
|
||||||
-- simulate that even if there is no connection slots
|
-- simulate that even if there is no connection slots
|
||||||
-- to connect, Citus can switch to local execution
|
-- to connect, Citus can switch to local execution
|
||||||
SET citus.force_max_query_parallelization TO false;
|
SET citus.force_max_query_parallelization TO false;
|
||||||
|
@ -2106,10 +2108,10 @@ NOTICE: executing the command locally: SELECT count(DISTINCT (key)::text) AS co
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
CREATE TABLE test_disabling_drop_and_truncate (a int);
|
CREATE TABLE test_disabling_drop_and_truncate (a int);
|
||||||
SELECT create_distributed_table('test_disabling_drop_and_truncate', 'a');
|
SELECT create_distributed_table('test_disabling_drop_and_truncate', 'a');
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102040, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102040, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830500, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830500, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102041, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102041, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830501, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830501, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102042, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102042, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830502, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830502, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102043, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102043, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830503, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830503, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2117,24 +2119,24 @@ NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1
|
||||||
|
|
||||||
SET citus.enable_manual_changes_to_shards TO off;
|
SET citus.enable_manual_changes_to_shards TO off;
|
||||||
-- these should error out
|
-- these should error out
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
ERROR: cannot modify "test_disabling_drop_and_truncate_102040" because it is a shard of a distributed table
|
ERROR: cannot modify "test_disabling_drop_and_truncate_90830500" because it is a shard of a distributed table
|
||||||
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
ERROR: cannot modify "test_disabling_drop_and_truncate_102040" because it is a shard of a distributed table
|
ERROR: cannot modify "test_disabling_drop_and_truncate_90830500" because it is a shard of a distributed table
|
||||||
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
||||||
RESET citus.enable_manual_changes_to_shards ;
|
RESET citus.enable_manual_changes_to_shards ;
|
||||||
-- these should work as expected
|
-- these should work as expected
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
DROP TABLE test_disabling_drop_and_truncate;
|
DROP TABLE test_disabling_drop_and_truncate;
|
||||||
-- test creating distributed or reference tables from shards
|
-- test creating distributed or reference tables from shards
|
||||||
CREATE TABLE test_creating_distributed_relation_table_from_shard (a int);
|
CREATE TABLE test_creating_distributed_relation_table_from_shard (a int);
|
||||||
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard', 'a');
|
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard', 'a');
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102044, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102044, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830504, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830504, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102045, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102045, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830505, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830505, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102046, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102046, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830506, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830506, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102047, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102047, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830507, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830507, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2142,11 +2144,11 @@ NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1
|
||||||
|
|
||||||
-- these should error because shards cannot be used to:
|
-- these should error because shards cannot be used to:
|
||||||
-- create distributed table
|
-- create distributed table
|
||||||
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_102044', 'a');
|
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_90830504', 'a');
|
||||||
ERROR: relation "test_creating_distributed_relation_table_from_shard_102044" is a shard relation
|
ERROR: relation "test_creating_distributed_relation_table_from_shard_90830504" is a shard relation
|
||||||
-- create reference table
|
-- create reference table
|
||||||
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_102044');
|
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_90830504');
|
||||||
ERROR: relation "test_creating_distributed_relation_table_from_shard_102044" is a shard relation
|
ERROR: relation "test_creating_distributed_relation_table_from_shard_90830504" is a shard relation
|
||||||
RESET citus.shard_replication_factor;
|
RESET citus.shard_replication_factor;
|
||||||
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
||||||
-- lets flush the copy often to make sure everyhing is fine
|
-- lets flush the copy often to make sure everyhing is fine
|
||||||
|
|
|
@ -1829,6 +1829,7 @@ SELECT pg_sleep(0.1);
|
||||||
-- backend(s) that execute on the shards will be terminated
|
-- backend(s) that execute on the shards will be terminated
|
||||||
-- so show that there no internal backends
|
-- so show that there no internal backends
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90730500;
|
||||||
SELECT count(*) from should_commit;
|
SELECT count(*) from should_commit;
|
||||||
count
|
count
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
@ -1882,6 +1883,7 @@ BEGIN;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90830500;
|
||||||
-- simulate that even if there is no connection slots
|
-- simulate that even if there is no connection slots
|
||||||
-- to connect, Citus can switch to local execution
|
-- to connect, Citus can switch to local execution
|
||||||
SET citus.force_max_query_parallelization TO false;
|
SET citus.force_max_query_parallelization TO false;
|
||||||
|
@ -2106,10 +2108,10 @@ NOTICE: executing the command locally: SELECT count(DISTINCT (key)::text) AS co
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
CREATE TABLE test_disabling_drop_and_truncate (a int);
|
CREATE TABLE test_disabling_drop_and_truncate (a int);
|
||||||
SELECT create_distributed_table('test_disabling_drop_and_truncate', 'a');
|
SELECT create_distributed_table('test_disabling_drop_and_truncate', 'a');
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102040, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102040, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830500, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830500, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102041, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102041, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830501, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830501, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102042, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102042, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830502, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830502, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102043, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102043, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830503, 'single_node', 'CREATE TABLE single_node.test_disabling_drop_and_truncate (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830503, 'single_node', 'ALTER TABLE single_node.test_disabling_drop_and_truncate OWNER TO postgres')
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2117,24 +2119,24 @@ NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1
|
||||||
|
|
||||||
SET citus.enable_manual_changes_to_shards TO off;
|
SET citus.enable_manual_changes_to_shards TO off;
|
||||||
-- these should error out
|
-- these should error out
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
ERROR: cannot modify "test_disabling_drop_and_truncate_102040" because it is a shard of a distributed table
|
ERROR: cannot modify "test_disabling_drop_and_truncate_90830500" because it is a shard of a distributed table
|
||||||
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
ERROR: cannot modify "test_disabling_drop_and_truncate_102040" because it is a shard of a distributed table
|
ERROR: cannot modify "test_disabling_drop_and_truncate_90830500" because it is a shard of a distributed table
|
||||||
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
HINT: Use the distributed table or set citus.enable_manual_changes_to_shards to on to modify shards directly
|
||||||
RESET citus.enable_manual_changes_to_shards ;
|
RESET citus.enable_manual_changes_to_shards ;
|
||||||
-- these should work as expected
|
-- these should work as expected
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
DROP TABLE test_disabling_drop_and_truncate;
|
DROP TABLE test_disabling_drop_and_truncate;
|
||||||
-- test creating distributed or reference tables from shards
|
-- test creating distributed or reference tables from shards
|
||||||
CREATE TABLE test_creating_distributed_relation_table_from_shard (a int);
|
CREATE TABLE test_creating_distributed_relation_table_from_shard (a int);
|
||||||
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard', 'a');
|
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard', 'a');
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102044, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102044, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830504, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830504, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102045, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102045, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830505, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830505, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102046, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102046, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830506, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830506, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (102047, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (102047, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (90830507, 'single_node', 'CREATE TABLE single_node.test_creating_distributed_relation_table_from_shard (a integer) USING heap');SELECT worker_apply_shard_ddl_command (90830507, 'single_node', 'ALTER TABLE single_node.test_creating_distributed_relation_table_from_shard OWNER TO postgres')
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2142,11 +2144,11 @@ NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1
|
||||||
|
|
||||||
-- these should error because shards cannot be used to:
|
-- these should error because shards cannot be used to:
|
||||||
-- create distributed table
|
-- create distributed table
|
||||||
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_102044', 'a');
|
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_90830504', 'a');
|
||||||
ERROR: relation "test_creating_distributed_relation_table_from_shard_102044" is a shard relation
|
ERROR: relation "test_creating_distributed_relation_table_from_shard_90830504" is a shard relation
|
||||||
-- create reference table
|
-- create reference table
|
||||||
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_102044');
|
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_90830504');
|
||||||
ERROR: relation "test_creating_distributed_relation_table_from_shard_102044" is a shard relation
|
ERROR: relation "test_creating_distributed_relation_table_from_shard_90830504" is a shard relation
|
||||||
RESET citus.shard_replication_factor;
|
RESET citus.shard_replication_factor;
|
||||||
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
||||||
-- lets flush the copy often to make sure everyhing is fine
|
-- lets flush the copy often to make sure everyhing is fine
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CREATE SCHEMA single_node_truncate;
|
CREATE SCHEMA single_node_truncate;
|
||||||
SET search_path TO single_node_truncate;
|
SET search_path TO single_node_truncate;
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
|
SET citus.next_shard_id TO 91630500;
|
||||||
-- helper view that prints out local table names and sizes in the schema
|
-- helper view that prints out local table names and sizes in the schema
|
||||||
CREATE VIEW table_sizes AS
|
CREATE VIEW table_sizes AS
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -28,12 +29,12 @@ CREATE TABLE citus_local(id int, ref_id int REFERENCES ref(id));
|
||||||
INSERT INTO citus_local SELECT x,x FROM generate_series(1,10000) x;
|
INSERT INTO citus_local SELECT x,x FROM generate_series(1,10000) x;
|
||||||
-- verify that shell tables for citus local tables are empty
|
-- verify that shell tables for citus local tables are empty
|
||||||
SELECT * FROM table_sizes;
|
SELECT * FROM table_sizes;
|
||||||
name | has_data
|
name | has_data
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
citus_local | f
|
citus_local | f
|
||||||
citus_local_102049 | t
|
citus_local_91630501 | t
|
||||||
ref | t
|
ref | t
|
||||||
ref_102048 | t
|
ref_91630500 | t
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
-- verify that this UDF is noop on Citus local tables
|
-- verify that this UDF is noop on Citus local tables
|
||||||
|
@ -44,12 +45,12 @@ SELECT truncate_local_data_after_distributing_table('citus_local');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM table_sizes;
|
SELECT * FROM table_sizes;
|
||||||
name | has_data
|
name | has_data
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
citus_local | f
|
citus_local | f
|
||||||
citus_local_102049 | t
|
citus_local_91630501 | t
|
||||||
ref | t
|
ref | t
|
||||||
ref_102048 | t
|
ref_91630500 | t
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
-- test that we allow cascading truncates to citus local tables
|
-- test that we allow cascading truncates to citus local tables
|
||||||
|
@ -62,12 +63,12 @@ NOTICE: truncate cascades to table "citus_local"
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM table_sizes;
|
SELECT * FROM table_sizes;
|
||||||
name | has_data
|
name | has_data
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
citus_local | f
|
citus_local | f
|
||||||
citus_local_102049 | t
|
citus_local_91630501 | t
|
||||||
ref | f
|
ref | f
|
||||||
ref_102048 | t
|
ref_91630500 | t
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -95,17 +96,17 @@ NOTICE: truncate cascades to table "dist"
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM table_sizes;
|
SELECT * FROM table_sizes;
|
||||||
name | has_data
|
name | has_data
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
citus_local | f
|
citus_local | f
|
||||||
citus_local_102049 | t
|
citus_local_91630501 | t
|
||||||
dist | f
|
dist | f
|
||||||
dist_102051 | t
|
dist_91630503 | t
|
||||||
dist_102052 | t
|
dist_91630504 | t
|
||||||
dist_102053 | t
|
dist_91630505 | t
|
||||||
dist_102054 | t
|
dist_91630506 | t
|
||||||
ref | f
|
ref | f
|
||||||
ref_102048 | t
|
ref_91630500 | t
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -118,17 +119,17 @@ SELECT truncate_local_data_after_distributing_table('dist');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM table_sizes;
|
SELECT * FROM table_sizes;
|
||||||
name | has_data
|
name | has_data
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
citus_local | f
|
citus_local | f
|
||||||
citus_local_102049 | t
|
citus_local_91630501 | t
|
||||||
dist | f
|
dist | f
|
||||||
dist_102051 | t
|
dist_91630503 | t
|
||||||
dist_102052 | t
|
dist_91630504 | t
|
||||||
dist_102053 | t
|
dist_91630505 | t
|
||||||
dist_102054 | t
|
dist_91630506 | t
|
||||||
ref | t
|
ref | t
|
||||||
ref_102048 | t
|
ref_91630500 | t
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
|
@ -975,6 +975,7 @@ SELECT pg_sleep(0.1);
|
||||||
-- backend(s) that execute on the shards will be terminated
|
-- backend(s) that execute on the shards will be terminated
|
||||||
-- so show that there no internal backends
|
-- so show that there no internal backends
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90730500;
|
||||||
SELECT count(*) from should_commit;
|
SELECT count(*) from should_commit;
|
||||||
SELECT count(*) FROM pg_stat_activity WHERE application_name LIKE 'citus_internal%';
|
SELECT count(*) FROM pg_stat_activity WHERE application_name LIKE 'citus_internal%';
|
||||||
SELECT get_all_active_client_backend_count();
|
SELECT get_all_active_client_backend_count();
|
||||||
|
@ -998,6 +999,7 @@ ROLLBACK;
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
SET search_path TO single_node;
|
SET search_path TO single_node;
|
||||||
|
SET citus.next_shard_id TO 90830500;
|
||||||
|
|
||||||
-- simulate that even if there is no connection slots
|
-- simulate that even if there is no connection slots
|
||||||
-- to connect, Citus can switch to local execution
|
-- to connect, Citus can switch to local execution
|
||||||
|
@ -1069,14 +1071,14 @@ SELECT create_distributed_table('test_disabling_drop_and_truncate', 'a');
|
||||||
SET citus.enable_manual_changes_to_shards TO off;
|
SET citus.enable_manual_changes_to_shards TO off;
|
||||||
|
|
||||||
-- these should error out
|
-- these should error out
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
|
|
||||||
RESET citus.enable_manual_changes_to_shards ;
|
RESET citus.enable_manual_changes_to_shards ;
|
||||||
|
|
||||||
-- these should work as expected
|
-- these should work as expected
|
||||||
TRUNCATE TABLE test_disabling_drop_and_truncate_102040;
|
TRUNCATE TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
DROP TABLE test_disabling_drop_and_truncate_102040;
|
DROP TABLE test_disabling_drop_and_truncate_90830500;
|
||||||
|
|
||||||
DROP TABLE test_disabling_drop_and_truncate;
|
DROP TABLE test_disabling_drop_and_truncate;
|
||||||
|
|
||||||
|
@ -1086,10 +1088,10 @@ SELECT create_distributed_table('test_creating_distributed_relation_table_from_s
|
||||||
|
|
||||||
-- these should error because shards cannot be used to:
|
-- these should error because shards cannot be used to:
|
||||||
-- create distributed table
|
-- create distributed table
|
||||||
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_102044', 'a');
|
SELECT create_distributed_table('test_creating_distributed_relation_table_from_shard_90830504', 'a');
|
||||||
|
|
||||||
-- create reference table
|
-- create reference table
|
||||||
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_102044');
|
SELECT create_reference_table('test_creating_distributed_relation_table_from_shard_90830504');
|
||||||
|
|
||||||
RESET citus.shard_replication_factor;
|
RESET citus.shard_replication_factor;
|
||||||
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
DROP TABLE test_creating_distributed_relation_table_from_shard;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CREATE SCHEMA single_node_truncate;
|
CREATE SCHEMA single_node_truncate;
|
||||||
SET search_path TO single_node_truncate;
|
SET search_path TO single_node_truncate;
|
||||||
SET citus.shard_replication_factor TO 1;
|
SET citus.shard_replication_factor TO 1;
|
||||||
|
SET citus.next_shard_id TO 91630500;
|
||||||
|
|
||||||
-- helper view that prints out local table names and sizes in the schema
|
-- helper view that prints out local table names and sizes in the schema
|
||||||
CREATE VIEW table_sizes AS
|
CREATE VIEW table_sizes AS
|
||||||
|
|
Loading…
Reference in New Issue