Move isolation_multiuser_locking to MX tests

pull/5678/head
Onder Kalaci 2022-02-03 11:17:11 +01:00
parent bcb00e3318
commit 923bb194a4
4 changed files with 150 additions and 102 deletions

View File

@ -2,295 +2,337 @@ Parsed test spec with 2 sessions
starting permutation: s1-begin s2-begin s2-reindex s1-insert s2-commit s1-commit
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s2-reindex:
REINDEX TABLE test_table;
REINDEX TABLE test_table;
ERROR: must be owner of table test_table
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s2-commit:
COMMIT;
COMMIT;
step s1-commit:
COMMIT;
COMMIT;
starting permutation: s1-grant s1-begin s2-begin s2-reindex s1-insert s2-insert s2-commit s1-commit
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s2-reindex:
REINDEX TABLE test_table;
REINDEX TABLE test_table;
ERROR: must be owner of table test_table
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s2-insert:
UPDATE test_table SET column2 = 2;
UPDATE test_table SET column2 = 2;
ERROR: current transaction is aborted, commands ignored until end of transaction block
step s2-commit:
COMMIT;
COMMIT;
step s1-commit:
COMMIT;
COMMIT;
starting permutation: s1-grant s1-begin s2-begin s1-reindex s2-insert s1-insert s1-commit s2-commit
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s1-reindex:
REINDEX TABLE test_table;
REINDEX TABLE test_table;
step s2-insert:
UPDATE test_table SET column2 = 2;
UPDATE test_table SET column2 = 2;
<waiting ...>
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s1-commit:
COMMIT;
COMMIT;
step s2-insert: <... completed>
step s2-commit:
COMMIT;
COMMIT;
starting permutation: s1-begin s2-begin s2-index s1-insert s2-commit s1-commit s2-drop-index
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s2-index:
CREATE INDEX test_index ON test_table(column1);
CREATE INDEX test_index ON test_table(column1);
ERROR: must be owner of table test_table
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s2-commit:
COMMIT;
COMMIT;
step s1-commit:
COMMIT;
COMMIT;
step s2-drop-index:
DROP INDEX IF EXISTS test_index;
DROP INDEX IF EXISTS test_index;
starting permutation: s1-grant s1-begin s2-begin s2-insert s1-index s2-insert s2-commit s1-commit s1-drop-index
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s2-insert:
UPDATE test_table SET column2 = 2;
UPDATE test_table SET column2 = 2;
step s1-index:
CREATE INDEX test_index ON test_table(column1);
CREATE INDEX test_index ON test_table(column1);
<waiting ...>
step s2-insert:
UPDATE test_table SET column2 = 2;
UPDATE test_table SET column2 = 2;
step s2-commit:
COMMIT;
COMMIT;
step s1-index: <... completed>
step s1-commit:
COMMIT;
COMMIT;
step s1-drop-index:
DROP INDEX IF EXISTS test_index;
DROP INDEX IF EXISTS test_index;
starting permutation: s1-grant s1-begin s2-begin s1-index s2-index s1-insert s1-commit s2-commit s1-drop-index s2-drop-index
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s1-index:
CREATE INDEX test_index ON test_table(column1);
CREATE INDEX test_index ON test_table(column1);
step s2-index:
CREATE INDEX test_index ON test_table(column1);
CREATE INDEX test_index ON test_table(column1);
ERROR: must be owner of table test_table
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s1-commit:
COMMIT;
COMMIT;
step s2-commit:
COMMIT;
COMMIT;
step s1-drop-index:
DROP INDEX IF EXISTS test_index;
DROP INDEX IF EXISTS test_index;
step s2-drop-index:
DROP INDEX IF EXISTS test_index;
DROP INDEX IF EXISTS test_index;
starting permutation: s1-begin s2-begin s2-truncate s1-insert s2-commit s1-commit
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s2-truncate:
TRUNCATE test_table;
TRUNCATE test_table;
ERROR: permission denied for table test_table
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s2-commit:
COMMIT;
COMMIT;
step s1-commit:
COMMIT;
COMMIT;
starting permutation: s1-grant s1-begin s2-begin s1-truncate s2-insert s1-insert s1-commit s2-commit
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s1-truncate:
TRUNCATE test_table;
TRUNCATE test_table;
step s2-insert:
UPDATE test_table SET column2 = 2;
UPDATE test_table SET column2 = 2;
<waiting ...>
step s1-insert:
UPDATE test_table SET column2 = 1;
UPDATE test_table SET column2 = 1;
step s1-commit:
COMMIT;
COMMIT;
step s2-insert: <... completed>
step s2-commit:
COMMIT;
COMMIT;
starting permutation: s1-grant s1-begin s2-begin s1-truncate s2-truncate s1-commit s2-commit
step s1-grant:
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
bool_and
---------------------------------------------------------------------
t
(1 row)
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
(2 rows)
step s1-begin:
BEGIN;
SET ROLE test_user_1;
BEGIN;
SET ROLE test_user_1;
step s2-begin:
BEGIN;
SET ROLE test_user_2;
BEGIN;
SET ROLE test_user_2;
step s1-truncate:
TRUNCATE test_table;
TRUNCATE test_table;
step s2-truncate:
TRUNCATE test_table;
TRUNCATE test_table;
<waiting ...>
step s1-commit:
COMMIT;
COMMIT;
step s2-truncate: <... completed>
step s2-commit:
COMMIT;
COMMIT;

