summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-02-24 17:38:14 +0200
committerMonty <monty@mariadb.org>2020-03-24 21:00:04 +0200
commit8eba777c2bbad7721c818936a3a0ced3b2fcd59c (patch)
tree72863d1d5715c7d3963cce154d78129eb43e2532 /sql
parent324e42fbdc0d9d976788498ab242cb3fd60ef803 (diff)
downloadmariadb-git-8eba777c2bbad7721c818936a3a0ced3b2fcd59c.tar.gz
mysqld --help will now load mysqld.options table
Changes: - Initalize Aria early to allow it to load mysql.plugin table with --help - Don't print 'aborting' when doing --help - Don't write 'loose' error messages on log_warning < 2 (2 is default) - Don't write warnings about disabled plugings when doing --help - Don't write aria_log_control or aria log files when doing --help - When using --help, open all Aria tables in read only mode (safety) - If aria_init() fails, do a cleanup(). (Frees used memory) - If aria_log_control is locked with --help, then don't wait 30 seconds but instead return at once without initialzing Aria plugin.
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/sql_plugin.cc26
2 files changed, 32 insertions, 8 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e2fff60db3b..7cf85b72d71 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1873,7 +1873,7 @@ extern "C" void unireg_abort(int exit_code)
if (opt_help)
usage();
- if (exit_code)
+ else if (exit_code)
sql_print_error("Aborting");
/* Don't write more notes to the log to not hide error message */
disable_log_notes= 1;
@@ -8557,9 +8557,15 @@ static void option_error_reporter(enum loglevel level, const char *format, ...)
va_list args;
va_start(args, format);
- /* Don't print warnings for --loose options during bootstrap */
- if (level == ERROR_LEVEL || !opt_bootstrap ||
- global_system_variables.log_warnings)
+ /*
+ Don't print warnings for --loose options during bootstrap if
+ log_warnings <= 2 (2 is default) as warnings during bootstrap
+ can confuse people when running mysql_install_db and other scripts.
+ Don't print loose warnings at all if log_warnings <= 1
+ */
+ if (level == ERROR_LEVEL ||
+ (global_system_variables.log_warnings >
+ (ulong) (1 + MY_TEST(opt_bootstrap))))
{
vprint_msg_to_log(level, format, args);
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 58619651bf1..c5271173717 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1592,8 +1592,9 @@ 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;
+ bool mandatory= true, aria_loaded= 0;
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
+ LEX_CSTRING Aria= { STRING_WITH_LEN("Aria") };
DBUG_ENTER("plugin_init");
if (initialized)
@@ -1704,7 +1705,22 @@ int plugin_init(int *argc, char **argv, int flags)
global_system_variables.table_plugin =
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);
@@ -1726,8 +1742,10 @@ int plugin_init(int *argc, char **argv, int flags)
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 - load it right away */
- if (frm_type == TABLE_TYPE_NORMAL && !strcasecmp(maybe_myisam.str, "MyISAM"))
+ /* 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;
@@ -4190,7 +4208,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*/
if (disable_plugin)
{
- if (global_system_variables.log_warnings)
+ if (global_system_variables.log_warnings && !opt_help)
sql_print_information("Plugin '%s' is disabled.",
tmp->name.str);
goto err;