Debian Codegraph @

mysql-test/suite/ndb/t/stored_grants_error_handling.test

raw
1 --source include/have_ndb.inc
2
3 #
4 # Open connections
5 #
6 connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1);
7
8 #
9 # Bug#30556487 MYSQLD HANG IN NDB_STORED_GRANTS CODE ON CREATE USER
10 #
11 CREATE USER "mcmd"@"localhost";
12 GRANT ALL PRIVILEGES ON *.* to "mcmd"@"localhost";
13
14 # Delete the user record stored in NDB
15 --disable_result_log
16 --exec $NDB_DELETE_ALL -d mysql ndb_sql_metadata
17
18 # Now grant again
19 --disable_query_log ONCE
20 CALL mtr.add_suppression("Error 626, Tuple did not exist");
21 GRANT ALL PRIVILEGES ON *.* to "mcmd"@"localhost";
22
23 #
24 # Bug#30600321 MAX_QUERIES_PER_HOUR 0 ONLY REMOVES THE LIMIT ON 1 MYSQLD
25 #
26 --enable_result_log
27 --disable_query_log
28
29 # Bug#30600321 Test (1): Alter resource limit of stored user
30 ALTER USER "mcmd"@"localhost" WITH MAX_QUERIES_PER_HOUR 33;
31
32 connection mysqld2;
33 echo Expect 33;
34 SELECT max_questions from mysql.user where user = 'mcmd';
35
36 connection default;
37 ALTER USER "mcmd"@"localhost" WITH MAX_QUERIES_PER_HOUR 0;
38
39 connection mysqld2;
40 let $max= `SELECT max_questions from mysql.user where user = 'mcmd'`;
41 if ($max != 0)
42 {
43 die Test failed -- max_questions was not zero;
44 }
45
46 # Bug#30600321 Test (2): Alter both resource limit and password of stored user
47 connection default;
48 ALTER USER "mcmd"@"localhost" WITH MAX_QUERIES_PER_HOUR 44;
49 ALTER USER "mcmd"@"localhost" IDENTIFIED BY "Garb_farb_earb" WITH MAX_QUERIES_PER_HOUR 0;
50
51 connection mysqld2;
52 echo Expect 0;
53 SELECT max_questions from mysql.user where user = 'mcmd';
54
55 # Bug#30600321 Test (3): Alter resource limit of stored and non-stored users
56 connection default;
57 CREATE USER "lu1"@"a";
58 ALTER USER "lu1"@"a", "mcmd"@"localhost" WITH MAX_QUERIES_PER_HOUR 55;
59
60 connection mysqld2;
61 echo Expect 55;
62 SELECT max_questions from mysql.user where user = 'mcmd';
63
64 connection default;
65 ALTER USER "lu1"@"a", "mcmd"@"localhost" WITH MAX_QUERIES_PER_HOUR 0;
66
67 connection mysqld2;
68 echo Expect 0;
69 SELECT max_questions from mysql.user where user = 'mcmd';
70
71 --enable_query_log
72
73 #
74 # Cleanup
75 #
76 connection default;
77 DROP USER mcmd@localhost;
78 DROP USER lu1@a;
79