mirror of https://github.com/citusdata/citus.git
120 lines
3.8 KiB
Plaintext
120 lines
3.8 KiB
Plaintext
Parsed test spec with 3 sessions
|
|
|
|
starting permutation: s1-grant s1-begin-insert s2-begin-insert s3-as-admin s3-as-user-1 s3-as-readonly s3-as-monitor s1-commit s2-commit
|
|
run_command_on_workers
|
|
---------------------------------------------------------------------
|
|
(localhost,57637,t,"GRANT ROLE")
|
|
(localhost,57638,t,"GRANT ROLE")
|
|
(2 rows)
|
|
|
|
step s1-grant:
|
|
GRANT ALL ON test_table TO test_user_1;
|
|
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_1');
|
|
GRANT ALL ON test_table TO test_user_2;
|
|
SELECT bool_and(success) FROM run_command_on_placements('test_table', 'GRANT ALL ON TABLE %s TO test_user_2');
|
|
|
|
bool_and
|
|
---------------------------------------------------------------------
|
|
t
|
|
(1 row)
|
|
|
|
bool_and
|
|
---------------------------------------------------------------------
|
|
t
|
|
(1 row)
|
|
|
|
step s1-begin-insert:
|
|
BEGIN;
|
|
SET ROLE test_user_1;
|
|
INSERT INTO test_table VALUES (100, 100);
|
|
|
|
step s2-begin-insert:
|
|
BEGIN;
|
|
SET ROLE test_user_2;
|
|
INSERT INTO test_table VALUES (200, 200);
|
|
|
|
step s3-as-admin:
|
|
-- Admin should be able to see all transactions
|
|
SELECT count(*) FROM get_all_active_transactions() WHERE transaction_number != 0;
|
|
SELECT count(*) FROM get_global_active_transactions() WHERE transaction_number != 0;
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
2
|
|
(1 row)
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
4
|
|
(1 row)
|
|
|
|
step s3-as-user-1:
|
|
-- Eventhough we change the user via SET ROLE, the backends' (e.g., s1/2-begin-insert)
|
|
-- userId (e.g., PG_PROC->userId) does not change, and hence none of the
|
|
-- transactions show up because here we are using test_user_1. This is a
|
|
-- limitation of isolation tester, we should be able to re-connect with
|
|
-- test_user_1 on s1/2-begin-insert to show that test_user_1 sees only its own processes
|
|
SET ROLE test_user_1;
|
|
SELECT count(*) FROM get_all_active_transactions() WHERE transaction_number != 0;
|
|
SELECT count(*) FROM get_global_active_transactions() WHERE transaction_number != 0;
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
0
|
|
(1 row)
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
1
|
|
(1 row)
|
|
|
|
step s3-as-readonly:
|
|
-- Eventhough we change the user via SET ROLE, the backends' (e.g., s1/2-begin-insert)
|
|
-- userId (e.g., PG_PROC->userId) does not change, and hence none of the
|
|
-- transactions show up because here we are using test_readonly. This is a
|
|
-- limitation of isolation tester, we should be able to re-connect with
|
|
-- test_readonly on s1/2-begin-insert to show that test_readonly sees only
|
|
-- its own processes
|
|
SET ROLE test_readonly;
|
|
SELECT count(*) FROM get_all_active_transactions() WHERE transaction_number != 0;
|
|
SELECT count(*) FROM get_global_active_transactions() WHERE transaction_number != 0;
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
0
|
|
(1 row)
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
0
|
|
(1 row)
|
|
|
|
step s3-as-monitor:
|
|
-- Monitor should see all transactions
|
|
SET ROLE test_monitor;
|
|
SELECT count(*) FROM get_all_active_transactions() WHERE transaction_number != 0;
|
|
SELECT count(*) FROM get_global_active_transactions() WHERE transaction_number != 0;
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
2
|
|
(1 row)
|
|
|
|
count
|
|
---------------------------------------------------------------------
|
|
4
|
|
(1 row)
|
|
|
|
step s1-commit:
|
|
COMMIT;
|
|
|
|
step s2-commit:
|
|
COMMIT;
|
|
|
|
run_command_on_workers
|
|
---------------------------------------------------------------------
|
|
(localhost,57637,f,"ERROR: role ""test_user_1"" cannot be dropped because some objects depend on it")
|
|
(localhost,57638,f,"ERROR: role ""test_user_1"" cannot be dropped because some objects depend on it")
|
|
(2 rows)
|
|
|