Fixes other tests

pull/7204/head
gindibay 2023-09-18 12:52:16 +03:00
parent aef36116ba
commit aa9f997441
3 changed files with 51 additions and 21 deletions

View File

@ -1324,6 +1324,11 @@ PreprocessAlterRoleRenameStmt(Node *node, const char *queryString,
return NIL; return NIL;
} }
if(!EnableAlterRolePropagation)
{
return NIL;
}
RenameStmt *stmt = castNode(RenameStmt, node); RenameStmt *stmt = castNode(RenameStmt, node);
Assert(stmt->renameType == OBJECT_ROLE); Assert(stmt->renameType == OBJECT_ROLE);
@ -1352,3 +1357,4 @@ RenameRoleStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess)
return list_make1(address); return list_make1(address);
} }

View File

@ -1200,8 +1200,9 @@ SET citus.override_table_visibility TO false;
-- and rename the existing user -- and rename the existing user
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user RENAME TO test_user_new; ALTER USER test_user RENAME TO test_user_new;
NOTICE: not propagating ALTER ROLE ... RENAME TO commands to worker nodes set citus.enable_alter_role_propagation=true;
-- connect back to master and query the reference table -- connect back to master and query the reference table
\c - test_user - :master_port \c - test_user - :master_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
@ -1320,8 +1321,9 @@ WARNING: connection to the remote node localhost:xxxxx failed with the followin
-- break the other node as well -- break the other node as well
\c - :default_user - :worker_2_port \c - :default_user - :worker_2_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user RENAME TO test_user_new; ALTER USER test_user RENAME TO test_user_new;
NOTICE: not propagating ALTER ROLE ... RENAME TO commands to worker nodes set citus.enable_alter_role_propagation=true;
\c - test_user - :master_port \c - test_user - :master_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
-- fails on all shard placements -- fails on all shard placements
@ -1333,13 +1335,18 @@ SET search_path TO multi_modifying_xacts;
SET citus.next_shard_id TO 1200020; SET citus.next_shard_id TO 1200020;
SET citus.next_placement_id TO 1200033; SET citus.next_placement_id TO 1200033;
-- unbreak both nodes by renaming the user back to the original name -- unbreak both nodes by renaming the user back to the original name
SELECT * FROM run_command_on_workers('ALTER USER test_user_new RENAME TO test_user'); \c - :default_user - :worker_2_port
nodename | nodeport | success | result SET search_path TO multi_modifying_xacts;
--------------------------------------------------------------------- set citus.enable_alter_role_propagation=false;
localhost | 57637 | t | ALTER ROLE ALTER USER test_user_new RENAME TO test_user;
localhost | 57638 | t | ALTER ROLE set citus.enable_alter_role_propagation=true;
(2 rows) \c - :default_user - :worker_1_port
SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user_new RENAME TO test_user;
set citus.enable_alter_role_propagation=true;
\c - :default_user - :master_port
SET search_path TO multi_modifying_xacts;
DROP TABLE reference_modifying_xacts, hash_modifying_xacts, hash_modifying_xacts_second, DROP TABLE reference_modifying_xacts, hash_modifying_xacts, hash_modifying_xacts_second,
reference_failure_test, numbers_hash_failure_test; reference_failure_test, numbers_hash_failure_test;
REVOKE ALL ON SCHEMA multi_modifying_xacts FROM test_user; REVOKE ALL ON SCHEMA multi_modifying_xacts FROM test_user;
@ -1402,18 +1409,18 @@ JOIN
USING (shardid) USING (shardid)
ORDER BY ORDER BY
id; id;
id | shard_name | nodename | nodeport id | shard_name | nodename | nodeport
--------------------------------------------------------------------- ---------------------------------------------------------------------
1 | multi_modifying_xacts.users_1200022 | localhost | 57637 1 | multi_modifying_xacts.users_102014 | localhost | 57637
2 | multi_modifying_xacts.users_1200025 | localhost | 57638 2 | multi_modifying_xacts.users_102017 | localhost | 57638
3 | multi_modifying_xacts.users_1200023 | localhost | 57638 3 | multi_modifying_xacts.users_102015 | localhost | 57638
4 | multi_modifying_xacts.users_1200023 | localhost | 57638 4 | multi_modifying_xacts.users_102015 | localhost | 57638
5 | multi_modifying_xacts.users_1200022 | localhost | 57637 5 | multi_modifying_xacts.users_102014 | localhost | 57637
6 | multi_modifying_xacts.users_1200024 | localhost | 57637 6 | multi_modifying_xacts.users_102016 | localhost | 57637
7 | multi_modifying_xacts.users_1200023 | localhost | 57638 7 | multi_modifying_xacts.users_102015 | localhost | 57638
8 | multi_modifying_xacts.users_1200022 | localhost | 57637 8 | multi_modifying_xacts.users_102014 | localhost | 57637
9 | multi_modifying_xacts.users_1200025 | localhost | 57638 9 | multi_modifying_xacts.users_102017 | localhost | 57638
10 | multi_modifying_xacts.users_1200022 | localhost | 57637 10 | multi_modifying_xacts.users_102014 | localhost | 57637
(10 rows) (10 rows)
END; END;

View File

@ -981,7 +981,9 @@ SET citus.override_table_visibility TO false;
-- and rename the existing user -- and rename the existing user
\c - :default_user - :worker_1_port \c - :default_user - :worker_1_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user RENAME TO test_user_new; ALTER USER test_user RENAME TO test_user_new;
set citus.enable_alter_role_propagation=true;
-- connect back to master and query the reference table -- connect back to master and query the reference table
\c - test_user - :master_port \c - test_user - :master_port
@ -1050,7 +1052,9 @@ SELECT count(*) FROM numbers_hash_failure_test;
-- break the other node as well -- break the other node as well
\c - :default_user - :worker_2_port \c - :default_user - :worker_2_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user RENAME TO test_user_new; ALTER USER test_user RENAME TO test_user_new;
set citus.enable_alter_role_propagation=true;
\c - test_user - :master_port \c - test_user - :master_port
SET search_path TO multi_modifying_xacts; SET search_path TO multi_modifying_xacts;
@ -1064,7 +1068,20 @@ SET search_path TO multi_modifying_xacts;
SET citus.next_shard_id TO 1200020; SET citus.next_shard_id TO 1200020;
SET citus.next_placement_id TO 1200033; SET citus.next_placement_id TO 1200033;
-- unbreak both nodes by renaming the user back to the original name -- unbreak both nodes by renaming the user back to the original name
SELECT * FROM run_command_on_workers('ALTER USER test_user_new RENAME TO test_user'); \c - :default_user - :worker_2_port
SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user_new RENAME TO test_user;
set citus.enable_alter_role_propagation=true;
\c - :default_user - :worker_1_port
SET search_path TO multi_modifying_xacts;
set citus.enable_alter_role_propagation=false;
ALTER USER test_user_new RENAME TO test_user;
set citus.enable_alter_role_propagation=true;
\c - :default_user - :master_port
SET search_path TO multi_modifying_xacts;
DROP TABLE reference_modifying_xacts, hash_modifying_xacts, hash_modifying_xacts_second, DROP TABLE reference_modifying_xacts, hash_modifying_xacts, hash_modifying_xacts_second,
reference_failure_test, numbers_hash_failure_test; reference_failure_test, numbers_hash_failure_test;