Fix tenant isolation failure tests

pull/6137/head
Marco Slot 2022-08-05 18:47:10 +02:00 committed by Marco Slot
parent ead9d28835
commit 6aee8f35a6
2 changed files with 20 additions and 22 deletions

View File

@ -10,6 +10,7 @@ SET SEARCH_PATH = tenant_isolation;
SET citus.shard_count TO 2;
SET citus.next_shard_id TO 300;
SET citus.shard_replication_factor TO 1;
SET citus.max_adaptive_executor_pool_size TO 1;
SELECT pg_backend_pid() as pid \gset
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
@ -59,7 +60,7 @@ SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
-- cancellation on colocated table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_2").after(1).cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_2").cancel(' || :pid || ')');
mitmproxy
---------------------------------------------------------------------
@ -68,17 +69,16 @@ SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: canceling statement due to user request
-- failure on colocated table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_2").after(2).kill()');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(302").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
ERROR: connection to the remote node localhost:xxxxx failed with the following error: connection not open
-- cancellation on colocated table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_2").cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(302").cancel(' || :pid || ')');
mitmproxy
---------------------------------------------------------------------
@ -94,8 +94,7 @@ SELECT citus.mitmproxy('conn.onQuery(query="ALTER TABLE tenant_isolation.table_2
(1 row)
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
ERROR: connection to the remote node localhost:xxxxx failed with the following error: connection not open
-- cancellation on colocated table constraints
SELECT citus.mitmproxy('conn.onQuery(query="ALTER TABLE tenant_isolation.table_2 ADD CONSTRAINT").after(2).cancel(' || :pid || ')');
mitmproxy
@ -116,7 +115,7 @@ SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
-- cancellation on table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_1").after(1).cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_1").cancel(' || :pid || ')');
mitmproxy
---------------------------------------------------------------------
@ -125,17 +124,16 @@ SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: canceling statement due to user request
-- failure on table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_1").after(2).kill()');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(300").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
ERROR: connection to the remote node localhost:xxxxx failed with the following error: connection not open
-- cancellation on table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_1").cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(300").cancel(' || :pid || ')');
mitmproxy
---------------------------------------------------------------------
@ -151,8 +149,7 @@ SELECT citus.mitmproxy('conn.onQuery(query="ALTER TABLE tenant_isolation.table_1
(1 row)
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
ERROR: connection not open
CONTEXT: while executing command on localhost:xxxxx
ERROR: connection to the remote node localhost:xxxxx failed with the following error: connection not open
-- cancellation on table constraints
SELECT citus.mitmproxy('conn.onQuery(query="ALTER TABLE tenant_isolation.table_1 ADD CONSTRAINT").after(2).cancel(' || :pid || ')');
mitmproxy
@ -323,8 +320,8 @@ DO LANGUAGE plpgsql
$$
BEGIN
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
EXCEPTION WHEN OTHERS THEN
RAISE 'Command failed to execute';
EXCEPTION WHEN OTHERS THEN
RAISE 'Command failed to execute';
END;
$$;
ERROR: Command failed to execute

View File

@ -12,6 +12,7 @@ SET SEARCH_PATH = tenant_isolation;
SET citus.shard_count TO 2;
SET citus.next_shard_id TO 300;
SET citus.shard_replication_factor TO 1;
SET citus.max_adaptive_executor_pool_size TO 1;
SELECT pg_backend_pid() as pid \gset
SELECT citus.mitmproxy('conn.allow()');
@ -41,15 +42,15 @@ SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- cancellation on colocated table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_2").after(1).cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_2").cancel(' || :pid || ')');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- failure on colocated table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_2").after(2).kill()');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(302").kill()');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- cancellation on colocated table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_2").cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(302").cancel(' || :pid || ')');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- failure on colocated table constraints
@ -66,15 +67,15 @@ SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- cancellation on table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_1").after(1).cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE tenant_isolation.table_1").cancel(' || :pid || ')');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- failure on table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_1").after(2).kill()');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(300").kill()');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- cancellation on table population
SELECT citus.mitmproxy('conn.onQuery(query="INSERT INTO tenant_isolation.table_1").cancel(' || :pid || ')');
SELECT citus.mitmproxy('conn.onQuery(query="worker_split_copy\(300").cancel(' || :pid || ')');
SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE');
-- failure on table constraints