summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2020-06-08 11:45:56 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2020-06-14 13:23:07 +0300
commit9bdf35e90f36d9be8cc7591e2ed5e62feadc5515 (patch)
treea4e2062030c56378d1f1922f13825adfebd8ebd9 /mysys/my_getopt.c
parentceaa8b647a1b4464980e66cc3ea766e5b19666ee (diff)
downloadmariadb-git-9bdf35e90f36d9be8cc7591e2ed5e62feadc5515.tar.gz
MDEV-18215: mariabackup does not report unknown command line options
MDEV-21298: mariabackup doesn't read from the [mariadbd] and [mariadbd-X.Y] server option groups from configuration files MDEV-21301: mariabackup doesn't read [mariadb-backup] option group in configuration file All three issues require to change the same code, that is why their fixes are joined in one commit. The fix is in invoking load_defaults_or_exit() and handle_options() for backup-specific groups separately from client-server groups to let the last handle_options() call fail on unknown backup-specific options. The order of options procesing is the following: 1) Load server groups and process server options, ignore unknown options 2) Load client groups and process client options, ignore unknown options 3) Load backup groups and process client-server options, exit on unknown option 4) Process --mysqld-args command line options, ignore unknown options New global flag my_handle_options_init_variables was added to have ability to invoke handle_options() for the same allowed options set several times without re-initialising previously set option values. --password value destroying is moved from option processing callback to mariabackup's handle_options() function to have ability to invoke server's handle_options() several times for the same possible allowed options set. Galera invokes wsrep_sst_mariabackup.sh with mysqld command line options to configure mariabackup as close to the server as possible. It is not known what server options are supported by mariabackup when the script is invoked. That is why new mariabackup option "--mysqld-args" is added, all unknown options that follow this option will be silently ignored. wsrep_sst_mariabackup.sh was also changed to: - use "--mysqld-args" mariabackup option to pass mysqld options, - remove deprecated innobackupex mode, - remove unsupported mariabackup options: --encrypt --encrypt-key --rebuild-indexes --rebuild-threads
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 7d539cd44fe..c4f83475f7b 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -79,6 +79,12 @@ my_bool my_getopt_skip_unknown= 0;
*/
my_bool my_getopt_prefix_matching= 1;
+/*
+ This is a flag that can be set in client programs. 1 means that
+ handle_options() will not initialize options to default values.
+*/
+my_bool my_handle_options_init_variables = 1;
+
static void default_reporter(enum loglevel level,
const char *format, ...)
{
@@ -212,7 +218,8 @@ int handle_options(int *argc, char ***argv,
DBUG_ASSERT(argv && *argv);
(*argc)--; /* Skip the program name */
(*argv)++; /* --- || ---- */
- init_variables(longopts, init_one_value);
+ if (my_handle_options_init_variables)
+ init_variables(longopts, init_one_value);
/*
Search for args_separator, if found, then the first part of the