diff --git a/mysql-test/suite/rpl/r/bug99200.result b/mysql-test/suite/rpl/r/bug99200.result new file mode 100644 index 00000000000..230b50f69a6 --- /dev/null +++ b/mysql-test/suite/rpl/r/bug99200.result @@ -0,0 +1,12 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +create database bug111; +CREATE USER `bugddl`@`localhost` IDENTIFIED BY 'S0meRand0mPWD!'; +include/sync_slave_sql_with_master.inc +include/assert.inc [Check that CREATE USER statement has been removed from processlist.] +DROP USER `bugddl`@`localhost`; +DROP DATABASE bug111; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/bug99200.test b/mysql-test/suite/rpl/t/bug99200.test new file mode 100644 index 00000000000..06d89d970b4 --- /dev/null +++ b/mysql-test/suite/rpl/t/bug99200.test @@ -0,0 +1,16 @@ +--source include/master-slave.inc + +connection master; +create database bug111; +CREATE USER `bugddl`@`localhost` IDENTIFIED BY 'S0meRand0mPWD!'; + +--source include/sync_slave_sql_with_master.inc +--let $assert_text= Check that CREATE USER statement has been removed from processlist. +--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.threads WHERE PROCESSLIST_INFO LIKE "CREATE USER%"] = 0 +--source include/assert.inc + +# Cleanup +connection master; +DROP USER `bugddl`@`localhost`; +DROP DATABASE bug111; +--source include/rpl_end.inc diff --git a/sql/log_event.cc b/sql/log_event.cc index b8ec7b2a4e7..4c21625a2d2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5048,6 +5048,12 @@ end: thd->set_catalog(NULL_CSTR); thd->set_db(NULL_CSTR); /* will free the current database */ thd->reset_query(); + /* + Prevent rewritten query from getting "stuck" in SHOW PROCESSLIST, + and performance_schema.threads. + */ + thd->rewritten_query.mem_free(); + thd->reset_query_for_display(); thd->lex->sql_command = SQLCOM_END; DBUG_PRINT("info", ("end: query= 0"));