View File

@ -103,8 +103,8 @@ step s2-view-worker:
query |query_hostname |query_hostport|distributed_query_host_name|distributed_query_host_port|state |wait_event_type|wait_event|usename |datname
---------------------------------------------------------------------
UPDATE public.ref_table_1500767 ref_table SET a = (a OPERATOR(pg_catalog.+) 1)|localhost | 57638|coordinator_host | 57636|idle in transaction|Client |ClientRead|postgres|regression
UPDATE public.ref_table_1500767 ref_table SET a = (a OPERATOR(pg_catalog.+) 1)|localhost | 57637|coordinator_host | 57636|idle in transaction|Client |ClientRead|postgres|regression
UPDATE public.ref_table_1500803 ref_table SET a = (a OPERATOR(pg_catalog.+) 1)|localhost | 57638|coordinator_host | 57636|idle in transaction|Client |ClientRead|postgres|regression
UPDATE public.ref_table_1500803 ref_table SET a = (a OPERATOR(pg_catalog.+) 1)|localhost | 57637|coordinator_host | 57636|idle in transaction|Client |ClientRead|postgres|regression
(2 rows)
step s2-end:

View File

@ -89,6 +89,7 @@ test: isolation_ref_update_delete_upsert_vs_all_on_mx
test: isolation_dis2ref_foreign_keys_on_mx
test: isolation_metadata_sync_deadlock
test: isolation_replicated_dist_on_mx
test: isolation_multiuser_locking
# MXless tests
test: isolation_check_mx
@ -96,4 +97,3 @@ test: isolation_replicate_reference_tables_to_coordinator
test: isolation_turn_mx_off
test: isolation_reference_copy_vs_all
test: isolation_ref2ref_foreign_keys
test: isolation_multiuser_locking

View File

@ -1,5 +1,8 @@
setup
{
SELECT citus_internal.replace_isolation_tester_func();
SELECT citus_internal.refresh_isolation_tester_prepared_statement();
SET citus.shard_replication_factor TO 1;
CREATE USER test_user_1;
@ -16,6 +19,8 @@ setup
teardown
{
SELECT citus_internal.restore_isolation_tester_func();
BEGIN;
DROP TABLE IF EXISTS test_table;
DROP USER test_user_1, test_user_2;
@ -31,6 +36,7 @@ step "s1-grant"
SET ROLE test_user_1;
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
GRANT ALL ON test_table TO test_user_2;
SELECT run_command_on_workers($$SET citus.enable_metadata_sync TO off; GRANT ALL ON test_table TO test_user_2;$$);
}
step "s1-begin"