1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35617: DROP USER should leave no active session for that user

DROP USER looks for sessions by the do-be-dropped user and if found:
* fails with ER_CANNOT_USER in Oracle mode
* continues with ER_ACTIVE_CONNECTIONS_FOR_USER_TO_DROP warning otherwise

Every user being dropped is marked with flag that disallow establishing
a new connections on behalf this user.
This commit is contained in:
Dmitry Shulga
2025-05-28 00:05:05 +07:00
parent e3d9369774
commit ce7ab467db
51 changed files with 410 additions and 6 deletions

View File

@@ -54,6 +54,8 @@ ERROR HY000: String 'воттакойужпарольвоттакойужпар
connection master;
set sql_log_bin=0;
drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1;
Warnings:
Note 4227 Dropped users 'rpl16cyr'@'127.0.0.1' have active connections. Use KILL CONNECTION if they should not be used anymore.
set sql_log_bin=1;
connection slave;
change master to master_user='root',master_password='';

View File

@@ -57,6 +57,8 @@ include/assert.inc [Value returned by SSS and PS table for SSL_Key should be sam
include/assert.inc [Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.]
connection master;
drop user replssl@localhost;
Warnings:
Note 4227 Dropped users 'replssl'@'localhost' have active connections. Use KILL CONNECTION if they should not be used anymore.
connection slave;
include/stop_slave.inc
CHANGE MASTER TO

View File

@@ -22,6 +22,8 @@ connection slave;
connection master;
"Command: SHOW SLAVE HOSTS --> SHOW REPLICA HOSTS"
DROP USER 'repl_user';
Warnings:
Note 4227 Dropped users 'repl_user'@'%' have active connections. Use KILL CONNECTION if they should not be used anymore.
connection slave;
"Command: SHOW SLAVE IO/SQL THREAD --> SHOW REPLICA IO/SQL THREAD"
STOP REPLICA IO_THREAD;

View File

@@ -18,6 +18,8 @@ include/check_slave_param.inc [Slave_IO_Running]
connection master;
SET SQL_LOG_BIN=0;
DROP USER rpl@127.0.0.1;
Warnings:
Note 4227 Dropped users 'rpl'@'127.0.0.1' have active connections. Use KILL CONNECTION if they should not be used anymore.
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
connection slave;

View File

@@ -30,6 +30,8 @@ n
==== Delete new replication user ====
connection master;
DROP USER rpl@127.0.0.1;
Warnings:
Note 4227 Dropped users 'rpl'@'127.0.0.1' have active connections. Use KILL CONNECTION if they should not be used anymore.
FLUSH PRIVILEGES;
connection slave;
==== Restart slave without privileges =====

View File

@@ -46,6 +46,8 @@ Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
connection master;
drop user replssl@localhost;
Warnings:
Note 4227 Dropped users 'replssl'@'localhost' have active connections. Use KILL CONNECTION if they should not be used anymore.
drop table t1;
connection slave;
include/stop_slave.inc
@@ -55,5 +57,5 @@ master_ssl = 1,
master_ssl_ca = '',
master_ssl_cert = '',
master_ssl_key = '';
End of 5.0 tests
# End of 5.0 tests
include/rpl_end.inc

View File

@@ -112,6 +112,8 @@ master_ssl_verify_server_cert=0,
master_ssl=1;
connection master;
drop user replssl@127.0.0.1;
Warnings:
Note 4227 Dropped users 'replssl'@'127.0.0.1' have active connections. Use KILL CONNECTION if they should not be used anymore.
connection slave;
drop user replssl@127.0.0.1;
include/rpl_end.inc

View File

@@ -61,7 +61,9 @@ change master to master_user='root',master_password='', master_ssl=0;
start slave;
--source include/wait_for_slave_to_start.inc
connection master;
disable_warnings;
drop user replssl@localhost;
enable_warnings;
drop table t1;
sync_slave_with_master;