summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-03-21 20:09:50 +0100
committerSergei Golubchik <serg@mariadb.org>2020-03-31 17:42:33 +0200
commit64be8c2bf2c939b39d7c83eb06e26123d8347099 (patch)
treecd052e5a160187b3064817af3df0087405b145e8
parentdc3185c7597d0dd4a34aae2ade2b78404adbdf94 (diff)
downloadmariadb-git-64be8c2bf2c939b39d7c83eb06e26123d8347099.tar.gz
mysqld --help will now load mysqld.plugin table
Remove special treatment for Aria. Add a test with --help and mysql.plugin table being InnoDB MyISAM is still treated specially, as we need to be able to initialize global_system_variables.table_plugin reliably
-rw-r--r--mysql-test/main/mysqld--help-aria.result (renamed from mysql-test/main/mysqld--help2.result)0
-rw-r--r--mysql-test/main/mysqld--help-aria.test (renamed from mysql-test/main/mysqld--help2.test)0
-rw-r--r--mysql-test/main/plugin_innodb.result4
-rw-r--r--mysql-test/main/plugin_innodb.test16
-rw-r--r--sql/sql_plugin.cc47
5 files changed, 28 insertions, 39 deletions
diff --git a/mysql-test/main/mysqld--help2.result b/mysql-test/main/mysqld--help-aria.result
index 08dc5de68d0..08dc5de68d0 100644
--- a/mysql-test/main/mysqld--help2.result
+++ b/mysql-test/main/mysqld--help-aria.result
diff --git a/mysql-test/main/mysqld--help2.test b/mysql-test/main/mysqld--help-aria.test
index 953a2b97e8d..953a2b97e8d 100644
--- a/mysql-test/main/mysqld--help2.test
+++ b/mysql-test/main/mysqld--help-aria.test
diff --git a/mysql-test/main/plugin_innodb.result b/mysql-test/main/plugin_innodb.result
index c55bfd779c2..f1d9a28ec95 100644
--- a/mysql-test/main/plugin_innodb.result
+++ b/mysql-test/main/plugin_innodb.result
@@ -1,8 +1,8 @@
-install plugin example soname 'ha_example.so';
+install plugin example soname 'ha_example';
create table t1(a int) engine=example;
drop table t1;
alter table mysql.plugin engine=innodb;
-restart
+ --example[=name] Enable or disable EXAMPLE plugin. One of: ON, OFF, FORCE
# restart
create table t1(a int) engine=example;
select * from t1;
diff --git a/mysql-test/main/plugin_innodb.test b/mysql-test/main/plugin_innodb.test
index 5700486b218..c0733570de1 100644
--- a/mysql-test/main/plugin_innodb.test
+++ b/mysql-test/main/plugin_innodb.test
@@ -9,14 +9,22 @@ if (!`select count(*) from information_schema.plugins
}
---replace_regex /\.dll/.so/
-eval install plugin example soname '$HA_EXAMPLE_SO';
+install plugin example soname 'ha_example';
create table t1(a int) engine=example;
drop table t1;
alter table mysql.plugin engine=innodb;
---echo restart
---source include/restart_mysqld.inc
+--source include/shutdown_mysqld.inc
+
+--exec $MYSQLD_CMD --innodb --help --verbose > $MYSQL_TMP_DIR/plugin_innodb.txt 2> $MYSQL_TMP_DIR/plugin_innodb.err
+perl;
+ open(F, '<', "$ENV{MYSQL_TMP_DIR}/plugin_innodb.txt") or die;
+ while (<F>) {
+ print if /EXAMPLE/;
+ }
+EOF
+
+--source include/start_mysqld.inc
create table t1(a int) engine=example;
select * from t1;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index c5271173717..8135ed262f7 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1592,9 +1592,10 @@ int plugin_init(int *argc, char **argv, int flags)
struct st_plugin_int tmp, *plugin_ptr, **reap;
MEM_ROOT tmp_root;
bool reaped_mandatory_plugin= false;
- bool mandatory= true, aria_loaded= 0;
+ bool mandatory= true;
+ char plugin_table_engine_name_buf[NAME_CHAR_LEN + 1];
+ LEX_CSTRING plugin_table_engine_name= { plugin_table_engine_name_buf, 0 };
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
- LEX_CSTRING Aria= { STRING_WITH_LEN("Aria") };
DBUG_ENTER("plugin_init");
if (initialized)
@@ -1706,22 +1707,6 @@ int plugin_init(int *argc, char **argv, int flags)
intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
DBUG_SLOW_ASSERT(plugin_ptr->ref_count == 1);
}
- /* Initialize Aria plugin so that we can load mysql.plugin */
- plugin_ptr= plugin_find_internal(&Aria, MYSQL_STORAGE_ENGINE_PLUGIN);
- DBUG_ASSERT(plugin_ptr || !mysql_mandatory_plugins[0]);
- if (plugin_ptr)
- {
- DBUG_ASSERT(plugin_ptr->load_option == PLUGIN_FORCE);
-
- if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv, false))
- {
- if (!opt_help)
- goto err_unlock;
- plugin_ptr->state= PLUGIN_IS_DISABLED;
- }
- else
- aria_loaded= 1;
- }
mysql_mutex_unlock(&LOCK_plugin);
/* Register (not initialize!) all dynamic plugins */
@@ -1738,18 +1723,10 @@ int plugin_init(int *argc, char **argv, int flags)
{
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
- char engine_name_buf[NAME_CHAR_LEN + 1];
- LEX_CSTRING maybe_myisam= { engine_name_buf, 0 };
- bool is_sequence;
- Table_type frm_type= dd_frm_type(NULL, path, &maybe_myisam, &is_sequence);
- /* if mysql.plugin table is MyISAM or Aria - load it right away */
- if (frm_type == TABLE_TYPE_NORMAL &&
- (!strcasecmp(maybe_myisam.str, "MyISAM") ||
- (!strcasecmp(maybe_myisam.str, "Aria") && aria_loaded)))
- {
- plugin_load(&tmp_root);
- flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE;
- }
+ bool dummy;
+ Table_type ttype= dd_frm_type(0, path, &plugin_table_engine_name, &dummy);
+ if (ttype != TABLE_TYPE_NORMAL)
+ plugin_table_engine_name=empty_clex_str;
}
}
@@ -1771,8 +1748,12 @@ int plugin_init(int *argc, char **argv, int flags)
plugin_ptr= (struct st_plugin_int *) my_hash_element(hash, idx);
if (plugin_ptr->state == PLUGIN_IS_UNINITIALIZED)
{
- if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv,
- (flags & PLUGIN_INIT_SKIP_INITIALIZATION)))
+ bool plugin_table_engine= lex_string_eq(&plugin_table_engine_name,
+ &plugin_ptr->name);
+ bool opts_only= flags & PLUGIN_INIT_SKIP_INITIALIZATION &&
+ (flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE ||
+ !plugin_table_engine);
+ if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv, opts_only))
{
plugin_ptr->state= PLUGIN_IS_DYING;
*(reap++)= plugin_ptr;
@@ -1806,7 +1787,7 @@ int plugin_init(int *argc, char **argv, int flags)
mysql_mutex_unlock(&LOCK_plugin);
my_afree(reap);
- if (reaped_mandatory_plugin)
+ if (reaped_mandatory_plugin && !opt_help)
goto err;
free_root(&tmp_root, MYF(0));