Fixed some bugs and added support for --loose-set-variable

parent 54b0d014
...@@ -94,34 +94,34 @@ int handle_options(int *argc, char ***argv, ...@@ -94,34 +94,34 @@ int handle_options(int *argc, char ***argv,
option_is_loose= 0; option_is_loose= 0;
cur_arg++; /* skip '-' */ cur_arg++; /* skip '-' */
if (*cur_arg == 'O') if (*cur_arg == '-' || *cur_arg == 'O') /* check for long option, */
{ { /* --set-variable, or -O */
must_be_var= 1; if (*cur_arg == 'O')
if (!(*++cur_arg)) /* If not -Ovar=# */
{ {
/* the argument must be in next argv */ must_be_var= 1;
if (!*++pos)
if (!(*++cur_arg)) /* If not -Ovar=# */
{ {
fprintf(stderr, "%s: Option '-O' requires an argument\n", /* the argument must be in next argv */
progname); if (!*++pos)
return ERR_ARGUMENT_REQUIRED; {
fprintf(stderr, "%s: Option '-O' requires an argument\n",
progname);
return ERR_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
} }
cur_arg= *pos;
(*argc)--;
} }
/* Sasha: quick dirty fix of a bug that coredumps mysqladmin while else if (!compare_strings(cur_arg, "-set-variable", 13) ||
running the test suite. The bug is actually pretty serious - !compare_strings(cur_arg, "-loose-set-variable", 19))
even in cases when we do not coredump, -O var=val will not set
the variable, and the previous option would be treated upredictably.
*/
goto found_var;
}
else if (*cur_arg == '-') /* check for long option, or --set-variable */
{
if (!compare_strings(cur_arg, "-set-variable", 13))
{ {
must_be_var= 1; must_be_var= 1;
if (cur_arg[1] == 'l')
{
option_is_loose= 1;
cur_arg+= 6;
}
if (cur_arg[13] == '=') if (cur_arg[13] == '=')
{ {
cur_arg+= 14; cur_arg+= 14;
...@@ -159,7 +159,6 @@ int handle_options(int *argc, char ***argv, ...@@ -159,7 +159,6 @@ int handle_options(int *argc, char ***argv,
continue; continue;
} }
} }
found_var:
optend= strcend(cur_arg, '='); optend= strcend(cur_arg, '=');
length= optend - cur_arg; length= optend - cur_arg;
if (*optend == '=') if (*optend == '=')
...@@ -280,7 +279,7 @@ int handle_options(int *argc, char ***argv, ...@@ -280,7 +279,7 @@ int handle_options(int *argc, char ***argv,
Set bool to 1 if no argument or if the user has used Set bool to 1 if no argument or if the user has used
--enable-'option-name'. --enable-'option-name'.
*optend was set to '0' if one used --disable-option *optend was set to '0' if one used --disable-option
*/ */
*((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1'); *((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1');
(*argc)--; (*argc)--;
continue; continue;
......
...@@ -2806,7 +2806,20 @@ enum options { ...@@ -2806,7 +2806,20 @@ enum options {
OPT_SORT_BUFFER, OPT_TABLE_CACHE, OPT_SORT_BUFFER, OPT_TABLE_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT OPT_WAIT_TIMEOUT,
OPT_INNODB_MIRRORED_LOG_GROUPS,
OPT_INNODB_LOG_FILES_IN_GROUP,
OPT_INNODB_LOG_FILE_SIZE,
OPT_INNODB_LOG_BUFFER_SIZE,
OPT_INNODB_BUFFER_POOL_SIZE,
OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
OPT_INNODB_FILE_IO_THREADS,
OPT_INNODB_LOCK_WAIT_TIMEOUT,
OPT_INNODB_THREAD_CONCURRENCY,
OPT_INNODB_FORCE_RECOVERY,
OPT_BDB_CACHE_SIZE,
OPT_BDB_LOG_BUFFER_SIZE,
OPT_BDB_MAX_LOCK
}; };
...@@ -2945,7 +2958,7 @@ static struct my_option my_long_options[] = ...@@ -2945,7 +2958,7 @@ static struct my_option my_long_options[] =
0, 0, 0}, 0, 0, 0},
{"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN, {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
"Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown, "Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown,
(gptr*) &innobase_fast_shutdown, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#endif /* End HAVE_INNOBASE_DB */ #endif /* End HAVE_INNOBASE_DB */
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0}, 0, 0, 0, 0, 0},
...@@ -3040,6 +3053,7 @@ static struct my_option my_long_options[] = ...@@ -3040,6 +3053,7 @@ static struct my_option my_long_options[] =
*/ */
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory, {"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication", "Undocumented: Meant for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count, (gptr*) &disconnect_slave_event_count,
...@@ -3056,6 +3070,7 @@ static struct my_option my_long_options[] = ...@@ -3056,6 +3070,7 @@ static struct my_option my_long_options[] =
(gptr*) &opt_sporadic_binlog_dump_fail, (gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, (gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0}, 0},
#endif
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option", "Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
...@@ -3243,7 +3258,7 @@ static struct my_option my_long_options[] = ...@@ -3243,7 +3258,7 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
{ "bdb_cache_size", OPT_BDB_CACHE_SIZE, { "bdb_cache_size", OPT_BDB_CACHE_SIZE,
"The buffer that is allocated to cache index and rows for BDB tables." "The buffer that is allocated to cache index and rows for BDB tables.",
(gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG, (gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG,
REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0}, REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0},
{"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE, {"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment