Skip to content

Commit 3cc278e

Browse files
committed
enable main.mysqldump-system test
that was permanently disabled in a merge mistake. also * use auth_test_plugin to test dumping of plugins and user auth, as the original test intended * s/USER/foobar/ to make a username searchable
1 parent c478a55 commit 3cc278e

File tree

3 files changed

+68
-51
lines changed

3 files changed

+68
-51
lines changed

mysql-test/main/mysqldump-system,win.rdiff

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
--- mysqldump-system.result
22
+++ mysqldump-system,win.result
3-
@@ -442,7 +442,7 @@
3+
@@ -449,9 +449,9 @@
4+
Table Checksum
5+
mysql.roles_mapping 2510045525
46
mysql.time_zone_transition 3895294076
5-
mysql.plugin 0
6-
mysql.servers 2783974349
7+
-mysql.plugin 1587119305
8+
+mysql.plugin 2184891911
9+
mysql.servers 2079085450
710
-mysql.func 3241572444
811
+mysql.func 310494789
912
mysql.innodb_table_stats 347867921
1013
mysql.table_stats 664320059
1114
# Opps....
12-
@@ -477,7 +477,7 @@
15+
@@ -484,9 +484,9 @@
16+
Table Checksum
17+
mysql.roles_mapping 2510045525
1318
mysql.time_zone_transition 3895294076
14-
mysql.plugin 0
15-
mysql.servers 2783974349
19+
-mysql.plugin 1587119305
20+
+mysql.plugin 2184891911
21+
mysql.servers 2079085450
1622
-mysql.func 3241572444
1723
+mysql.func 310494789
1824
mysql.innodb_table_stats 347867921
1925
mysql.table_stats 664320059
2026
DROP FUNCTION IF EXISTS metaphon;
21-

mysql-test/main/mysqldump-system.result

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
install soname 'auth_test_plugin';
12
#
23
# MDEV-23630: mysqldump to logically dump system tables
34
#
@@ -9,13 +10,13 @@ insert into tables_priv select * from mysql.tables_priv;
910
delete from mysql.global_priv where host not in ('localhost');
1011
flush privileges;
1112
alter user 'mariadb.sys'@'localhost' ACCOUNT UNLOCK;
12-
create user USER;
13+
create user foobar IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
1314
CREATE ROLE role_1;
1415
CREATE ROLE role_2 WITH ADMIN role_1;
1516
GRANT SHOW DATABASES ON *.* TO role_1;
16-
GRANT role_1 TO USER;
17-
GRANT role_2 TO USER;
18-
SET DEFAULT ROLE role_2 FOR USER;
17+
GRANT role_1 TO foobar;
18+
GRANT role_2 TO foobar;
19+
SET DEFAULT ROLE role_2 FOR foobar;
1920
ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
2021
set @save_innodb_stats_persistent= @@innodb_stats_persistent;
2122
create table mysql.tz like mysql.time_zone_transition;
@@ -49,9 +50,11 @@ CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
4950
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
5051
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
5152
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
53+
INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
54+
INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
5255
CREATE USER `mariadb.sys`@`localhost` PASSWORD EXPIRE;
5356
CREATE USER `root`@`localhost`;
54-
CREATE USER `USER`@`%`;
57+
CREATE USER `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
5558
SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
5659
CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
5760
GRANT mariadb_dump_import_role TO CURRENT_USER();
@@ -71,11 +74,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION;
7174
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
7275
/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
7376
/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
74-
GRANT `role_1` TO `USER`@`%`;
75-
GRANT `role_2` TO `USER`@`%`;
76-
GRANT USAGE ON *.* TO `USER`@`%`;
77-
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
78-
/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
77+
GRANT `role_1` TO `foobar`@`%`;
78+
GRANT `role_2` TO `foobar`@`%`;
79+
GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
80+
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */;
81+
/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */;
7982
GRANT `role_2` TO `role_1` WITH ADMIN OPTION;
8083
GRANT SHOW DATABASES ON *.* TO `role_1`;
8184
GRANT USAGE ON *.* TO `role_2`;
@@ -173,6 +176,10 @@ UNLOCK TABLES;
173176
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
174177
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
175178
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
179+
/*M!100401 UNINSTALL PLUGIN IF EXIST test_plugin_server */;
180+
INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
181+
/*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */;
182+
INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
176183
DELIMITER |
177184
/*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN
178185
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''";
@@ -188,12 +195,12 @@ DELIMITER ;
188195
/*!50701 DROP USER IF EXISTS 'root'@'localhost' */;
189196
CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`;
190197
DELIMITER |
191-
/*M!100101 IF current_user()="'USER'@'%'" THEN
192-
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'USER'@'%''";
198+
/*M!100101 IF current_user()="'foobar'@'%'" THEN
199+
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''";
193200
END IF */|
194201
DELIMITER ;
195-
/*!50701 DROP USER IF EXISTS 'USER'@'%' */;
196-
CREATE /*M!100103 OR REPLACE */ USER `USER`@`%`;
202+
/*!50701 DROP USER IF EXISTS 'foobar'@'%' */;
203+
CREATE /*M!100103 OR REPLACE */ USER `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
197204
SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
198205
CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
199206
GRANT mariadb_dump_import_role TO CURRENT_USER();
@@ -215,11 +222,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION;
215222
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
216223
/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
217224
/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
218-
GRANT `role_1` TO `USER`@`%`;
219-
GRANT `role_2` TO `USER`@`%`;
220-
GRANT USAGE ON *.* TO `USER`@`%`;
221-
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
222-
/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
225+
GRANT `role_1` TO `foobar`@`%`;
226+
GRANT `role_2` TO `foobar`@`%`;
227+
GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
228+
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */;
229+
/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */;
223230
GRANT `role_2` TO `role_1` WITH ADMIN OPTION;
224231
GRANT SHOW DATABASES ON *.* TO `role_1`;
225232
GRANT USAGE ON *.* TO `role_2`;
@@ -318,9 +325,11 @@ UNLOCK TABLES;
318325
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
319326
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
320327
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
328+
INSTALL PLUGIN test_plugin_server /*M!100401 IF NOT EXISTS */ SONAME 'AUTH_TEST_PLUGIN_LIB';
329+
INSTALL PLUGIN cleartext_plugin_server /*M!100401 IF NOT EXISTS */ SONAME 'AUTH_TEST_PLUGIN_LIB';
321330
CREATE USER IF NOT EXISTS `mariadb.sys`@`localhost` PASSWORD EXPIRE;
322331
CREATE USER IF NOT EXISTS `root`@`localhost`;
323-
CREATE USER IF NOT EXISTS `USER`@`%`;
332+
CREATE USER IF NOT EXISTS `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
324333
SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
325334
CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
326335
GRANT mariadb_dump_import_role TO CURRENT_USER();
@@ -340,11 +349,11 @@ GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION;
340349
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
341350
/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
342351
/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
343-
GRANT `role_1` TO `USER`@`%`;
344-
GRANT `role_2` TO `USER`@`%`;
345-
GRANT USAGE ON *.* TO `USER`@`%`;
346-
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
347-
/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
352+
GRANT `role_1` TO `foobar`@`%`;
353+
GRANT `role_2` TO `foobar`@`%`;
354+
GRANT USAGE ON *.* TO `foobar`@`%` IDENTIFIED VIA test_plugin_server USING 'plug_dest';
355+
/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'foobar'@'%' */;
356+
/*!80001 ALTER USER 'foobar'@'%' DEFAULT ROLE 'role_2' */;
348357
GRANT `role_2` TO `role_1` WITH ADMIN OPTION;
349358
GRANT SHOW DATABASES ON *.* TO `role_1`;
350359
GRANT USAGE ON *.* TO `role_2`;
@@ -430,17 +439,17 @@ UNLOCK TABLES;
430439

