mariadb/mysql-test/main/grant_master_admin.result
Dmitry Shulga eeb00ceffd MDEV-35617: DROP USER should leave no active session for that user
Follow-up patch with adjustments of test files and updates of result
files for tests.

Some of tests were rewritten slighlty. Everywhere where common
pattern used:
-----
  CREATE USER userA;
  --connect con1 ... userA ...
   <sql statements...>
  --disconnect con1
  DROP USER userA;
-----
the DROP USER statement has been eclosed into the directive
--disable_warnings
--enable_warnings

This change is caused by the race conddition between --disconnect
and DROP USER since a number of currently running sessions
established on behalf the user being dropped is counted by
holding the rw_lock THD_list_iterator::lock that is not acquired on
execution the DROP USER statement but the lock is taken as the last
step on handling disconnection (when the client is already sending
the next statement). Therefore, for the cases where the command
 --disconnect precedes the DROP USER statement
we hide the possible warnings about presence of active sessions
for the user being deleted to make tests deterministic.
2025-06-09 18:24:28 +07:00

38 lines
1.2 KiB
Text

#
# Start of 10.5 tests
#
#
# MDEV-21743 Split up SUPER privilege to smaller privileges
#
#
# Test that master admin statements are not allowed without REPLICATION MASTER ADMIN
#
CREATE USER user1@localhost IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
REVOKE REPLICATION MASTER ADMIN ON *.* FROM user1@localhost;
connect con1,localhost,user1,,;
connection con1;
SHOW SLAVE HOSTS;
ERROR 42000: Access denied; you need (at least one of) the REPLICATION MASTER ADMIN privilege(s) for this operation
disconnect con1;
connection default;
DROP USER user1@localhost;
#
# Test that master admin statements are allowed with REPLICATION MASTER ADMIN
#
CREATE USER user1@localhost IDENTIFIED BY '';
GRANT REPLICATION MASTER ADMIN ON *.* TO user1@localhost;
SHOW GRANTS FOR user1@localhost;
Grants for user1@localhost
GRANT REPLICATION MASTER ADMIN ON *.* TO `user1`@`localhost`
connect con1,localhost,user1,,;
connection con1;
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
connection default;
DROP USER user1@localhost;
Warnings:
Note 4226 Dropped users ['user1'@'localhost'] have active connections. Use KILL CONNECTION if they should not be used anymore.
#
# End of 10.5 tests
#