Commit 9f8a75a1 authored by unknown's avatar unknown

Fixed some bugs in my_getopt.c, added functionality for new GET_*

types, migrated mysqld.cc to use my_getopt.


include/my_getopt.h:
  
  Added missing types; GET_INT, GET_UINT, GET_ULONG, GET_ULL
mysys/my_getopt.c:
  - Fixed a bug in processing short options; variable value was set
    wrongly after processing it in get_one_option(), when it needed
    to be done before it.
  - Fixed a bug in setting variable values; if type was OPT_ARG,
    a call without argument destroyed the default value
  - Added functionality for new GET_* types.
sql/mysqld.cc:
  Changed mysqld.cc to use my_getopt.
parent 90bd3236
......@@ -16,7 +16,8 @@
C_MODE_START
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_LONG, GET_LL, GET_STR };
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
GET_ULONG, GET_LL, GET_ULL, GET_STR };
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
struct my_option
......
......@@ -26,8 +26,11 @@ static int findopt (char *optpat, uint length,
static my_bool compare_strings (register const char *s, register const char *t,
uint length);
static longlong getopt_ll (char *arg, const struct my_option *optp, int *err);
static ulonglong getopt_ull (char *arg, const struct my_option *optp,
int *err);
static void init_variables(const struct my_option *options);
static int setval (const struct my_option *opts, char *argument,
my_bool set_maximum_value);
#define DISABLE_OPTION_COUNT 2
......@@ -66,15 +69,16 @@ int handle_options(int *argc, char ***argv,
char *))
{
uint opt_found, argvpos= 0, length, spec_len, i;
int err= 0;
my_bool end_of_options= 0, must_be_var, set_maximum_value, special_used;
char *progname= *(*argv), **pos, *optend, *prev_found;
const struct my_option *optp;
int error;
LINT_INIT(opt_found);
(*argc)--; /* Skip the program name */
(*argv)++; /* --- || ---- */
init_variables(longopts);
for (pos= *argv; *pos; pos++)
{
char *cur_arg= *pos;
......@@ -337,6 +341,13 @@ int handle_options(int *argc, char ***argv,
/* the other loop will break, because *optend + 1 == 0 */
}
}
if ((error= setval(optp, argument, set_maximum_value)))
{
fprintf(stderr,
"%s: Error while setting value '%s' to '%s'\n",
progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
break;
}
......@@ -351,25 +362,12 @@ int handle_options(int *argc, char ***argv,
(*argc)--; /* option handled (short), decrease argument count */
continue;
}
if (optp->value)
{
gptr *result_pos= (set_maximum_value) ?
optp->u_max_value : optp->value;
if (!result_pos)
if ((error= setval(optp, argument, set_maximum_value)))
{
fprintf(stderr,
"%s: Can't set a value for %s\n", progname, optp->name);
return ERR_NO_PTR_TO_VARIABLE;
}
if (optp->var_type == GET_LONG)
*((long*) result_pos)= (long) getopt_ll(argument, optp, &err);
else if (optp->var_type == GET_LL)
*((longlong*) result_pos)= getopt_ll(argument, optp, &err);
else if (optp->var_type == GET_STR)
*((char**) result_pos)= argument;
if (err)
return ERR_UNKNOWN_SUFFIX;
"%s: Error while setting value '%s' to '%s'\n",
progname, argument, optp->name);
return error;
}
get_one_option(optp->id, optp, argument);
......@@ -381,6 +379,41 @@ int handle_options(int *argc, char ***argv,
return 0;
}
/*
function: setval
Arguments: opts, argument
Will set the option value to given value
*/
static int setval (const struct my_option *opts, char *argument,
my_bool set_maximum_value)
{
int err= 0;
if (opts->value && argument)
{
gptr *result_pos= (set_maximum_value) ?
opts->u_max_value : opts->value;
if (!result_pos)
return ERR_NO_PTR_TO_VARIABLE;
if (opts->var_type == GET_INT || opts->var_type == GET_UINT)
*((int*) result_pos)= (int) getopt_ll(argument, opts, &err);
else if (opts->var_type == GET_LONG || opts->var_type == GET_ULONG)
*((long*) result_pos)= (long) getopt_ll(argument, opts, &err);
else if (opts->var_type == GET_LL)
*((longlong*) result_pos)= getopt_ll(argument, opts, &err);
else if (opts->var_type == GET_ULL)
*((ulonglong*) result_pos)= getopt_ull(argument, opts, &err);
else if (opts->var_type == GET_STR)
*((char**) result_pos)= argument;
if (err)
return ERR_UNKNOWN_SUFFIX;
}
return 0;
}
/*
function: findopt
......@@ -436,25 +469,20 @@ static my_bool compare_strings(register const char *s, register const char *t,
return 0;
}
/*
function: getopt_ll
function: eval_num_suffix
Evaluates and returns the value that user gave as an argument
to a variable. Recognizes (case insensitive) K as KILO, M as MEGA
and G as GIGA bytes. Some values must be in certain blocks, as
defined in the given my_option struct, this function will check
that those values are honored.
In case of an error, set error value in *err.
Transforms a number with a suffix to real number. Suffix can
be k|K for kilo, m|M for mega or g|G for giga.
*/
static longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
static longlong eval_num_suffix (char *argument, int *error, char *option_name)
{
char *endchar;
longlong num;
*err= 0;
num= strtoll(arg, &endchar, 10);
*error= 0;
num= strtoll(argument, &endchar, 10);
if (*endchar == 'k' || *endchar == 'K')
num*= 1024L;
else if (*endchar == 'm' || *endchar == 'M')
......@@ -465,9 +493,29 @@ static longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
{
fprintf(stderr,
"Unknown suffix '%c' used for variable '%s' (value '%s')\n",
*endchar, optp->name, arg);
*err= 1;
*endchar, option_name, argument);
*error= 1;
return 0;
}
return num;
}
/*
function: getopt_ll
Evaluates and returns the value that user gave as an argument
to a variable. Recognizes (case insensitive) K as KILO, M as MEGA
and G as GIGA bytes. Some values must be in certain blocks, as
defined in the given my_option struct, this function will check
that those values are honored.
In case of an error, set error value in *err.
*/
static longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
{
longlong num;
num= eval_num_suffix(arg, err, (char*) optp->name);
if (num < (longlong) optp->min_value)
num= (longlong) optp->min_value;
else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value
......@@ -480,6 +528,29 @@ static longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
1L));
}
/*
function: getopt_ull
This is the same as getopt_ll, but is meant for unsigned long long
values.
*/
static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err)
{
ulonglong num;
num= eval_num_suffix(arg, err, (char*) optp->name);
if (num < (ulonglong) optp->min_value)
num= (ulonglong) optp->min_value;
else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value
&& optp->max_value) // if max value is not set -> no upper limit
num= (ulonglong) (ulong) optp->max_value;
num= ((num - (ulonglong) optp->sub_size) / (optp->block_size ?
(ulonglong) optp->block_size :
1L));
return (ulonglong) (num * (optp->block_size ? (ulonglong) optp->block_size :
1L));
}
/*
function: init_variables
......@@ -493,12 +564,24 @@ static void init_variables(const struct my_option *options)
{
if (options->value)
{
if (options->var_type == GET_LONG)
if (options->var_type == GET_INT)
*((int*) options->u_max_value)= *((int*) options->value)=
(int) options->def_value;
else if (options->var_type == GET_UINT)
*((uint*) options->u_max_value)= *((uint*) options->value)=
(uint) options->def_value;
else if (options->var_type == GET_LONG)
*((long*) options->u_max_value)= *((long*) options->value)=
(long) options->def_value;
else if (options->var_type == GET_ULONG)
*((ulong*) options->u_max_value)= *((ulong*) options->value)=
(ulong) options->def_value;
else if (options->var_type == GET_LL)
*((longlong*) options->u_max_value)= *((longlong*) options->value)=
options->def_value;
(longlong) options->def_value;
else if (options->var_type == GET_ULL)
*((ulonglong*) options->u_max_value)= *((ulonglong*) options->value)=
(ulonglong) options->def_value;
}
}
}
......@@ -604,6 +687,20 @@ void my_print_variables(const struct my_option *options)
else
printf("(No default value)\n");
}
else if (optp->var_type == GET_INT)
{
if (!optp->def_value && !*((int*) optp->value))
printf("(No default value)\n");
else
printf("%d\n", *((int*) optp->value));
}
else if (optp->var_type == GET_UINT)
{
if (!optp->def_value && !*((uint*) optp->value))
printf("(No default value)\n");
else
printf("%d\n", *((uint*) optp->value));
}
else if (optp->var_type == GET_LONG)
{
if (!optp->def_value && !*((long*) optp->value))
......@@ -611,13 +708,27 @@ void my_print_variables(const struct my_option *options)
else
printf("%lu\n", *((long*) optp->value));
}
else if (optp->var_type == GET_ULONG)
{
if (!optp->def_value && !*((ulong*) optp->value))
printf("(No default value)\n");
else
printf("%lu\n", *((ulong*) optp->value));
}
else if (optp->var_type == GET_LL)
{
if (!optp->def_value && !*((longlong*) optp->value))
printf("(No default value)\n");
else
printf("%s\n", llstr(*((longlong*) optp->value), buff));
}
else if (optp->var_type == GET_ULL)
{
if (!optp->def_value && !*((ulonglong*) optp->value))
printf("(No default value)\n");
else
printf("%s\n", longlong2str(*((ulonglong*) optp->value), buff, 10));
}
}
}
}
......@@ -65,7 +65,7 @@ extern "C" { // Because of SCO 3.2V4.2
#ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__ // Skip warnings in getopt.h
#endif
#include <getopt.h>
#include <my_getopt.h>
#ifdef HAVE_SYSENT_H
#include <sysent.h>
#endif
......@@ -250,6 +250,8 @@ static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET;
static my_string opt_logname=0,opt_update_logname=0,
opt_binlog_index_name = 0,opt_slow_logname=0;
static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN];
static char* mysql_home_ptr= mysql_home;
static char* pidfile_name_ptr= pidfile_name;
static pthread_t select_thread;
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
......@@ -357,6 +359,8 @@ char mysql_real_data_home[FN_REFLEN],
default_charset[LIBLEN],mysql_charsets_dir[FN_REFLEN], *charsets_list,
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
*opt_init_file;
char *language_ptr= language;
char *default_charset_ptr= default_charset;
#ifndef EMBEDDED_LIBRARY
char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff;
bool mysql_embedded=0;
......@@ -2703,7 +2707,7 @@ enum options {
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB,
OPT_TABLE_TYPE, OPT_INIT_FILE,
OPT_DELAY_KEY_WRITE, OPT_SLOW_QUERY_LOG,
OPT_SKIP_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
OPT_USE_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
OPT_BDB_HOME, OPT_BDB_LOG,
OPT_BDB_TMP, OPT_BDB_NOSYNC,
OPT_BDB_LOCK, OPT_BDB_SKIP,
......@@ -2717,7 +2721,7 @@ enum options {
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
OPT_WANT_CORE, OPT_SKIP_CONCURRENT_INSERT,
OPT_WANT_CORE, OPT_CONCURRENT_INSERT,
OPT_MEMLOCK, OPT_MYISAM_RECOVER,
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID,
OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE,
......@@ -2750,349 +2754,751 @@ enum options {
OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
OPT_RECKLESS_SLAVE,
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA,
OPT_SSL_CAPATH, OPT_SSL_CIPHER
OPT_SSL_CAPATH, OPT_SSL_CIPHER,
OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT,
OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE,
OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN,
OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT,
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
OPT_KEY_BUFFER_SIZE, OPT_LONG_QUERY_TIME,
OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE,
OPT_MAX_JOIN_SIZE, OPT_MAX_SORT_LENGTH,
OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
OPT_MAX_WRITE_LOCK_COUNT, OPT_MYISAM_BULK_INSERT_TREE_SIZE,
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
OPT_OPEN_FILES_LIMIT, OPT_QUERY_BUFFER_SIZE,
OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_SIZE,
OPT_QUERY_CACHE_STARTUP_TYPE, OPT_RECORD_BUFFER,
OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT,
OPT_SLAVE_NET_TIMEOUT, OPT_SLOW_LAUNCH_TIME,
OPT_SORT_BUFFER, OPT_TABLE_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT
};
static struct option long_options[] = {
{"ansi", no_argument, 0, 'a'},
{"basedir", required_argument, 0, 'b'},
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
static struct my_option my_long_options[] =
{
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"basedir", 'b',
"Path to installation directory. All paths are usually resolved relative to this.",
(gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef HAVE_BERKELEY_DB
{"bdb-home", required_argument, 0, (int) OPT_BDB_HOME},
{"bdb-lock-detect", required_argument, 0, (int) OPT_BDB_LOCK},
{"bdb-logdir", required_argument, 0, (int) OPT_BDB_LOG},
{"bdb-no-recover", no_argument, 0, (int) OPT_BDB_NO_RECOVER},
{"bdb-no-sync", no_argument, 0, (int) OPT_BDB_NOSYNC},
{"bdb-shared-data", no_argument, 0, (int) OPT_BDB_SHARED},
{"bdb-tmpdir", required_argument, 0, (int) OPT_BDB_TMP},
#endif
{"big-tables", no_argument, 0, (int) OPT_BIG_TABLES},
{"binlog-do-db", required_argument, 0, (int) OPT_BINLOG_DO_DB},
{"binlog-ignore-db", required_argument, 0, (int) OPT_BINLOG_IGNORE_DB},
{"bind-address", required_argument, 0, (int) OPT_BIND_ADDRESS},
{"bootstrap", no_argument, 0, (int) OPT_BOOTSTRAP},
{"bdb-home", OPT_BDB_HOME, "Berkeley home directory", (gptr*) &berkeley_home,
(gptr*) &berkeley_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-lock-detect", OPT_BDB_LOCK,
"Berkeley lock detect (DEFAULT, OLDEST, RANDOM or YOUNGEST, # sec)",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-logdir", OPT_BDB_LOG, "Berkeley DB log file directory",
(gptr*) &berkeley_logdir, (gptr*) &berkeley_logdir, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-no-recover", OPT_BDB_NO_RECOVER,
"Don't try to recover Berkeley DB tables on start", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-no-sync", OPT_BDB_NOSYNC, "Don't synchronously flush logs", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"bdb-shared-data", OPT_BDB_SHARED,
"Start Berkeley DB in multi-process mode", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"bdb-tmpdir", OPT_BDB_TMP, "Berkeley DB tempfile name",
(gptr*) &berkeley_tmpdir, (gptr*) &berkeley_tmpdir, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif /* HAVE_BERKELEY_DB */
{"skip-bdb", OPT_BDB_SKIP, "Don't use berkeley db (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"big-tables", OPT_BIG_TABLES,
"Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
"Tells the master that updates to the given database should not be logged tothe binary log",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bind-address", OPT_BIND_ADDRESS, "Ip address to bind to",
(gptr*) &my_bind_addr, (gptr*) &my_bind_addr, 0, GET_ULONG, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"console", no_argument, 0, (int) OPT_CONSOLE},
#endif
{"core-file", no_argument, 0, (int) OPT_WANT_CORE},
{"chroot", required_argument, 0, 'r'},
{"character-sets-dir", required_argument, 0, (int) OPT_CHARSETS_DIR},
{"datadir", required_argument, 0, 'h'},
{"debug", optional_argument, 0, '#'},
{"des-key-file", required_argument, 0, (int) OPT_DES_KEY_FILE},
{"default-character-set", required_argument, 0, 'C'},
{"default-table-type", required_argument, 0, (int) OPT_TABLE_TYPE},
{"delay-key-write-for-all-tables",
no_argument, 0, (int) OPT_DELAY_KEY_WRITE},
{"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK},
{"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE},
{"enable-pstack", no_argument, 0, (int) OPT_DO_PSTACK},
{"exit-info", optional_argument, 0, 'T'},
{"flush", no_argument, 0, (int) OPT_FLUSH},
{"init-rpl-role", required_argument, 0, (int) OPT_INIT_RPL_ROLE},
/* We must always support this option to make scripts like mysqltest easier
to do */
{"innodb_data_file_path", required_argument, 0,
OPT_INNODB_DATA_FILE_PATH},
{"console", OPT_CONSOLE, "Don't remove the console window",
(gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"standalone", OPT_STANDALONE,
"Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"core-file", OPT_WANT_CORE, "Write core on errors", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"chroot", 'r', "Chroot mysqld daemon during startup.",
(gptr*) &mysqld_chroot, (gptr*) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'h', "Path to the database root", (gptr*) &mysql_data_home,
(gptr*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef SAFEMALLOC
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
#endif
#ifdef HAVE_OPENSSL
{"des-key-file", OPT_DES_KEY_FILE,
"Load keys for des_encrypt() and des_encrypt from given file",
(gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif /* HAVE_OPENSSL */
{"default-character-set", 'C', "Set the default character set",
(gptr*) &default_charset_ptr, (gptr*) &default_charset_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-table-type", OPT_TABLE_TYPE,
"Set the default table type for tables", (gptr*) &default_table_type_name,
(gptr*) &default_table_type_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE,
"Don't flush key buffers between writes for any MyISAM table", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"enable-locking", OPT_ENABLE_LOCK, "Enable system locking", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)",
(gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure",
(gptr*) &opt_do_pstack, (gptr*) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0,
GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"flush", OPT_FLUSH, "Flush tables to disk between SQL commands", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
/* We must always support the next option to make scripts like mysqltest
easier to do */
{"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role", 0, 0, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
"Path to individual files and their sizes",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_INNOBASE_DB
{"innodb_data_home_dir", required_argument, 0,
OPT_INNODB_DATA_HOME_DIR},
{"innodb_log_group_home_dir", required_argument, 0,
OPT_INNODB_LOG_GROUP_HOME_DIR},
{"innodb_log_arch_dir", required_argument, 0,
OPT_INNODB_LOG_ARCH_DIR},
{"innodb_log_archive", optional_argument, 0,
OPT_INNODB_LOG_ARCHIVE},
{"innodb_flush_log_at_trx_commit", optional_argument, 0,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT},
{"innodb_fast_shutdown", optional_argument, 0,
OPT_INNODB_FAST_SHUTDOWN},
{"innodb_flush_method", required_argument, 0,
OPT_INNODB_FLUSH_METHOD},
#endif
{"help", no_argument, 0, '?'},
{"init-file", required_argument, 0, (int) OPT_INIT_FILE},
{"log", optional_argument, 0, 'l'},
{"language", required_argument, 0, 'L'},
{"local-infile", optional_argument, 0, (int) OPT_LOCAL_INFILE},
{"log-bin", optional_argument, 0, (int) OPT_BIN_LOG},
{"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX},
{"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG},
{"log-update", optional_argument, 0, (int) OPT_UPDATE_LOG},
{"log-slow-queries", optional_argument, 0, (int) OPT_SLOW_QUERY_LOG},
{"log-long-format", no_argument, 0, (int) OPT_LONG_FORMAT},
{"log-slave-updates", no_argument, 0, (int) OPT_LOG_SLAVE_UPDATES},
{"low-priority-updates", no_argument, 0, (int) OPT_LOW_PRIORITY_UPDATES},
{"master-host", required_argument, 0, (int) OPT_MASTER_HOST},
{"master-user", required_argument, 0, (int) OPT_MASTER_USER},
{"master-password", required_argument, 0, (int) OPT_MASTER_PASSWORD},
{"master-port", required_argument, 0, (int) OPT_MASTER_PORT},
{"master-connect-retry", required_argument, 0, (int) OPT_MASTER_CONNECT_RETRY},
{"master-retry-count", required_argument, 0, (int) OPT_MASTER_RETRY_COUNT},
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
{"master-ssl", optional_argument, 0, (int) OPT_MASTER_SSL},
{"master-ssl-key", optional_argument, 0, (int) OPT_MASTER_SSL_KEY},
{"master-ssl-cert", optional_argument, 0, (int) OPT_MASTER_SSL_CERT},
{"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
{"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR,
"The common part for Innodb table spaces", (gptr*) &innobase_data_home_dir,
(gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
{"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
"Path to innodb log files.", (gptr*) &innobase_log_group_home_dir,
(gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR,
"Where full logs should be archived", (gptr*) &innobase_log_arch_dir,
(gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE,
"Set to 1 if you want to have logs archived", 0, 0, 0, GET_LONG, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
"Set to 0 if you don't want to flush logs", 0, 0, 0, GET_LONG, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data", (gptr*) &innobase_unix_file_flush_method,
(gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"innodb_fast_shutdown", OPT_INNODB_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},
#endif /* End HAVE_INNOBASE_DB */
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup",
(gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"log", 'l', "Log connections and queries to file", (gptr*) &opt_logname,
(gptr*) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"language", 'L',
"Client error messages in given language. May be given as a full path",
(gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE,
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)",
(gptr*) &opt_local_infile, (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"log-bin", OPT_BIN_LOG,
"Log queries in new binary format (for replication)",
(gptr*) &opt_bin_logname, (gptr*) &opt_bin_logname, 0, GET_STR, OPT_ARG, 0,
0, 0, 0, 0, 0},
{"log-bin-index", OPT_BIN_LOG_INDEX,
"File that holds the names for last binary log files",
(gptr*) &opt_binlog_index_name, (gptr*) &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file",
(gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-update", OPT_UPDATE_LOG,
"Log updates to file.# where # is a unique number if not given.",
(gptr*) &opt_update_logname, (gptr*) &opt_update_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
"Log slow queries to this log file. Defaults logging to hostname-slow.log",
(gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"log-long-format", OPT_LONG_FORMAT,
"Log some extra information to update log", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
"Tells the slave to log the updates from the slave thread to the binary log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves.",
(gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
"INSERT/DELETE/UPDATE has lower priority than selects", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"master-host", OPT_MASTER_HOST,
"Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.",
(gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"master-user", OPT_MASTER_USER,
"The username the slave thread will use for authentication when connecting to the master. The user must have FILE privilege. If the master user is not set, user test is assumed. The value in master.info will take precedence if it can be read.",
(gptr*) &master_user, (gptr*) &master_user, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"master-password", OPT_MASTER_PASSWORD,
"The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-port", OPT_MASTER_PORT,
"The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read",
(gptr*) &master_port, (gptr*) &master_port, 0, GET_UINT, REQUIRED_ARG,
MYSQL_PORT, 0, 0, 0, 0, 0},
{"master-connect-retry", OPT_MASTER_CONNECT_RETRY,
"The number of seconds the slave thread will sleep before retrying to connect to the master in case the master goes down or the connection is lost.",
(gptr*) &master_connect_retry, (gptr*) &master_connect_retry, 0, GET_UINT,
REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
{"master-retry-count", OPT_MASTER_RETRY_COUNT,
"The number of tries the slave will make to connect to the master before giving up.",
(gptr*) &master_retry_count, (gptr*) &master_retry_count, 0, GET_ULONG,
REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
{"master-info-file", OPT_MASTER_INFO_FILE,
"The location of the file that remembers where we left off on the master during the replication process. The default is `master.info' in the data directory. You should not need to change this.",
(gptr*) &master_info_file, (gptr*) &master_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-ssl", OPT_MASTER_SSL,
"Turn SSL on for replication. Be warned that is this is a relatively new feature.",
(gptr*) &master_ssl, (gptr*) &master_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"master-ssl-key", OPT_MASTER_SSL_KEY,
"Master SSL keyfile name. Only applies if you have enabled master-ssl.",
(gptr*) &master_ssl_key, (gptr*) &master_ssl_key, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"master-ssl-cert", OPT_MASTER_SSL_CERT,
"Master SSL certificate file name. Only applies if you have enabled master-ssl.",
(gptr*) &master_ssl_cert, (gptr*) &master_ssl_cert, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP or FORCE.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
/*
Option needs to be available for the test case to pass in non-debugging
mode. is a no-op.
*/
{"disconnect-slave-event-count", required_argument, 0,
(int) OPT_DISCONNECT_SLAVE_EVENT_COUNT},
{"abort-slave-event-count", required_argument, 0,
(int) OPT_ABORT_SLAVE_EVENT_COUNT},
{"max-binlog-dump-events", required_argument, 0,
(int) OPT_MAX_BINLOG_DUMP_EVENTS},
{"sporadic-binlog-dump-fail", no_argument, 0,
(int) OPT_SPORADIC_BINLOG_DUMP_FAIL},
{"safemalloc-mem-limit", required_argument, 0, (int)
OPT_SAFEMALLOC_MEM_LIMIT},
{"new", no_argument, 0, 'n'},
{"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},
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count,
(gptr*) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication",
(gptr*) &abort_slave_event_count, (gptr*) &abort_slave_event_count,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS, "Undocumented",
(gptr*) &max_binlog_dump_events, (gptr*) &max_binlog_dump_events, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL, "Undocumented",
(gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"new", 'n', "Use very new possible 'unsafe' functions", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef NOT_YET
{"no-mix-table-types", no_argument, 0, (int) OPT_NO_MIX_TYPE},
#endif
{"old-protocol", no_argument, 0, 'o'},
{"old-rpl-compat", no_argument, 0, (int) OPT_OLD_RPL_COMPAT},
{"no-mix-table-types", OPT_NO_MIX_TYPE, "Undocumented",
(gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"old-protocol", 'o', "Use the old (3.20) protocol",
(gptr*) &protocol_version, (gptr*) &protocol_version, 0, GET_UINT, NO_ARG,
PROTOCOL_VERSION, 0, 0, 0, 0, 0},
{"old-rpl-compat", OPT_OLD_RPL_COMPAT, "Undocumented",
(gptr*) &opt_old_rpl_compat, (gptr*) &opt_old_rpl_compat, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef ONE_THREAD
{"one-thread", no_argument, 0, (int) OPT_ONE_THREAD},
#endif
{"pid-file", required_argument, 0, (int) OPT_PID_FILE},
{"port", required_argument, 0, 'P'},
{"reckless-slave", no_argument, 0, (int) OPT_RECKLESS_SLAVE},
{"replicate-do-db", required_argument, 0, (int) OPT_REPLICATE_DO_DB},
{"replicate-do-table", required_argument, 0,
(int) OPT_REPLICATE_DO_TABLE},
{"replicate-wild-do-table", required_argument, 0,
(int) OPT_REPLICATE_WILD_DO_TABLE},
{"replicate-ignore-db", required_argument, 0,
(int) OPT_REPLICATE_IGNORE_DB},
{"replicate-ignore-table", required_argument, 0,
(int) OPT_REPLICATE_IGNORE_TABLE},
{"replicate-wild-ignore-table", required_argument, 0,
(int) OPT_REPLICATE_WILD_IGNORE_TABLE},
{"replicate-rewrite-db", required_argument, 0,
(int) OPT_REPLICATE_REWRITE_DB},
{"one-thread", OPT_ONE_THREAD,
"Only use one thread (for debugging under Linux)", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld",
(gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port,
(gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"reckless-slave", OPT_RECKLESS_SLAVE, "Undocumented", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-db", OPT_REPLICATE_DO_DB,
"Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-table", OPT_REPLICATE_DO_TABLE,
"Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
"Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
"Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
"Tells the slave thread to not replicate to the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-datbase updates, in contrast to replicate-ignore-db.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
"Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
"Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
// In replication, we may need to tell the other servers how to connect
{"report-host", required_argument, 0, (int) OPT_REPORT_HOST},
{"report-user", required_argument, 0, (int) OPT_REPORT_USER},
{"report-password", required_argument, 0, (int) OPT_REPORT_PASSWORD},
{"report-port", required_argument, 0, (int) OPT_REPORT_PORT},
{"rpl-recovery-rank", required_argument, 0, (int) OPT_RPL_RECOVERY_RANK},
{"relay-log", required_argument, 0, (int) OPT_RELAY_LOG},
{"relay-log-index", required_argument, 0, (int) OPT_RELAY_LOG_INDEX},
{"safe-mode", no_argument, 0, (int) OPT_SAFE},
{"safe-show-database", no_argument, 0, (int) OPT_SAFE_SHOW_DB},
{"safe-user-create", no_argument, 0, (int) OPT_SAFE_USER_CREATE},
{"server-id", required_argument, 0, (int) OPT_SERVER_ID},
{"set-variable", required_argument, 0, 'O'},
{"show-slave-auth-info", no_argument, 0,
(int) OPT_SHOW_SLAVE_AUTH_INFO},
{"skip-bdb", no_argument, 0, (int) OPT_BDB_SKIP},
{"skip-innodb", no_argument, 0, (int) OPT_INNODB_SKIP},
{"skip-concurrent-insert", no_argument, 0, (int) OPT_SKIP_CONCURRENT_INSERT},
{"skip-delay-key-write", no_argument, 0, (int) OPT_SKIP_DELAY_KEY_WRITE},
{"skip-grant-tables", no_argument, 0, (int) OPT_SKIP_GRANT},
{"skip-locking", no_argument, 0, (int) OPT_SKIP_LOCK},
{"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE},
{"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE},
{"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING},
{"skip-new", no_argument, 0, (int) OPT_SKIP_NEW},
{"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC},
{"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB},
{"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START},
{"skip-stack-trace", no_argument, 0, (int) OPT_SKIP_STACK_TRACE},
{"skip-symlink", no_argument, 0, (int) OPT_SKIP_SYMLINKS},
{"skip-thread-priority", no_argument, 0, (int) OPT_SKIP_PRIOR},
{"relay-log-info-file", required_argument, 0,
(int) OPT_RELAY_LOG_INFO_FILE},
{"slave-load-tmpdir", required_argument, 0, (int) OPT_SLAVE_LOAD_TMPDIR},
{"slave-skip-errors", required_argument, 0,
(int) OPT_SLAVE_SKIP_ERRORS},
{"socket", required_argument, 0, (int) OPT_SOCKET},
{"sql-bin-update-same", no_argument, 0, (int) OPT_SQL_BIN_UPDATE_SAME},
{"sql-mode", required_argument, 0, (int) OPT_SQL_MODE},
{"report-host", OPT_REPORT_HOST,
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.",
(gptr*) &report_host, (gptr*) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"report-user", OPT_REPORT_USER, "Undocumented", (gptr*) &report_user,
(gptr*) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"report-password", OPT_REPORT_PASSWORD, "Undocumented",
(gptr*) &report_password, (gptr*) &report_password, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"report-port", OPT_REPORT_PORT,
"Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.",
(gptr*) &report_port, (gptr*) &report_port, 0, GET_UINT, REQUIRED_ARG,
MYSQL_PORT, 0, 0, 0, 0, 0},
{"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented",
(gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_UINT,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log", OPT_RELAY_LOG, "Undocumented",
(gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-index", OPT_RELAY_LOG_INDEX, "Undocumented",
(gptr*) &opt_relaylog_index_name, (gptr*) &opt_relaylog_index_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"safe-show-database", OPT_SAFE_SHOW_DB,
"Don't show databases for which the user has no privileges",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"safe-user-create", OPT_SAFE_USER_CREATE,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table",
(gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, "Undocumented",
(gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"concurrent-insert", OPT_CONCURRENT_INSERT,
"Use concurrent insert with MyISAM. Disable with prefix --skip-",
(gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write", OPT_USE_DELAY_KEY_WRITE,
"Use delay_key_write option for all tables. Disable with prefix --skip-",
(gptr*) &myisam_delay_key_write, (gptr*) &myisam_delay_key_write, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-grant-tables", OPT_SKIP_GRANT,
"Start without grant tables. This gives all users FULL ACCESS to all tables!",
(gptr*) &opt_noacl, (gptr*) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK,
"Don't use system locking. To use isamchk one has to shut down the server.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-name-resolve", OPT_SKIP_RESOLVE,
"Don't resolve hostnames. All hostnames are IP's or 'localhost'",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-networking", OPT_SKIP_NETWORKING,
"Don't allow connection with TCP/IP.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0,
0, 0, 0},
{"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-show-database", OPT_SKIP_SHOW_DB,
"Don't allow 'SHOW DATABASE' commands", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"skip-slave-start", OPT_SKIP_SLAVE_START,
"If set, slave is not autostarted.", (gptr*) &opt_skip_slave_start,
(gptr*) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-stack-trace", OPT_SKIP_STACK_TRACE,
"Don't print a stack trace on failure", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-thread-priority", OPT_SKIP_PRIOR,
"Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented",
(gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented",
(gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
"Tells the slave thread to continue replication when a query returns an error from the provided list. Normally, replication will discontinue when an error is encountered, giving the user a chance to resolve the inconsistency in the data manually. Do not use this option unless you fully understand why you are getting the errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, you should never get an abort with error. Indiscriminate use of this option will result in slaves being hopelessly out of sync with the master and you having no idea how the problem happened. For error codes, you should use the numbers provided by the error message in your slave error log and in the output of SHOW SLAVE STATUS. Full list of error messages can be found in the source distribution in `Docs/mysqld_error.txt'. You can (but should not) also use a very non-recommended value of all which will ignore all error messages and keep barging along regardless. Needless to say, if you use it, we make no promises regarding your data integrity. Please do not complain if your data on the slave is not anywhere close to what it is on the master in this case -- you have been warned. Example: slave-skip-errors=1062,1053 or slave-skip-errors=all",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"socket", OPT_SOCKET, "Socket file to use for connection",
(gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
"If set, setting SQL_LOG_BIN to a value will automatically set SQL_LOG_UPDATE to the same value and vice versa.",
(gptr*) &opt_sql_bin_update, (gptr*) &opt_sql_bin_update, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"sql-mode", OPT_SQL_MODE,
"Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.",
(gptr*) &sql_mode_str, (gptr*) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
#ifdef HAVE_OPENSSL
{"ssl", no_argument, 0, OPT_SSL_SSL},
{"ssl-key", required_argument, 0, OPT_SSL_KEY},
{"ssl-cert", required_argument, 0, OPT_SSL_CERT},
{"ssl-ca", required_argument, 0, OPT_SSL_CA},
{"ssl-capath", required_argument, 0, OPT_SSL_CAPATH},
{"ssl-cipher", required_argument, 0, OPT_SSL_CIPHER},
#endif
#ifdef __WIN__
{"standalone", no_argument, 0, (int) OPT_STANDALONE},
#endif
{"transaction-isolation", required_argument, 0, (int) OPT_TX_ISOLATION},
{"temp-pool", no_argument, 0, (int) OPT_TEMP_POOL},
{"tmpdir", required_argument, 0, 't'},
{"use-locking", no_argument, 0, (int) OPT_USE_LOCKING},
#include "sslopt-longopts.h"
#endif
{"transaction-isolation", OPT_TX_ISOLATION,
"Default transaction isolation level", (gptr*) &default_tx_isolation_name,
(gptr*) &default_tx_isolation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"temp-pool", OPT_TEMP_POOL,
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file. This is to work around a problem in the Linux kernel dealing with creating a bunch of new files with different names. With the old behavior, Linux seems to 'leak' memory, as it's being allocated to the directory entry cache instead of the disk cache.",
(gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"tmpdir", 't', "Path for temporary files", (gptr*) &mysql_tmpdir,
(gptr*) &mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"use-locking", OPT_USE_LOCKING, "Use system locking", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_SYMDIR
{"use-symbolic-links", no_argument, 0, 's'},
#endif
{"user", required_argument, 0, 'u'},
{"version", no_argument, 0, 'V'},
{"warnings", no_argument, 0, 'W'},
{0, 0, 0, 0}
};
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
CHANGEABLE_VAR changeable_vars[] = {
{ "back_log", (long*) &back_log,
50, 1, 65535, 0, 1 },
{"use-symbolic-links", 's', "Enable symbolic link support",
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
#endif
{"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user,
(gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"warnings", 'W', "Log some not critical warnings to the log file",
(gptr*) &opt_warnings, (gptr*) &opt_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{ "back_log", OPT_BACK_LOG,
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG,
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
#ifdef HAVE_BERKELEY_DB
{ "bdb_cache_size", (long*) &berkeley_cache_size,
KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE },
{"bdb_log_buffer_size", (long*) &berkeley_log_buffer_size, 0, 256*1024L,
~0L, 0, 1024},
{ "bdb_max_lock", (long*) &berkeley_max_lock,
10000, 0, (long) ~0, 0, 1 },
{ "bdb_cache_size", OPT_BDB_CACHE_SIZE,
"The buffer that is allocated to cache index and rows for BDB tables."
(gptr*) &berkeley_cache_size, (gptr*) &berkeley_cache_size, 0, GET_ULONG,
REQUIRED_ARG, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE, 0},
{"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE,
"The buffer that is allocated to cache index and rows for BDB tables.",
(gptr*) &berkeley_log_buffer_size, (gptr*) &berkeley_log_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, 0, 256*1024L, ~0L, 0, 1024, 0},
{"bdb_max_lock", OPT_BDB_MAX_LOCK,
"The maximum number of locks you can have active on a BDB table.",
(gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG,
REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0},
/* QQ: The following should be removed soon! */
{ "bdb_lock_max", (long*) &berkeley_max_lock,
10000, 0, (long) ~0, 0, 1 },
#endif
{ "binlog_cache_size", (long*) &binlog_cache_size,
32*1024L, IO_SIZE, ~0L, 0, IO_SIZE },
{ "connect_timeout", (long*) &connect_timeout,
CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1 },
{ "delayed_insert_timeout", (long*) &delayed_insert_timeout,
DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ "delayed_insert_limit", (long*) &delayed_insert_limit,
DELAYED_LIMIT, 1, ~0L, 0, 1 },
{ "delayed_queue_size", (long*) &delayed_queue_size,
DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1 },
{ "flush_time", (long*) &flush_time,
FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1 },
{ "ft_min_word_len", (long*) &ft_min_word_len,
4, 1, HA_FT_MAXLEN, 0, 1 },
{ "ft_max_word_len", (long*) &ft_max_word_len,
HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1 },
{ "ft_max_word_len_for_sort",(long*) &ft_max_word_len_for_sort,
20, 4, HA_FT_MAXLEN, 0, 1 },
{"bdb_lock_max", OPT_BDB_MAX_LOCK, "Synonym for bdb_max_lock",
(gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG,
REQUIRED_ARG, 10000, 0, (long) ~0, 0, 1, 0},
#endif /* HAVE_BERKELEY_DB */
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
"The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.",
(gptr*) &binlog_cache_size, (gptr*) &binlog_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"The number of seconds the mysqld server is waiting for a connect packet before responding with Bad handshake",
(gptr*) &connect_timeout, (gptr*) &connect_timeout, 0, GET_ULONG,
REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
{"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT,
"How long a INSERT DELAYED thread should wait for INSERT statements before terminating.",
(gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0,
GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT,
"After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.",
(gptr*) &delayed_insert_limit, (gptr*) &delayed_insert_limit, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_LIMIT, 1, ~0L, 0, 1, 0},
{ "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE,
"What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.",
(gptr*) &delayed_queue_size, (gptr*) &delayed_queue_size, 0, GET_ULONG,
REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ~0L, 0, 1, 0},
{ "flush_time", OPT_FLUSH_TIME,
"A dedicated thread is created to flush all tables at the given interval.",
(gptr*) &flush_time, (gptr*) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,
REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0},
{ "ft_max_word_len_for_sort", OPT_FT_MAX_WORD_LEN_FOR_SORT,
"Undocumented", (gptr*) &ft_max_word_len_for_sort,
(gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, REQUIRED_ARG, 20, 4,
HA_FT_MAXLEN, 0, 1, 0},
#ifdef HAVE_INNOBASE_DB
{"innodb_mirrored_log_groups",
(long*) &innobase_mirrored_log_groups, 1, 1, 10, 0, 1},
{"innodb_log_files_in_group",
(long*) &innobase_log_files_in_group, 2, 2, 100, 0, 1},
{"innodb_log_file_size",
(long*) &innobase_log_file_size, 5*1024*1024L, 1*1024*1024L,
~0L, 0, 1024*1024L},
{"innodb_log_buffer_size",
(long*) &innobase_log_buffer_size, 1024*1024L, 256*1024L,
~0L, 0, 1024},
{"innodb_buffer_pool_size",
(long*) &innobase_buffer_pool_size, 8*1024*1024L, 1024*1024L,
~0L, 0, 1024*1024L},
{"innodb_additional_mem_pool_size",
(long*) &innobase_additional_mem_pool_size, 1*1024*1024L, 512*1024L,
~0L, 0, 1024},
{"innodb_file_io_threads",
(long*) &innobase_file_io_threads, 4, 4, 64, 0, 1},
{"innodb_lock_wait_timeout",
(long*) &innobase_lock_wait_timeout, 50, 1,
1024 * 1024 * 1024, 0, 1},
{"innodb_thread_concurrency",
(long*) &innobase_thread_concurrency, 8, 1, 1000, 0, 1},
{"innodb_force_recovery",
(long*) &innobase_force_recovery, 0, 0, 6, 0, 1},
#endif
{ "interactive_timeout", (long*) &net_interactive_timeout,
NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ "join_buffer_size", (long*) &join_buff_size,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "key_buffer_size", (long*) &keybuff_size,
KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE },
{ "long_query_time", (long*) &long_query_time,
10, 1, LONG_TIMEOUT, 0, 1 },
{ "lower_case_table_names", (long*) &lower_case_table_names,
IF_WIN(1,0), 0, 1, 0, 1 },
{ "max_allowed_packet", (long*) &max_allowed_packet,
1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
{ "max_binlog_size", (long*) &max_binlog_size,
1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1 },
{ "max_connections", (long*) &max_connections,
100, 1, 16384, 0, 1 },
{ "max_connect_errors", (long*) &max_connect_errors,
MAX_CONNECT_ERRORS, 1, ~0L, 0, 1 },
{ "max_delayed_threads", (long*) &max_insert_delayed_threads,
20, 1, 16384, 0, 1 },
{ "max_heap_table_size", (long*) &max_heap_table_size,
16*1024*1024L, 16384, ~0L, MALLOC_OVERHEAD, 1024 },
{ "max_join_size", (long*) &max_join_size,
~0L, 1, ~0L, 0, 1 },
{ "max_sort_length", (long*) &max_item_sort_length,
1024, 4, 8192*1024L, 0, 1 },
{ "max_tmp_tables", (long*) &max_tmp_tables,
32, 1, ~0L, 0, 1 },
{ "max_user_connections", (long*) &max_user_connections,
0, 1, ~0L, 0, 1 },
{ "max_write_lock_count", (long*) &max_write_lock_count,
~0L, 1, ~0L, 0, 1 },
{ "myisam_bulk_insert_tree_size", (long*) &myisam_bulk_insert_tree_size,
8192*1024, 0, ~0L, 0, 1 },
{ "myisam_block_size", (long*) &opt_myisam_block_size,
{"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS,
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
(gptr*) &innobase_mirrored_log_groups,
(gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10,
0, 1, 0},
{"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
(gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group,
0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0},
{"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
"Size of each log file in a log group in megabytes.",
(gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0,
GET_LONG, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, ~0L, 0, 1024*1024L, 0},
{"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
(gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0,
GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0},
{"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
(gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0},
{"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
(gptr*) &innobase_additional_mem_pool_size,
(gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG,
1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0},
{"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS,
"Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads,
(gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0,
1, 0},
{"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT,
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back.",
(gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout,
0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
{"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
"Helps in performance tuning in heavily concurrent environments.",
(gptr*) &innobase_thread_concurrency, (gptr*) &innobase_thread_concurrency,
0, GET_LONG, REQUIRED_ARG, 8, 1, 1000, 0, 1, 0},
{"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY,
"Helps to save your data in case the disk image of the database becomes corrupt.",
(gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0,
GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0},
#endif /* HAVE_INNOBASE_DB */
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
"The number of seconds the server waits for activity on an interactive connection before closing it.",
(gptr*) &net_interactive_timeout, (gptr*) &net_interactive_timeout, 0,
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"join_buffer_size", OPT_JOIN_BUFF_SIZE,
"The size of the buffer that is used for full joins.",
(gptr*) &join_buff_size, (gptr*) &join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
(gptr*) &keybuff_size, (gptr*) &keybuff_size, 0, GET_ULONG, REQUIRED_ARG,
KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0},
{"long_query_time", OPT_LONG_QUERY_TIME,
"Log all queries that have taken more than long_query_time seconds to execute to file.",
(gptr*) &long_query_time, (gptr*) &long_query_time, 0, GET_ULONG,
REQUIRED_ARG, 10, 1, LONG_TIMEOUT, 0, 1, 0},
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
"If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.",
(gptr*) &lower_case_table_names, (gptr*) &lower_case_table_names, 0,
GET_ULONG, REQUIRED_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packetlength to send/receive from to server.",
(gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
"Can be used to restrict the total size used to cache a multi-transaction query.",
(gptr*) &max_binlog_cache_size, (gptr*) &max_binlog_cache_size, 0,
GET_ULONG, REQUIRED_ARG, ~0L, IO_SIZE, ~0L, 0, IO_SIZE, 0},
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
"Binary log will be rotated automatically when the size crosses the limit.",
(gptr*) &max_binlog_size, (gptr*) &max_binlog_size, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1, 0},
{"max_connections", OPT_MAX_CONNECTIONS,
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,
0},
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
"If there is more than this number of interrupted connections from a host this host will be blocked from further connections.",
(gptr*) &max_connect_errors, (gptr*) &max_connect_errors, 0, GET_ULONG,
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0},
{"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
"Don't start more than this number of threads to handle INSERT DELAYED statements.",
(gptr*) &max_insert_delayed_threads, (gptr*) &max_insert_delayed_threads,
0, GET_ULONG, REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
"Don't allow creation of heap tables bigger than this.",
(gptr*) &max_heap_table_size, (gptr*) &max_heap_table_size, 0, GET_ULONG,
REQUIRED_ARG, 16*1024*1024L, 16384, ~0L, MALLOC_OVERHEAD, 1024, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
(gptr*) &max_join_size, (gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0},
{"max_sort_length", OPT_MAX_SORT_LENGTH,
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
(gptr*) &max_item_sort_length, (gptr*) &max_item_sort_length, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
"Maximum number of temporary tables a client can keep open at a time.",
(gptr*) &max_tmp_tables, (gptr*) &max_tmp_tables, 0, GET_ULONG,
REQUIRED_ARG, 32, 1, ~0L, 0, 1, 0},
{"max_user_connections", OPT_MAX_USER_CONNECTIONS,
"The maximum number of active connections for a single user (0 = no limit).",
(gptr*) &max_user_connections, (gptr*) &max_user_connections, 0, GET_ULONG,
REQUIRED_ARG, 0, 1, ~0L, 0, 1, 0},
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
"After this many write locks, allow some read locks to run in between.",
(gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG,
REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0},
{"myisam_bulk_insert_tree_size", OPT_MYISAM_BULK_INSERT_TREE_SIZE,
"Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!",
(gptr*) &myisam_bulk_insert_tree_size,
(gptr*) &myisam_bulk_insert_tree_size, 0, GET_ULONG, REQUIRED_ARG,
8192*1024, 0, ~0L, 0, 1, 0},
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
"Undocumented", (gptr*) &opt_myisam_block_size,
(gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
0, MI_MIN_KEY_BLOCK_LENGTH },
{ "myisam_max_extra_sort_file_size",
(long*) &myisam_max_extra_sort_file_size,
(long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)), 0, ~0L, 0, 1 },
{ "myisam_max_sort_file_size", (long*) &myisam_max_sort_file_size,
(long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1 },
{ "myisam_sort_buffer_size", (long*) &myisam_sort_buffer_size,
8192*1024, 4, ~0L, 0, 1 },
{ "net_buffer_length", (long*) &net_buffer_length,
16384, 1024, 1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "net_retry_count", (long*) &mysqld_net_retry_count,
MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1 },
{ "net_read_timeout", (long*) &net_read_timeout,
NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ "net_write_timeout", (long*) &net_write_timeout,
NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ "open_files_limit", (long*) &open_files_limit,
0, 0, 65535, 0, 1},
{ "query_buffer_size", (long*) &query_buff_size,
0, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE },
0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Used to help MySQL to decide when to use the slow but safe key cache index create method. Note that this parameter is given in megabytes!",
(gptr*) &myisam_max_extra_sort_file_size,
(gptr*) &myisam_max_extra_sort_file_size, 0, GET_ULONG, REQUIRED_ARG,
(long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)), 0, ~0L, 0, 1, 0},
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary file would get bigger than this. Note that this paramter is given in megabytes!",
(gptr*) &myisam_max_sort_file_size, (gptr*) &myisam_max_sort_file_size, 0,
GET_ULONG, REQUIRED_ARG, (long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1, 0},
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
"The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
(gptr*) &myisam_sort_buffer_size, (gptr*) &myisam_sort_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer for TCP/IP and socket communication.", (gptr*) &net_buffer_length,
(gptr*) &net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 16384, 1024,
1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_retry_count", OPT_NET_RETRY_COUNT,
"If a read on a communication port is interrupted, retry this many times before giving up.",
(gptr*) &mysqld_net_retry_count, (gptr*) &mysqld_net_retry_count, 0,
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1, 0},
{"net_read_timeout", OPT_NET_READ_TIMEOUT,
"Number of seconds to wait for more data from a connection before aborting the read.",
(gptr*) &net_read_timeout, (gptr*) &net_read_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
"Number of seconds to wait for a block to be written to a connection before aborting the write.",
(gptr*) &net_write_timeout, (gptr*) &net_write_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.",
(gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 65535, 0, 1, 0},
{"query_buffer_size", OPT_QUERY_BUFFER_SIZE,
"The initial allocation of the query buffer.", (gptr*) &query_buff_size,
(gptr*) &query_buff_size, 0, GET_ULONG, REQUIRED_ARG, 0, MALLOC_OVERHEAD,
(long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0},
#ifdef HAVE_QUERY_CACHE
{ "query_cache_limit", (long*) &query_cache_limit,
1024*1024L, 0, ULONG_MAX, 0, 1},
{"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
"Don't cache results that are bigger than this.",
(gptr*) &query_cache_limit, (gptr*) &query_cache_limit, 0, GET_ULONG,
REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{ "query_cache_size", (long*) &query_cache_size,
0, 0, ULONG_MAX, 0, 1},
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
"The memory allocated to store results from old queries.",
(gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
#ifdef HAVE_QUERY_CACHE
{ "query_cache_startup_type",(long*) &query_cache_startup_type,
1, 0, 2, 0, 1},
{"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE,
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
(gptr*) &query_cache_startup_type, (gptr*) &query_cache_startup_type, 0,
GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
#endif /*HAVE_QUERY_CACHE*/
{ "record_buffer", (long*) &my_default_record_cache_size,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "record_rnd_buffer", (long*) &record_rnd_cache_size,
0, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE },
{ "relay_log_space_limit", (long*) &relay_log_space_limit, 0L, 0L,ULONG_MAX,
0, 1},
{ "slave_net_timeout", (long*) &slave_net_timeout,
SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ "slow_launch_time", (long*) &slow_launch_time,
2L, 0L, LONG_TIMEOUT, 0, 1 },
{ "sort_buffer", (long*) &sortbuff_size,
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD, 1 },
{ "table_cache", (long*) &table_cache_size,
64, 1, 16384, 0, 1 },
{ "thread_concurrency", (long*) &concurrency,
DEFAULT_CONCURRENCY, 1, 512, 0, 1 },
{ "thread_cache_size", (long*) &thread_cache_size,
0, 0, 16384, 0, 1 },
{ "tmp_table_size", (long*) &tmp_table_size,
32*1024*1024L, 1024, ~0L, 0, 1 },
{ "thread_stack", (long*) &thread_stack,
DEFAULT_THREAD_STACK, 1024*32, ~0L, 0, 1024 },
{ "wait_timeout", (long*) &net_wait_timeout,
NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1 },
{ NullS, (long*) 0, 0, 0, 0, 0, 0}
{"record_buffer", OPT_RECORD_BUFFER,
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.",
(gptr*) &my_default_record_cache_size,
(gptr*) &my_default_record_cache_size, 0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
{"record_rnd_buffer", OPT_RECORD_RND_BUFFER,
"When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.",
(gptr*) &record_rnd_cache_size, (gptr*) &record_rnd_cache_size, 0,
GET_ULONG, REQUIRED_ARG, 0, IO_SIZE*2+MALLOC_OVERHEAD,
~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
"Undocumented", (gptr*) &relay_log_space_limit,
(gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L,
ULONG_MAX, 0, 1, 0},
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
"Undocumented", (gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
(gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
{"sort_buffer", OPT_SORT_BUFFER,
"Each thread that needs to do a sort allocates a buffer of this size.",
(gptr*) &sortbuff_size, (gptr*) &sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD,
1, 0},
{"table_cache", OPT_TABLE_CACHE,
"The number of open tables for all threads.", (gptr*) &table_cache_size,
(gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 16384, 0, 1,
0},
{"thread_concurrency", OPT_THREAD_CONCURRENCY,
"Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.",
(gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0},
{"thread_cache_size", OPT_THREAD_CACHE_SIZE,
"How many threads we should keep in a cache for reuse.",
(gptr*) &thread_cache_size, (gptr*) &thread_cache_size, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
(gptr*) &tmp_table_size, (gptr*) &tmp_table_size, 0, GET_ULONG,
REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0},
{"thread_stack", OPT_THREAD_STACK,
"The stack size for each thread.", (gptr*) &thread_stack,
(gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
1024*32, ~0L, 0, 1024, 0},
{"wait_timeout", OPT_WAIT_TIMEOUT,
"The number of seconds the server waits for activity on a connection before closing it",
(gptr*) &net_wait_timeout, (gptr*) &net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
struct show_var_st init_vars[]= {
{"back_log", (char*) &back_log, SHOW_LONG},
{"basedir", mysql_home, SHOW_CHAR},
......@@ -3417,167 +3823,22 @@ and you are welcome to modify and redistribute it under the GPL license\n\
Starts the MySQL server\n");
printf("Usage: %s [OPTIONS]\n", my_progname);
puts("\n\
--ansi Use ANSI SQL syntax instead of MySQL syntax\n\
-b, --basedir=path Path to installation directory. All paths are\n\
usually resolved relative to this\n\
--big-tables Allow big result sets by saving all temporary sets\n\
on file (Solves most 'table full' errors)\n\
--bind-address=IP Ip address to bind to\n\
--bootstrap Used by mysql installation scripts\n\
--character-sets-dir=...\n\
Directory where character sets are\n\
--chroot=path Chroot mysqld daemon during startup\n\
--core-file Write core on errors\n\
-h, --datadir=path Path to the database root");
#ifndef DBUG_OFF
printf("\
-#, --debug[=...] Debug log. Default is '%s'\n",default_dbug_option);
#ifdef SAFEMALLOC
puts("\
--skip-safemalloc Don't use the memory allocation checking");
#endif
#endif
puts("\
--default-character-set=charset\n\
Set the default character set\n\
--default-table-type=type\n\
Set the default table type for tables\n\
--delay-key-write-for-all-tables\n\
Don't flush key buffers between writes for any MyISAM\n\
table\n");
#ifdef HAVE_OPENSSL
puts("\
--des-key-file Load keys for des_encrypt() and des_encrypt\n\
from given file");
#endif /* HAVE_OPENSSL */
puts("\
--enable-locking Enable system locking\n\
--enable-pstack Print a symbolic stack trace on failure\n\
-T, --exit-info Used for debugging; Use at your own risk!\n\
--flush Flush tables to disk between SQL commands\n\
-?, --help Display this help and exit\n\
--init-file=file Read SQL commands from this file at startup\n\
-L, --language=... Client error messages in given language. May be\n\
given as a full path\n\
--local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-l, --log[=file] Log connections and queries to file\n\
--log-bin[=file] Log queries in new binary format (for replication)\n\
--log-bin-index=file File that holds the names for last binary log files\n\
--log-update[=file] Log updates to file.# where # is a unique number\n\
if not given.\n\
--log-isam[=file] Log all MyISAM changes to file\n\
--log-long-format Log some extra information to update log\n\
--low-priority-updates INSERT/DELETE/UPDATE has lower priority than selects\n\
--log-slow-queries=[file]\n\
Log slow queries to this log file. Defaults logging\n\
to hostname-slow.log\n\
--pid-file=path Pid file used by safe_mysqld\n\
--myisam-recover[=option[,option...]] where options is one of DEAULT,\n\
BACKUP or FORCE.\n\
--memlock Lock mysqld in memory\n\
-n, --new Use very new possible 'unsafe' functions\n\
-o, --old-protocol Use the old (3.20) protocol\n\
-P, --port=... Port number to use for connection\n");
#ifdef ONE_THREAD
puts("\
--one-thread Only use one thread (for debugging under Linux)\n");
#endif
puts("\
-O, --set-variable var=option\n\
Give a variable an value. --help lists variables\n\
--safe-mode Skip some optimize stages (for testing)\n\
--safe-show-database Don't show databases for which the user has no\n\
privileges\n\
--safe-user-create Don't allow new user creation by the user who has\n\
no write privileges to the mysql.user table\n\
--skip-concurrent-insert\n\
Don't use concurrent insert with MyISAM\n\
--skip-delay-key-write\n\
Ignore the delay_key_write option for all tables\n\
--skip-grant-tables Start without grant tables. This gives all users\n\
FULL ACCESS to all tables!\n\
--skip-host-cache Don't cache host names\n\
--skip-locking Don't use system locking. To use isamchk one has\n\
to shut down the server.\n\
--skip-name-resolve Don't resolve hostnames.\n\
All hostnames are IP's or 'localhost'\n\
--skip-networking Don't allow connection with TCP/IP.\n\
--skip-new Don't use new, possible wrong routines.\n");
/* We have to break the string here because of VC++ limits */
puts("\
--skip-stack-trace Don't print a stack trace on failure\n\
--skip-symlink Don't allow symlinking of tables\n\
--skip-show-database Don't allow 'SHOW DATABASE' commands\n\
--skip-thread-priority\n\
Don't give threads different priorities.\n\
--socket=... Socket file to use for connection\n\
-t, --tmpdir=path Path for temporary files\n\
--sql-mode=option[,option[,option...]] where option can be one of:\n\
REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES,\n\
IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY,\n\
NO_UNSIGNED_SUBTRACTION.\n\
--transaction-isolation\n\
Default transaction isolation level\n\
--temp-pool Use a pool of temporary files\n\
-u, --user=user_name Run mysqld daemon as user\n\
-V, --version output version information and exit\n\
-W, --warnings Log some not critical warnings to the log file\n");
#ifdef __WIN__
puts("NT and Win32 specific options:\n\
--console Don't remove the console window\n\
--install Install the default service (NT)\n\
--install-manual Install the default service started manually (NT)\n\
--remove Remove the default service from the service list (NT)\n\
--enable-named-pipe Enable the named pipe (NT)\n\
--standalone Dummy option to start as a standalone program (NT)\
");
#ifdef USE_SYMDIR
puts("--use-symbolic-links Enable symbolic link support");
#endif
puts("");
#endif
#ifdef HAVE_BERKELEY_DB
puts("\
--bdb-home= directory Berkeley home direcory\n\
--bdb-lock-detect=# Berkeley lock detect\n\
(DEFAULT, OLDEST, RANDOM or YOUNGEST, # sec)\n\
--bdb-logdir=directory Berkeley DB log file directory\n\
--bdb-no-sync Don't synchronously flush logs\n\
--bdb-no-recover Don't try to recover Berkeley DB tables on start\n\
--bdb-shared-data Start Berkeley DB in multi-process mode\n\
--bdb-tmpdir=directory Berkeley DB tempfile name\n\
--skip-bdb Don't use berkeley db (will save memory)\n\
");
#endif /* HAVE_BERKELEY_DB */
#ifdef HAVE_INNOBASE_DB
puts("\
--innodb_data_home_dir=dir The common part for Innodb table spaces\n\
--innodb_data_file_path=dir Path to individual files and their sizes\n\
--innodb_flush_method=# With which method to flush data\n\
--innodb_flush_log_at_trx_commit[=#]\n\
Set to 0 if you don't want to flush logs\n\
--innodb_log_arch_dir=dir Where full logs should be archived\n\
--innodb_log_archive[=#] Set to 1 if you want to have logs archived\n\
--innodb_log_group_home_dir=dir Path to innodb log files.\n\
--skip-innodb Don't use Innodb (will save memory)\n\
");
#endif /* HAVE_INNOBASE_DB */
print_defaults("my",load_default_groups);
puts("");
#ifdef HAVE_OPENSSL
puts("\
--ssl Use SSL for connection (automatically set with other flags\n\
--ssl-key X509 key in PEM format (implies --ssl)\n\
--ssl-cert X509 cert in PEM format (implies --ssl)\n\
--ssl-ca CA file in PEM format (check OpenSSL docs, implies --ssl)\n\
--ssl-capath CA directory (check OpenSSL docs, implies --ssl)\n\
--ssl-cipher SSL cipher to use (implies --ssl)");
#endif
fix_paths();
set_ports();
my_print_help(my_long_options);
my_print_variables(my_long_options);
printf("\
To see what values a running MySQL server is using, type\n\
'mysqladmin variables' instead of 'mysqld --help'.\n\
......@@ -3610,17 +3871,11 @@ The default values (after parsing the command line arguments) are:\n\n");
puts("\nsystem locking is not in use");
if (opt_noacl)
puts("\nGrant tables are not used. All users have full access rights");
printf("\nPossible variables for option --set-variable (-O) are:\n");
for (uint i=0 ; changeable_vars[i].name ; i++)
printf("%-20s current value: %lu\n",
changeable_vars[i].name,
(ulong) *changeable_vars[i].varptr);
}
static void set_options(void)
{
set_all_changeable_vars( changeable_vars );
#if !defined( my_pthread_setprio ) && !defined( HAVE_PTHREAD_SETSCHEDPARAM )
opt_specialflag |= SPECIAL_NO_PRIOR;
#endif
......@@ -3650,36 +3905,18 @@ static void set_options(void)
my_bind_addr = htonl( INADDR_ANY );
}
/* Initiates DEBUG - but no debugging here ! */
static void get_options(int argc,char **argv)
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
int c,option_index=0;
myisam_delay_key_write=1; // Allow use of this
#ifndef HAVE_purify
my_use_symdir=1; // Use internal symbolic links
#else
/* Symlinks gives too many warnings with purify */
my_disable_symlinks=1;
my_use_symdir=0;
have_symlink=SHOW_OPTION_DISABLED;
#endif
optind = 0; // setup in case getopt() was called previously
while ((c=getopt_long(argc,argv,"ab:C:h:#::T::?l::L:O:P:sS::t:u:noVvWI?",
long_options, &option_index)) != EOF)
{
switch(c) {
switch(optid) {
case '#':
#ifndef DBUG_OFF
DBUG_PUSH(optarg ? optarg : default_dbug_option);
DBUG_PUSH(argument ? argument : default_dbug_option);
#endif
opt_endinfo=1; /* unireg: memory allocation */
break;
case 'W':
opt_warnings=1;
break;
case 'a':
opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT |
MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE
......@@ -3687,17 +3924,17 @@ static void get_options(int argc,char **argv)
default_tx_isolation= ISO_SERIALIZABLE;
break;
case 'b':
strmake(mysql_home,optarg,sizeof(mysql_home)-1);
strmake(mysql_home,argument,sizeof(mysql_home)-1);
break;
case 'l':
opt_log=1;
opt_logname=optarg; // Use hostname.log if null
opt_logname=argument; // Use hostname.log if null
break;
case 'h':
strmake(mysql_real_data_home,optarg, sizeof(mysql_real_data_home)-1);
strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1);
break;
case 'L':
strmake(language, optarg, sizeof(language)-1);
strmake(language, argument, sizeof(language)-1);
break;
case 'n':
opt_specialflag|= SPECIAL_NEW_FUNC;
......@@ -3705,58 +3942,37 @@ static void get_options(int argc,char **argv)
case 'o':
protocol_version=PROTOCOL_VERSION-1;
break;
case 'O':
if (set_changeable_var(optarg, changeable_vars))
{
use_help();
exit(1);
}
break;
case 'P':
mysql_port= (unsigned int) atoi(optarg);
mysql_port= (unsigned int) atoi(argument);
break;
case OPT_LOCAL_INFILE:
opt_local_infile= test(!optarg || atoi(optarg) != 0);
opt_local_infile= test(!argument || atoi(argument) != 0);
break;
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(optarg);
init_slave_skip_errors(argument);
break;
case OPT_SAFEMALLOC_MEM_LIMIT:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
safemalloc_mem_limit = atoi(optarg);
safemalloc_mem_limit = atoi(argument);
#endif
break;
case OPT_RPL_RECOVERY_RANK:
rpl_recovery_rank=atoi(optarg);
rpl_recovery_rank=atoi(argument);
break;
case OPT_SLAVE_LOAD_TMPDIR:
slave_load_tmpdir = my_strdup(optarg, MYF(MY_FAE));
break;
case OPT_OLD_RPL_COMPAT:
opt_old_rpl_compat = 1;
break;
case OPT_SHOW_SLAVE_AUTH_INFO:
opt_show_slave_auth_info = 1;
slave_load_tmpdir = my_strdup(argument, MYF(MY_FAE));
break;
case OPT_SOCKET:
mysql_unix_port= optarg;
mysql_unix_port= argument;
break;
case 'r':
mysqld_chroot=optarg;
break;
#ifdef USE_SYMDIR
case 's':
my_use_symdir=1; /* Use internal symbolic links */
mysqld_chroot=argument;
break;
#endif
case 't':
mysql_tmpdir=optarg;
break;
case OPT_TEMP_POOL:
use_temp_pool=1;
mysql_tmpdir=argument;
break;
case 'u':
mysqld_user=optarg;
mysqld_user=argument;
break;
case 'v':
case 'V':
......@@ -3767,7 +3983,7 @@ static void get_options(int argc,char **argv)
usage();
exit(0);
case 'T':
test_flags= optarg ? (uint) atoi(optarg) : 0;
test_flags= argument ? (uint) atoi(argument) : 0;
opt_endinfo=1;
break;
case (int) OPT_BIG_TABLES:
......@@ -3775,62 +3991,52 @@ static void get_options(int argc,char **argv)
break;
case (int) OPT_ISAM_LOG:
opt_myisam_log=1;
if (optarg)
myisam_log_filename=optarg;
if (argument)
myisam_log_filename=argument;
break;
case (int) OPT_UPDATE_LOG:
opt_update_log=1;
opt_update_logname=optarg; // Use hostname.# if null
opt_update_logname=argument; // Use hostname.# if null
break;
case (int) OPT_RELAY_LOG_INDEX:
opt_relaylog_index_name = optarg;
opt_relaylog_index_name = argument;
break;
case (int) OPT_RELAY_LOG:
x_free(opt_relay_logname);
if (optarg && optarg[0])
opt_relay_logname=my_strdup(optarg,MYF(0));
if (argument && argument[0])
opt_relay_logname=my_strdup(argument,MYF(0));
break;
case (int) OPT_BIN_LOG_INDEX:
opt_binlog_index_name = optarg;
opt_binlog_index_name = argument;
break;
case (int) OPT_BIN_LOG:
opt_bin_log=1;
x_free(opt_bin_logname);
if (optarg && optarg[0])
opt_bin_logname=my_strdup(optarg,MYF(0));
if (argument && argument[0])
opt_bin_logname=my_strdup(argument,MYF(0));
break;
// needs to be handled (as no-op) in non-debugging mode for test suite
case (int)OPT_DISCONNECT_SLAVE_EVENT_COUNT:
#ifndef DBUG_OFF
disconnect_slave_event_count = atoi(optarg);
disconnect_slave_event_count = atoi(argument);
#endif
break;
case (int)OPT_ABORT_SLAVE_EVENT_COUNT:
#ifndef DBUG_OFF
abort_slave_event_count = atoi(optarg);
abort_slave_event_count = atoi(argument);
#endif
break;
case (int)OPT_SPORADIC_BINLOG_DUMP_FAIL:
case (int) OPT_MAX_BINLOG_DUMP_EVENTS:
#ifndef DBUG_OFF
opt_sporadic_binlog_dump_fail = 1;
max_binlog_dump_events = atoi(argument);
#endif
break;
case (int)OPT_MAX_BINLOG_DUMP_EVENTS:
#ifndef DBUG_OFF
max_binlog_dump_events = atoi(optarg);
#endif
break;
case (int) OPT_LOG_SLAVE_UPDATES:
opt_log_slave_updates = 1;
break;
case (int) OPT_INIT_RPL_ROLE:
{
int role;
if ((role=find_type(optarg, &rpl_role_typelib, 2)) <= 0)
if ((role=find_type(argument, &rpl_role_typelib, 2)) <= 0)
{
fprintf(stderr, "Unknown replication role: %s\n", optarg);
fprintf(stderr, "Unknown replication role: %s\n", argument);
exit(1);
}
rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE;
......@@ -3838,20 +4044,20 @@ static void get_options(int argc,char **argv)
}
case (int)OPT_REPLICATE_IGNORE_DB:
{
i_string *db = new i_string(optarg);
i_string *db = new i_string(argument);
replicate_ignore_db.push_back(db);
break;
}
case (int)OPT_REPLICATE_DO_DB:
{
i_string *db = new i_string(optarg);
i_string *db = new i_string(argument);
replicate_do_db.push_back(db);
break;
}
case (int)OPT_REPLICATE_REWRITE_DB:
{
char* key = optarg,*p, *val;
p = strstr(optarg, "->");
char* key = argument,*p, *val;
p = strstr(argument, "->");
if (!p)
{
fprintf(stderr,
......@@ -3859,8 +4065,8 @@ static void get_options(int argc,char **argv)
exit(1);
}
val = p--;
while(isspace(*p) && p > optarg) *p-- = 0;
if(p == optarg)
while(isspace(*p) && p > argument) *p-- = 0;
if(p == argument)
{
fprintf(stderr,
"Bad syntax in replicate-rewrite-db - empty FROM db!\n");
......@@ -3883,13 +4089,13 @@ static void get_options(int argc,char **argv)
case (int)OPT_BINLOG_IGNORE_DB:
{
i_string *db = new i_string(optarg);
i_string *db = new i_string(argument);
binlog_ignore_db.push_back(db);
break;
}
case (int)OPT_BINLOG_DO_DB:
{
i_string *db = new i_string(optarg);
i_string *db = new i_string(argument);
binlog_do_db.push_back(db);
break;
}
......@@ -3897,9 +4103,9 @@ static void get_options(int argc,char **argv)
{
if (!do_table_inited)
init_table_rule_hash(&replicate_do_table, &do_table_inited);
if(add_table_rule(&replicate_do_table, optarg))
if(add_table_rule(&replicate_do_table, argument))
{
fprintf(stderr, "Could not add do table rule '%s'!\n", optarg);
fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
exit(1);
}
table_rules_on = 1;
......@@ -3910,9 +4116,9 @@ static void get_options(int argc,char **argv)
if (!wild_do_table_inited)
init_table_rule_array(&replicate_wild_do_table,
&wild_do_table_inited);
if(add_wild_table_rule(&replicate_wild_do_table, optarg))
if(add_wild_table_rule(&replicate_wild_do_table, argument))
{
fprintf(stderr, "Could not add do table rule '%s'!\n", optarg);
fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
exit(1);
}
table_rules_on = 1;
......@@ -3923,9 +4129,9 @@ static void get_options(int argc,char **argv)
if (!wild_ignore_table_inited)
init_table_rule_array(&replicate_wild_ignore_table,
&wild_ignore_table_inited);
if(add_wild_table_rule(&replicate_wild_ignore_table, optarg))
if(add_wild_table_rule(&replicate_wild_ignore_table, argument))
{
fprintf(stderr, "Could not add ignore table rule '%s'!\n", optarg);
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
exit(1);
}
table_rules_on = 1;
......@@ -3935,28 +4141,22 @@ static void get_options(int argc,char **argv)
{
if (!ignore_table_inited)
init_table_rule_hash(&replicate_ignore_table, &ignore_table_inited);
if(add_table_rule(&replicate_ignore_table, optarg))
if(add_table_rule(&replicate_ignore_table, argument))
{
fprintf(stderr, "Could not add ignore table rule '%s'!\n", optarg);
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
exit(1);
}
table_rules_on = 1;
break;
}
case (int) OPT_SQL_BIN_UPDATE_SAME:
opt_sql_bin_update = 1;
break;
case (int) OPT_SLOW_QUERY_LOG:
opt_slow_log=1;
opt_slow_logname=optarg;
opt_slow_logname=argument;
break;
case (int)OPT_RECKLESS_SLAVE:
opt_reckless_slave = 1;
init_slave_skip_errors("all");
break;
case (int)OPT_SKIP_SLAVE_START:
opt_skip_slave_start = 1;
break;
case (int) OPT_SKIP_NEW:
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
myisam_delay_key_write=0;
......@@ -3976,15 +4176,9 @@ static void get_options(int argc,char **argv)
myisam_recover_options= HA_RECOVER_NONE; // To be changed
ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED;
break;
case (int) OPT_SKIP_CONCURRENT_INSERT:
myisam_concurrent_insert=0;
break;
case (int) OPT_SKIP_PRIOR:
opt_specialflag|= SPECIAL_NO_PRIOR;
break;
case (int) OPT_SKIP_GRANT:
opt_noacl=1;
break;
case (int) OPT_SKIP_LOCK:
my_disable_locking=myisam_single_user= 1;
break;
......@@ -4003,9 +4197,6 @@ static void get_options(int argc,char **argv)
case (int) OPT_LONG_FORMAT:
opt_specialflag|=SPECIAL_LONG_LOG_FORMAT;
break;
case (int) OPT_NO_MIX_TYPE:
opt_no_mix_types = 1;
break;
case (int) OPT_SKIP_NETWORKING:
opt_disable_networking=1;
mysql_port=0;
......@@ -4015,9 +4206,6 @@ static void get_options(int argc,char **argv)
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
mysql_port=0;
break;
case (int) OPT_MEMLOCK:
locked_in_memory=1;
break;
case (int) OPT_ONE_THREAD:
test_flags |= TEST_NO_THREADS;
break;
......@@ -4033,15 +4221,15 @@ static void get_options(int argc,char **argv)
have_symlink=SHOW_OPTION_DISABLED;
break;
case (int) OPT_BIND_ADDRESS:
if (optarg && isdigit(optarg[0]))
if (argument && isdigit(argument[0]))
{
my_bind_addr = (ulong) inet_addr(optarg);
my_bind_addr = (ulong) inet_addr(argument);
}
else
{
struct hostent *ent;
if (!optarg || !optarg[0])
ent=gethostbyname(optarg);
if (!argument || !argument[0])
ent=gethostbyname(argument);
else
{
char myhostname[255];
......@@ -4061,22 +4249,14 @@ static void get_options(int argc,char **argv)
}
break;
case (int) OPT_PID_FILE:
strmake(pidfile_name, optarg, sizeof(pidfile_name)-1);
strmake(pidfile_name, argument, sizeof(pidfile_name)-1);
break;
case (int) OPT_INIT_FILE:
opt_init_file=optarg;
break;
case (int) OPT_HAVE_NAMED_PIPE:
#if __NT__
opt_enable_named_pipe=1;
#endif
opt_init_file=argument;
break;
#ifdef __WIN__
case (int) OPT_STANDALONE: /* Dummy option for NT */
break;
case (int) OPT_CONSOLE:
opt_console=1;
break;
#endif
case (int) OPT_FLUSH:
#ifdef HAVE_ISAM
......@@ -4096,73 +4276,43 @@ static void get_options(int argc,char **argv)
case OPT_TABLE_TYPE:
{
int type;
if ((type=find_type(optarg, &ha_table_typelib, 2)) <= 0)
if ((type=find_type(argument, &ha_table_typelib, 2)) <= 0)
{
fprintf(stderr,"Unknown table type: %s\n",optarg);
fprintf(stderr,"Unknown table type: %s\n",argument);
exit(1);
}
default_table_type= (enum db_type) type;
break;
}
case OPT_SERVER_ID:
server_id = atoi(optarg);
server_id = atoi(argument);
server_id_supplied = 1;
break;
case OPT_DELAY_KEY_WRITE:
ha_open_options|=HA_OPEN_DELAY_KEY_WRITE;
myisam_delay_key_write=1;
break;
case OPT_SKIP_DELAY_KEY_WRITE:
myisam_delay_key_write=0;
break;
case 'C':
strmake(default_charset, optarg, sizeof(default_charset)-1);
strmake(default_charset, argument, sizeof(default_charset)-1);
break;
case OPT_CHARSETS_DIR:
strmake(mysql_charsets_dir, optarg, sizeof(mysql_charsets_dir)-1);
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1);
charsets_dir = mysql_charsets_dir;
break;
#ifdef HAVE_OPENSSL
case OPT_SSL_SSL:
opt_use_ssl = 1; /* true */
break;
case OPT_SSL_KEY:
opt_use_ssl = 1; /* true */
my_free(opt_ssl_key, MYF(MY_ALLOW_ZERO_PTR));
opt_ssl_key = my_strdup(optarg, MYF(0));
break;
case OPT_SSL_CERT:
opt_use_ssl = 1; /* true */
my_free(opt_ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
opt_ssl_cert = my_strdup(optarg, MYF(0));
break;
case OPT_SSL_CA:
opt_use_ssl = 1; /* true */
my_free(opt_ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
opt_ssl_ca = my_strdup(optarg, MYF(0));
break;
case OPT_SSL_CAPATH:
opt_use_ssl = 1; /* true */
my_free(opt_ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
opt_ssl_capath = my_strdup(optarg, MYF(0));
break;
case OPT_SSL_CIPHER:
opt_use_ssl = 1; /* true */
my_free(opt_ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
opt_ssl_cipher = my_strdup(optarg, MYF(0));
break;
#include "sslopt-case.h"
#endif
case OPT_DES_KEY_FILE:
#ifdef HAVE_OPENSSL
des_key_file=optarg;
des_key_file=argument;
#endif
break;
case OPT_TX_ISOLATION:
{
int type;
if ((type=find_type(optarg, &tx_isolation_typelib, 2)) <= 0)
if ((type=find_type(argument, &tx_isolation_typelib, 2)) <= 0)
{
fprintf(stderr,"Unknown transaction isolation type: %s\n",optarg);
fprintf(stderr,"Unknown transaction isolation type: %s\n",argument);
exit(1);
}
default_tx_isolation= (enum_tx_isolation) (type-1);
......@@ -4170,10 +4320,10 @@ static void get_options(int argc,char **argv)
}
#ifdef HAVE_BERKELEY_DB
case OPT_BDB_LOG:
berkeley_logdir=optarg;
berkeley_logdir=argument;
break;
case OPT_BDB_HOME:
berkeley_home=optarg;
berkeley_home=argument;
break;
case OPT_BDB_NOSYNC:
berkeley_env_flags|=DB_TXN_NOSYNC;
......@@ -4182,20 +4332,20 @@ static void get_options(int argc,char **argv)
berkeley_init_flags&= ~(DB_RECOVER);
break;
case OPT_BDB_TMP:
berkeley_tmpdir=optarg;
berkeley_tmpdir=argument;
break;
case OPT_BDB_LOCK:
{
int type;
if ((type=find_type(optarg, &berkeley_lock_typelib, 2)) > 0)
if ((type=find_type(argument, &berkeley_lock_typelib, 2)) > 0)
berkeley_lock_type=berkeley_lock_types[type-1];
else
{
if (test_if_int(optarg,(uint) strlen(optarg)))
berkeley_lock_scan_time=atoi(optarg);
if (test_if_int(argument,(uint) strlen(argument)))
berkeley_lock_scan_time=atoi(argument);
else
{
fprintf(stderr,"Unknown lock type: %s\n",optarg);
fprintf(stderr,"Unknown lock type: %s\n",argument);
exit(1);
}
}
......@@ -4220,49 +4370,46 @@ static void get_options(int argc,char **argv)
break;
case OPT_INNODB_DATA_FILE_PATH:
#ifdef HAVE_INNOBASE_DB
innobase_data_file_path=optarg;
innobase_data_file_path=argument;
#endif
break;
#ifdef HAVE_INNOBASE_DB
case OPT_INNODB_DATA_HOME_DIR:
innobase_data_home_dir=optarg;
innobase_data_home_dir=argument;
break;
case OPT_INNODB_LOG_GROUP_HOME_DIR:
innobase_log_group_home_dir=optarg;
innobase_log_group_home_dir=argument;
break;
case OPT_INNODB_LOG_ARCH_DIR:
innobase_log_arch_dir=optarg;
innobase_log_arch_dir=argument;
break;
case OPT_INNODB_LOG_ARCHIVE:
innobase_log_archive= optarg ? test(atoi(optarg)) : 1;
innobase_log_archive= argument ? test(atoi(argument)) : 1;
break;
case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT:
innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1;
innobase_flush_log_at_trx_commit= argument ? test(atoi(argument)) : 1;
break;
case OPT_INNODB_FAST_SHUTDOWN:
innobase_fast_shutdown= optarg ? test(atoi(optarg)) : 1;
innobase_fast_shutdown= argument ? test(atoi(argument)) : 1;
break;
case OPT_INNODB_FLUSH_METHOD:
innobase_unix_file_flush_method=optarg;
innobase_unix_file_flush_method=argument;
break;
#endif /* HAVE_INNOBASE_DB */
case OPT_DO_PSTACK:
opt_do_pstack = 1;
break;
case OPT_MYISAM_RECOVER:
{
if (!optarg || !optarg[0])
if (!argument || !argument[0])
{
myisam_recover_options= HA_RECOVER_DEFAULT;
myisam_recover_options_str= myisam_recover_typelib.type_names[0];
}
else
{
myisam_recover_options_str=optarg;
myisam_recover_options_str=argument;
if ((myisam_recover_options=
find_bit_type(optarg, &myisam_recover_typelib)) == ~(ulong) 0)
find_bit_type(argument, &myisam_recover_typelib)) == ~(ulong) 0)
{
fprintf(stderr, "Unknown option to myisam-recover: %s\n",optarg);
fprintf(stderr, "Unknown option to myisam-recover: %s\n",argument);
exit(1);
}
}
......@@ -4271,11 +4418,11 @@ static void get_options(int argc,char **argv)
}
case OPT_SQL_MODE:
{
sql_mode_str = optarg;
sql_mode_str = argument;
if ((opt_sql_mode =
find_bit_type(optarg, &sql_mode_typelib)) == ~(ulong) 0)
find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0)
{
fprintf(stderr, "Unknown option to sql-mode: %s\n", optarg);
fprintf(stderr, "Unknown option to sql-mode: %s\n", argument);
exit(1);
}
default_tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
......@@ -4284,77 +4431,79 @@ static void get_options(int argc,char **argv)
break;
}
case OPT_MASTER_HOST:
master_host=optarg;
master_host=argument;
break;
case OPT_MASTER_USER:
master_user=optarg;
master_user=argument;
break;
case OPT_MASTER_PASSWORD:
master_password=optarg;
master_password=argument;
break;
case OPT_MASTER_INFO_FILE:
master_info_file=optarg;
master_info_file=argument;
break;
case OPT_RELAY_LOG_INFO_FILE:
relay_log_info_file=optarg;
relay_log_info_file=argument;
break;
case OPT_MASTER_PORT:
master_port= atoi(optarg);
break;
case OPT_MASTER_SSL:
master_ssl=atoi(optarg);
master_port= atoi(argument);
break;
case OPT_MASTER_SSL_KEY:
master_ssl_key=optarg;
master_ssl_key=argument;
break;
case OPT_MASTER_SSL_CERT:
master_ssl_cert=optarg;
master_ssl_cert=argument;
break;
case OPT_REPORT_HOST:
report_host=optarg;
report_host=argument;
break;
case OPT_REPORT_USER:
report_user=optarg;
report_user=argument;
break;
case OPT_REPORT_PASSWORD:
report_password=optarg;
report_password=argument;
break;
case OPT_REPORT_PORT:
report_port= atoi(optarg);
report_port= atoi(argument);
break;
case OPT_MASTER_CONNECT_RETRY:
master_connect_retry= atoi(optarg);
master_connect_retry= atoi(argument);
break;
case OPT_MASTER_RETRY_COUNT:
master_retry_count= atoi(optarg);
break;
case OPT_SAFE_SHOW_DB:
opt_safe_show_db=1;
break;
case OPT_SAFE_USER_CREATE:
opt_safe_user_create=1;
master_retry_count= atoi(argument);
break;
case OPT_SKIP_SAFEMALLOC:
#ifdef SAFEMALLOC
sf_malloc_quick=1;
#endif
break;
default:
fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c);
use_help();
exit(1);
}
}
// Skip empty arguments (from shell)
while (argc != optind && !argv[optind][0])
optind++;
if (argc != optind)
return 0;
}
/* Initiates DEBUG - but no debugging here ! */
static void get_options(int argc,char **argv)
{
int ho_error;
myisam_delay_key_write=1; // Allow use of this
#ifndef HAVE_purify
my_use_symdir=1; // Use internal symbolic links
#else
/* Symlinks gives too many warnings with purify */
my_disable_symlinks=1;
my_use_symdir=0;
have_symlink=SHOW_OPTION_DISABLED;
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
{
fprintf(stderr,"%s: Too many parameters\n",my_progname);
use_help();
printf("%s: handle_options() failed with error %d\n", my_progname,
ho_error);
exit(1);
}
optind = 0; // setup so that getopt_long() can be called again
fix_paths();
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
default_tx_isolation_name=tx_isolation_typelib.type_names[default_tx_isolation];
......
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