431440
SELECT * FROM mysql.global_priv ORDER BY User,Host;
432441
Host User Priv
433-
% USER {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"default_role":"role_2"}
442+
% foobar {"access":0,"version_id":VERSION,"plugin":"test_plugin_server","authentication_string":"plug_dest","password_last_changed":NOW,"default_role":"role_2"}
434443
localhost mariadb.sys {"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":false,"password_last_changed":NOW,"version_id":VERSION}
435444
role_1 {"access":16384,"version_id":VERSION,"is_role":true}
436445
role_2 {"access":0,"version_id":VERSION,"is_role":true}
437446
localhost root {"access":18446744073709551615}
438447
CHECKSUM TABLE mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
439448
mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
440449
Table Checksum
441-
mysql.roles_mapping 4108206491
450+
mysql.roles_mapping 2510045525
442451
mysql.time_zone_transition 3895294076
443-
mysql.plugin 0
452+
mysql.plugin 1587119305
444453
mysql.servers 2079085450
445454
mysql.func 3241572444
446455
mysql.innodb_table_stats 347867921
@@ -450,7 +459,7 @@ CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback';
450459
GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
451460
GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION;
452461
GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION;
453-
drop user USER;
462+
drop user foobar;
454463
delete from mysql.table_stats;
455464
delete from mysql.innodb_table_stats;
456465
delete from mysql.time_zone_transition;
@@ -465,17 +474,17 @@ set time_zone= @@global.time_zone;
465474
DROP USER mariadb_test_restore;
466475
SELECT * FROM mysql.global_priv ORDER BY User,Host;
467476
Host User Priv
468-
% USER {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"default_role":"role_2"}
477+
% foobar {"access":0,"version_id":VERSION,"plugin":"test_plugin_server","authentication_string":"plug_dest","password_last_changed":NOW,"default_role":"role_2"}
469478
localhost mariadb.sys {"access":0,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"password_lifetime":-1,"default_role":""}
470479
role_1 {"access":16384,"version_id":VERSION,"is_role":true}
471480
role_2 {"access":0,"version_id":VERSION,"is_role":true}
472481
localhost root {"access":549755813887,"version_id":VERSION,"plugin":"mysql_native_password","authentication_string":"","password_last_changed":NOW,"default_role":""}
473482
CHECKSUM TABLE mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
474483
mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
475484
Table Checksum
476-
mysql.roles_mapping 4108206491
485+
mysql.roles_mapping 2510045525
477486
mysql.time_zone_transition 3895294076
478-
mysql.plugin 0
487+
mysql.plugin 1587119305
479488
mysql.servers 2079085450
480489
mysql.func 3241572444
481490
mysql.innodb_table_stats 347867921
@@ -490,8 +499,9 @@ DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name
490499
drop table mysql.tz;
491500
DROP ROLE role_2;
492501
DROP ROLE role_1;
493-
drop user USER;
502+
drop user foobar;
494503
replace into mysql.global_priv select * from backup_users;
495504
replace into mysql.tables_priv select * from tables_priv;
496505
flush privileges;
497506
drop table backup_users, tables_priv;
507+
uninstall soname 'auth_test_plugin';

mysql-test/main/mysqldump-system.test

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
--source include/have_udf.inc
44
--source include/platform.inc
55

6-
if (!$AUTH_SOCKET_SO) {
7-
--skip Need auth socket plugin
6+
if (!$AUTH_TEST_PLUGIN_SO) {
7+
--skip Need auth test plugin
88
}
9+
install soname 'auth_test_plugin';
910

1011
--echo #
1112
--echo # MDEV-23630: mysqldump to logically dump system tables
@@ -21,17 +22,17 @@ flush privileges;
2122

2223
# mariadb.sys because of MDEV-24098
2324
alter user 'mariadb.sys'@'localhost' ACCOUNT UNLOCK;
24-
create user USER;
25+
create user foobar IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
2526

2627
# time zone data already loaded
2728

2829
CREATE ROLE role_1;
2930
CREATE ROLE role_2 WITH ADMIN role_1;
3031

3132
GRANT SHOW DATABASES ON *.* TO role_1;
32-
GRANT role_1 TO USER;
33-
GRANT role_2 TO USER;
34-
SET DEFAULT ROLE role_2 FOR USER;
33+
GRANT role_1 TO foobar;
34+
GRANT role_2 TO foobar;
35+
SET DEFAULT ROLE role_2 FOR foobar;
3536

3637
ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
3738

@@ -66,15 +67,15 @@ eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
6667
--echo # mysqldump of system tables with --system=all
6768
--echo #
6869

69-
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
70+
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB
7071
--exec $MYSQL_DUMP --skip-comments --system=all
7172

7273

7374
--echo #
7475
--echo # mysqldump of system tables with --system=all --replace
7576
--echo #
7677

77-
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
78+
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB
7879
--exec $MYSQL_DUMP --skip-comments --system=all --replace
7980

8081

@@ -85,7 +86,7 @@ eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
8586
--echo # mysqldump of system tables with --system=all --insert-ignore
8687
--echo #
8788

88-
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
89+
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB $AUTH_TEST_PLUGIN_SO AUTH_TEST_PLUGIN_LIB
8990
--exec $MYSQL_DUMP --skip-comments --system=all --insert-ignore
9091

9192

@@ -107,7 +108,7 @@ GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
107108
GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION;
108109
GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION;
109110

110-
drop user USER;
111+
drop user foobar;
111112
delete from mysql.table_stats;
112113
delete from mysql.innodb_table_stats;
113114
delete from mysql.time_zone_transition;
@@ -151,9 +152,10 @@ drop table mysql.tz;
151152
DROP ROLE role_2;
152153
DROP ROLE role_1;
153154

154-
drop user USER;
155+
drop user foobar;
155156

156157
replace into mysql.global_priv select * from backup_users;
157158
replace into mysql.tables_priv select * from tables_priv;
158159
flush privileges;
159160
drop table backup_users, tables_priv;
161+
uninstall soname 'auth_test_plugin';

0 commit comments

Comments
 (0)