summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authordlenev@mysql.com <>2005-09-02 01:23:31 +0400
committerdlenev@mysql.com <>2005-09-02 01:23:31 +0400
commitc30c6321177c0fa03f373115e786eb442a396b20 (patch)
treea2563a2d77b712c12783d5134848f995551b2041 /mysql-test
parent4b677dfa593ada97dc0f7b228b461f90ee6c011a (diff)
parent9dcae4c09b1fbc99415e459f683a2adcfb5e6209 (diff)
downloadmariadb-git-c30c6321177c0fa03f373115e786eb442a396b20.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-merges
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/grant2.result9
-rw-r--r--mysql-test/t/grant2.test43
2 files changed, 52 insertions, 0 deletions
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 7ac10de1f7c..ca375ef5057 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -312,3 +312,12 @@ flush privileges;
drop database mysqltest_1;
set password = password("changed");
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
+lock table mysql.user write;
+ flush privileges;
+ grant all on *.* to 'mysqltest_1'@'localhost';
+unlock tables;
+lock table mysql.user write;
+ set password for 'mysqltest_1'@'localhost' = password('');
+ revoke all on *.* from 'mysqltest_1'@'localhost';
+unlock tables;
+drop user 'mysqltest_1'@'localhost';
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index ee9cd1924c6..2fa82ce5dce 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -351,4 +351,47 @@ set password = password("changed");
disconnect n5;
connection default;
+
+# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
+# multi-threaded environment". We should be able to execute FLUSH
+# PRIVILEGES and SET PASSWORD simultaneously with other account
+# management commands (such as GRANT and REVOKE) without causing
+# deadlocks. To achieve this we should ensure that all account
+# management commands take table and internal locks in the same order.
+connect (con2root,localhost,root,,);
+connect (con3root,localhost,root,,);
+# Check that we can execute FLUSH PRIVILEGES and GRANT simultaneously
+# This will check that locks are taken in proper order during both
+# user/db-level and table/column-level privileges reloading.
+connection default;
+lock table mysql.user write;
+connection con2root;
+send flush privileges;
+connection con3root;
+send grant all on *.* to 'mysqltest_1'@'localhost';
+connection default;
+unlock tables;
+connection con2root;
+reap;
+connection con3root;
+reap;
+# Check for simultaneous SET PASSWORD and REVOKE.
+connection default;
+lock table mysql.user write;
+connection con2root;
+send set password for 'mysqltest_1'@'localhost' = password('');
+connection con3root;
+send revoke all on *.* from 'mysqltest_1'@'localhost';
+connection default;
+unlock tables;
+connection con2root;
+reap;
+connection con3root;
+reap;
+connection default;
+# Clean-up
+drop user 'mysqltest_1'@'localhost';
+disconnect con2root;
+disconnect con3root;
+
# End of 4.1 tests