Skip to content

Commit 80e0bef

Browse files
committed
WL#6815 Adapt MySQL Cluster to 5.7
- WL8326 made sql_mode include NO_AUTO_CREATE_USER by default in 5.7 - the ndb_dist_priv and ndb_rpl_dist_priv tests fail since they create a new user using GRANT, rewrite to explicitly create the new user with a CREATE USER. - the ndb_dist_priv test also fails on a test case where it checks that it's possible to create a user with GRANT. Keep this test until it's not supported by temporarily changing the sql_mode for the query.
1 parent 49d4a12 commit 80e0bef

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

mysql-test/suite/ndb/r/ndb_dist_priv.result

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ select User,Table_priv from mysql.tables_priv ORDER BY User;
2222
User Table_priv
2323
newuser Update
2424
user2 Select
25+
CREATE USER 'user'@'localhost';
2526
grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION;
26-
Warnings:
27-
Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.
2827
select User,Table_priv from mysql.tables_priv ORDER BY User;
2928
User Table_priv
3029
newuser Update
@@ -131,9 +130,16 @@ Warning 1297 Got temporary error 274 'Time-out in NDB, probably caused by deadlo
131130
Error 1205 Lock wait timeout exceeded; try restarting transaction
132131
ROLLBACK;
133132
DROP USER 'billy1'@'127.0.0.1';
133+
set @orig_sql_mode= @@sql_mode;
134+
set SESSION sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
135+
Warnings:
136+
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
134137
GRANT ALL ON *.* TO 'billy2'@'127.0.0.1';
135138
Warnings:
136139
Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.
140+
set SESSION sql_mode = @orig_sql_mode;
141+
Warnings:
142+
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
137143
SELECT USER();
138144
USER()
139145
billy2@localhost

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass';
4343
GRANT SELECT ON test.t1 TO 'user2'@'localhost';
4444
select distinct User,Authentication_string from mysql.user order by User;
4545
select User,Table_priv from mysql.tables_priv ORDER BY User;
46+
CREATE USER 'user'@'localhost';
4647
grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION;
4748
select User,Table_priv from mysql.tables_priv ORDER BY User;
4849
GRANT SELECT ON test.t1 TO 'user'@'localhost';
@@ -137,7 +138,12 @@ DROP USER 'billy1'@'127.0.0.1';
137138
# to connect as that user on second mysqld
138139
#
139140
connection server1;
141+
# Remove NO_AUTO_CREATE_USER sql mode since this part of the
142+
# test is written to explcitly create a user with GRANT
143+
set @orig_sql_mode= @@sql_mode;
144+
set SESSION sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
140145
GRANT ALL ON *.* TO 'billy2'@'127.0.0.1';
146+
set SESSION sql_mode = @orig_sql_mode;
141147

142148
connect (server2_as_billy2,127.0.0.1,billy2,,test,$MASTER_MYPORT1,);
143149
connection server2_as_billy2;

mysql-test/suite/ndb_rpl/r/ndb_rpl_dist_priv.result

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ select User,Table_priv from mysql.tables_priv ORDER BY User;
2626
User Table_priv
2727
newuser Update
2828
user2 Select
29+
CREATE USER 'user'@'localhost';
2930
grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION;
30-
Warnings:
31-
Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.
3231
select User,Table_priv from mysql.tables_priv ORDER BY User;
3332
User Table_priv
3433
newuser Update
@@ -120,6 +119,7 @@ master-bin.000001 # Query # # use `test`; RENAME USER 'user'@'localhost' TO 'new
120119
master-bin.000001 # Query # # use `test`; GRANT SELECT ON `test`.* TO 'newuser'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*1E9649BB3F345563008E37641B407AFF50E5835C'
121120
master-bin.000001 # Query # # use `test`; CREATE USER 'user2'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4' PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
122121
master-bin.000001 # Query # # use `test`; GRANT SELECT ON `test`.`t1` TO 'user2'@'localhost'
122+
master-bin.000001 # Query # # use `test`; CREATE USER 'user'@'localhost' IDENTIFIED WITH 'mysql_native_password' PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
123123
master-bin.000001 # Query # # use `test`; GRANT ALL PRIVILEGES ON `test`.* TO 'user'@'localhost' WITH GRANT OPTION
124124
master-bin.000001 # Query # # use `test`; GRANT SELECT ON `test`.`t1` TO 'user'@'localhost'
125125
master-bin.000001 # Query # # REVOKE SELECT ON test.t1 FROM 'user'@'localhost'
@@ -139,6 +139,7 @@ master-bin.000001 # Query # # RENAME USER 'user'@'localhost' TO 'newuser'@'local
139139
master-bin.000001 # Query # # GRANT SELECT ON test.* TO 'newuser'@'localhost' IDENTIFIED by 'mypass2'
140140
master-bin.000001 # Query # # CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass'
141141
master-bin.000001 # Query # # GRANT SELECT ON test.t1 TO 'user2'@'localhost'
142+
master-bin.000001 # Query # # CREATE USER 'user'@'localhost'
142143
master-bin.000001 # Query # # grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION
143144
master-bin.000001 # Query # # GRANT SELECT ON test.t1 TO 'user'@'localhost'
144145
master-bin.000001 # Query # # use `test`; FLUSH PRIVILEGES
@@ -193,6 +194,7 @@ master-bin.000001 # Query # # RENAME USER 'user'@'localhost' TO 'newuser'@'local
193194
master-bin.000001 # Query # # GRANT SELECT ON test.* TO 'newuser'@'localhost' IDENTIFIED by 'mypass2'
194195
master-bin.000001 # Query # # CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass'
195196
master-bin.000001 # Query # # GRANT SELECT ON test.t1 TO 'user2'@'localhost'
197+
master-bin.000001 # Query # # CREATE USER 'user'@'localhost'
196198
master-bin.000001 # Query # # grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION
197199
master-bin.000001 # Query # # GRANT SELECT ON test.t1 TO 'user'@'localhost'
198200
master-bin.000001 # Query # # use `test`; FLUSH PRIVILEGES

mysql-test/suite/ndb_rpl/t/ndb_rpl_dist_priv.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass';
5454
GRANT SELECT ON test.t1 TO 'user2'@'localhost';
5555
select distinct User,Authentication_string from mysql.user order by User;
5656
select User,Table_priv from mysql.tables_priv ORDER BY User;
57+
CREATE USER 'user'@'localhost';
5758
grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION;
5859
select User,Table_priv from mysql.tables_priv ORDER BY User;
5960
GRANT SELECT ON test.t1 TO 'user'@'localhost';

0 commit comments

Comments
 (0)