Skip to content

Commit aa50956

Browse files
committed
MDEV-7781 cannot install/uninstall plugins during bootstrap
Merge branch 'openquery:mdev-7781-allow-install-uninstall-plugins-during-bootstrap' into 10.0 Undo MySQL fix for bug#46261
2 parents c8c51ce + dbe97bc commit aa50956

File tree

6 files changed

+42
-39
lines changed

6 files changed

+42
-39
lines changed

mysql-test/r/bootstrap.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
1515
and SUPPORT='YES';
1616

1717
End of 5.5 tests
18+
flush tables;
19+
show create table t1;
20+
Table Create Table
21+
t1 CREATE TABLE `t1` (
22+
`a` int(11) DEFAULT NULL
23+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
24+
drop table t1;
25+
select * from mysql.plugin;
26+
name dl
27+
EXAMPLE ha_example.so
28+
truncate table mysql.plugin;

mysql-test/r/bug46261.result

Lines changed: 0 additions & 8 deletions
This file was deleted.

mysql-test/t/bootstrap.test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,32 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
6060
and SUPPORT='YES';
6161

6262
--echo End of 5.5 tests
63+
64+
--source include/not_windows_embedded.inc
65+
--source include/have_example_plugin.inc
66+
#
67+
# Check that --bootstrap can install and uninstall plugins
68+
#
69+
let $PLUGIN_DIR=`select @@plugin_dir`;
70+
--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
71+
install soname 'ha_example';
72+
uninstall plugin unusable;
73+
EOF
74+
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
75+
--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
76+
77+
#
78+
# Check that installed plugins are *not* automatically loaded in --bootstrap
79+
#
80+
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
81+
use test;
82+
create table t1(a int) engine=example;
83+
EOF
84+
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
85+
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
86+
flush tables;
87+
show create table t1;
88+
drop table t1;
89+
--replace_result .dll .so
90+
select * from mysql.plugin;
91+
truncate table mysql.plugin;

mysql-test/t/bug46261-master.opt

Lines changed: 0 additions & 1 deletion
This file was deleted.

mysql-test/t/bug46261.test

Lines changed: 0 additions & 16 deletions
This file was deleted.

sql/sql_plugin.cc

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,14 +2085,8 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
20852085
char **argv=orig_argv;
20862086
DBUG_ENTER("mysql_install_plugin");
20872087

2088-
if (opt_noacl)
2089-
{
2090-
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
2091-
DBUG_RETURN(TRUE);
2092-
}
2093-
20942088
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
2095-
if (check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
2089+
if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
20962090
DBUG_RETURN(TRUE);
20972091

20982092
/* need to open before acquiring LOCK_plugin or it will deadlock */
@@ -2227,15 +2221,9 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
22272221
bool error= false;
22282222
DBUG_ENTER("mysql_uninstall_plugin");
22292223

2230-
if (opt_noacl)
2231-
{
2232-
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
2233-
DBUG_RETURN(TRUE);
2234-
}
2235-
22362224
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
22372225

2238-
if (check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
2226+
if (!opt_noacl && check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
22392227
DBUG_RETURN(TRUE);
22402228

22412229
/* need to open before acquiring LOCK_plugin or it will deadlock */

0 commit comments

Comments
 (0)