1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2021-02-11 09:26:53 +02:00
67 changed files with 403 additions and 226 deletions

View File

@@ -76,7 +76,7 @@ static struct my_option long_options[] =
my_bool my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *value, const char *filename) const char *value, const char *filename)
{ {
return 0; return 0;
} }

View File

@@ -218,7 +218,7 @@ static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool)
/* The names of functions that actually do the manipulation. */ /* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv); static int get_options(int argc,char **argv);
extern "C" my_bool get_one_option(int optid, const struct my_option *opt, extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
char *argument); const char *argument);
static int com_quit(String *str,char*), static int com_quit(String *str,char*),
com_go(String *str,char*), com_ego(String *str,char*), com_go(String *str,char*), com_ego(String *str,char*),
com_print(String *str,char*), com_print(String *str,char*),
@@ -1715,7 +1715,7 @@ static void usage(int version)
my_bool my_bool
get_one_option(const struct my_option *opt, char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
@@ -1816,7 +1816,8 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
status.add_to_history= 0; status.add_to_history= 0;
if (!status.line_buff) if (!status.line_buff)
ignore_errors= 0; // do it for the first -e only ignore_errors= 0; // do it for the first -e only
if (!(status.line_buff= batch_readline_command(status.line_buff, argument))) if (!(status.line_buff= batch_readline_command(status.line_buff,
(char*) argument)))
return 1; return 1;
break; break;
case 'o': case 'o':
@@ -1830,10 +1831,15 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
argument= (char*) ""; // Don't require password argument= (char*) ""; // Don't require password
if (argument) if (argument)
{ {
char *start= argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; // Destroy argument while (*argument)
*(char*)argument++= 'x'; // Destroy argument
if (*start) if (*start)
start[1]=0 ; start[1]=0 ;
tty_password= 0; tty_password= 0;

View File

@@ -475,7 +475,8 @@ static void print_default_values(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {
case 'n': case 'n':

View File

@@ -270,7 +270,7 @@ static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
} }
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
my_bool add_option= TRUE; my_bool add_option= TRUE;
@@ -301,10 +301,17 @@ get_one_option(const struct my_option *opt, char *argument,
add_option= FALSE; add_option= FALSE;
if (argument) if (argument)
{ {
/*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
/* Add password to ds_args before overwriting the arg with x's */ /* Add password to ds_args before overwriting the arg with x's */
add_one_option_cnf_file(&ds_args, opt, argument); add_one_option_cnf_file(&ds_args, opt, argument);
while (*argument) while (*argument)
*argument++= 'x'; /* Destroy argument */ *(char*)argument++= 'x'; /* Destroy argument */
if (*start)
start[1]= 0;
tty_password= 0; tty_password= 0;
} }
else else

View File

@@ -69,7 +69,7 @@ static uint ex_var_count, max_var_length, max_val_length;
static void print_version(void); static void print_version(void);
static void usage(void); static void usage(void);
extern "C" my_bool get_one_option(int optid, const struct my_option *opt, extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
char *argument); const char *argument);
static my_bool sql_connect(MYSQL *mysql, uint wait); static my_bool sql_connect(MYSQL *mysql, uint wait);
static int execute_commands(MYSQL *mysql,int argc, char **argv); static int execute_commands(MYSQL *mysql,int argc, char **argv);
static char **mask_password(int argc, char ***argv); static char **mask_password(int argc, char ***argv);
@@ -241,7 +241,7 @@ static const char *load_default_groups[]=
0 }; 0 };
my_bool my_bool
get_one_option(const struct my_option *opt, char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case 'c': case 'c':
@@ -252,10 +252,15 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
argument= (char*) ""; // Don't require password argument= (char*) ""; // Don't require password
if (argument) if (argument)
{ {
char *start=argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE)); opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; /* Cut length of argument */ start[1]=0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -95,6 +95,8 @@ static uint opt_protocol= 0;
static FILE *result_file; static FILE *result_file;
static char *result_file_name= 0; static char *result_file_name= 0;
static const char *output_prefix= ""; static const char *output_prefix= "";
static char **defaults_argv= 0;
static MEM_ROOT glob_root;
#ifndef DBUG_OFF #ifndef DBUG_OFF
static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace"; static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace";
@@ -1888,18 +1890,32 @@ static void cleanup()
my_free(const_cast<char*>(dirname_for_local_load)); my_free(const_cast<char*>(dirname_for_local_load));
my_free(start_datetime_str); my_free(start_datetime_str);
my_free(stop_datetime_str); my_free(stop_datetime_str);
free_root(&glob_root, MYF(0));
delete binlog_filter; delete binlog_filter;
delete glob_description_event; delete glob_description_event;
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
free_defaults(defaults_argv);
free_annotate_event();
my_free_open_file_info();
load_processor.destroy();
mysql_server_end();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static void die()
{
cleanup();
my_end(MY_DONT_FREE_DBUG);
exit(1);
}
static void print_version() static void print_version()
{ {
printf("%s Ver 3.4 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); printf("%s Ver 3.5 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
} }
@@ -1930,7 +1946,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings) l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings)
{ {
error("Incorrect date and time argument: %s", str); error("Incorrect date and time argument: %s", str);
exit(1); die();
} }
/* /*
Note that Feb 30th, Apr 31st cause no error messages and are mapped to Note that Feb 30th, Apr 31st cause no error messages and are mapped to
@@ -1943,7 +1959,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
extern "C" my_bool extern "C" my_bool
get_one_option(const struct my_option *opt, char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *)
{ {
bool tty_password=0; bool tty_password=0;
switch (opt->id) { switch (opt->id) {
@@ -1967,10 +1983,15 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
argument= (char*) ""; // Don't require password argument= (char*) ""; // Don't require password
if (argument) if (argument)
{ {
/*
One should not really change the argument, but we make an
exception for passwords
*/
my_free(pass); my_free(pass);
char *start=argument; char *start= (char*) argument;
pass= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE)); pass= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*)argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; /* Cut length of argument */ start[1]=0; /* Cut length of argument */
} }
@@ -1988,7 +2009,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
opt->name)) <= 0) opt->name)) <= 0)
{ {
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); die();
} }
break; break;
#ifdef WHEN_FLASHBACK_REVIEW_READY #ifdef WHEN_FLASHBACK_REVIEW_READY
@@ -2013,7 +2034,7 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
opt->name)) <= 0) opt->name)) <= 0)
{ {
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); die();
} }
opt_base64_output_mode= (enum_base64_output_mode) (val - 1); opt_base64_output_mode= (enum_base64_output_mode) (val - 1);
} }
@@ -2021,46 +2042,46 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
case OPT_REWRITE_DB: // db_from->db_to case OPT_REWRITE_DB: // db_from->db_to
{ {
/* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */ /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */
char* ptr; const char* ptr;
char* key= argument; // db-from const char* key= argument; // db-from
char* val; // db-to const char* val; // db-to
// Where key begins // Skipp pre-space in key
while (*key && my_isspace(&my_charset_latin1, *key)) while (*key && my_isspace(&my_charset_latin1, *key))
key++; key++;
// Where val begins // Where val begins
if (!(ptr= strstr(argument, "->"))) if (!(ptr= strstr(key, "->")))
{ {
sql_print_error("Bad syntax in rewrite-db: missing '->'!\n"); sql_print_error("Bad syntax in rewrite-db: missing '->'\n");
return 1; return 1;
} }
val= ptr + 2; val= ptr + 2;
// Skip blanks at the end of key
while (ptr > key && my_isspace(&my_charset_latin1, ptr[-1]))
ptr--;
if (ptr == key)
{
sql_print_error("Bad syntax in rewrite-db: empty FROM db\n");
return 1;
}
key= strmake_root(&glob_root, key, (size_t) (ptr-key));
/* Skipp pre space in value */
while (*val && my_isspace(&my_charset_latin1, *val)) while (*val && my_isspace(&my_charset_latin1, *val))
val++; val++;
// Write \0 and skip blanks at the end of key // Value ends with \0 or space
*ptr-- = 0; for (ptr= val; *ptr && !my_isspace(&my_charset_latin1, *ptr) ; ptr++)
while (my_isspace(&my_charset_latin1, *ptr) && ptr > argument) {}
*ptr-- = 0; if (ptr == val)
if (!*key)
{ {
sql_print_error("Bad syntax in rewrite-db: empty db-from!\n"); sql_print_error("Bad syntax in rewrite-db: empty TO db\n");
return 1;
}
// Skip blanks at the end of val
ptr= val;
while (*ptr && !my_isspace(&my_charset_latin1, *ptr))
ptr++;
*ptr= 0;
if (!*val)
{
sql_print_error("Bad syntax in rewrite-db: empty db-to!\n");
return 1; return 1;
} }
val= strmake_root(&glob_root, val, (size_t) (ptr-val));
binlog_filter->add_db_rewrite(key, val); binlog_filter->add_db_rewrite(key, val);
break; break;
@@ -2098,7 +2119,9 @@ static int parse_args(int *argc, char*** argv)
int ho_error; int ho_error;
if ((ho_error=handle_options(argc, argv, my_options, get_one_option))) if ((ho_error=handle_options(argc, argv, my_options, get_one_option)))
exit(ho_error); {
die();
}
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
else if (debug_check_flag) else if (debug_check_flag)
@@ -3017,7 +3040,6 @@ end:
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
char **defaults_argv;
Exit_status retval= OK_CONTINUE; Exit_status retval= OK_CONTINUE;
ulonglong save_stop_position; ulonglong save_stop_position;
MY_INIT(argv[0]); MY_INIT(argv[0]);
@@ -3030,6 +3052,8 @@ int main(int argc, char** argv)
load_defaults_or_exit("my", load_groups, &argc, &argv); load_defaults_or_exit("my", load_groups, &argc, &argv);
defaults_argv= argv; defaults_argv= argv;
init_alloc_root(PSI_NOT_INSTRUMENTED, &glob_root, 1024, 0, MYF(0));
if (!(binlog_filter= new Rpl_filter)) if (!(binlog_filter= new Rpl_filter))
{ {
error("Failed to create Rpl_filter"); error("Failed to create Rpl_filter");
@@ -3068,7 +3092,7 @@ int main(int argc, char** argv)
if (!remote_opt) if (!remote_opt)
{ {
error("The --raw mode only works with --read-from-remote-server"); error("The --raw mode only works with --read-from-remote-server");
exit(1); die();
} }
if (one_database) if (one_database)
warning("The --database option is ignored in raw mode"); warning("The --database option is ignored in raw mode");
@@ -3090,7 +3114,7 @@ int main(int argc, char** argv)
O_WRONLY | O_BINARY, MYF(MY_WME)))) O_WRONLY | O_BINARY, MYF(MY_WME))))
{ {
error("Could not create log file '%s'", result_file_name); error("Could not create log file '%s'", result_file_name);
exit(1); die();
} }
} }
else else
@@ -3211,11 +3235,6 @@ int main(int argc, char** argv)
if (result_file && result_file != stdout) if (result_file && result_file != stdout)
my_fclose(result_file, MYF(0)); my_fclose(result_file, MYF(0));
cleanup(); cleanup();
free_annotate_event();
free_defaults(defaults_argv);
my_free_open_file_info();
load_processor.destroy();
mysql_server_end();
/* We cannot free DBUG, it is used in global destructors after exit(). */ /* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(my_end_arg | MY_DONT_FREE_DBUG); my_end(my_end_arg | MY_DONT_FREE_DBUG);
@@ -3225,7 +3244,6 @@ int main(int argc, char** argv)
err: err:
cleanup(); cleanup();
free_defaults(defaults_argv);
my_end(my_end_arg); my_end(my_end_arg);
exit(retval == ERROR_STOP ? 1 : 0); exit(retval == ERROR_STOP ? 1 : 0);
DBUG_RETURN(retval == ERROR_STOP ? 1 : 0); DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);

View File

@@ -285,7 +285,8 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
int orig_what_to_do= what_to_do; int orig_what_to_do= what_to_do;
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
@@ -324,10 +325,15 @@ get_one_option(const struct my_option *opt,
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
if (argument) if (argument)
{ {
char *start = argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password = my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_password = my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1] = 0; /* Cut length of argument */ start[1] = 0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -144,9 +144,9 @@ static char *opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *order_by=0, *where=0, *order_by=0,
*opt_compatible_mode_str= 0,
*err_ptr= 0, *err_ptr= 0,
*log_error_file= NULL; *log_error_file= NULL;
static const char *opt_compatible_mode_str= 0;
static char **defaults_argv= 0; static char **defaults_argv= 0;
static char compatible_mode_normal_str[255]; static char compatible_mode_normal_str[255];
/* Server supports character_set_results session variable? */ /* Server supports character_set_results session variable? */
@@ -279,7 +279,7 @@ static struct my_option my_long_options[] =
"no_table_options, no_field_options. One can use several modes separated " "no_table_options, no_field_options. One can use several modes separated "
"by commas. Note: Requires MariaDB server version 4.1.0 or higher. " "by commas. Note: Requires MariaDB server version 4.1.0 or higher. "
"This option is ignored with earlier server versions.", "This option is ignored with earlier server versions.",
&opt_compatible_mode_str, &opt_compatible_mode_str, 0, (char**) &opt_compatible_mode_str, (char**) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT, {"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure " "Give less verbose output (useful for debugging). Disables structure "
@@ -849,7 +849,8 @@ uchar* get_table_key(const char *entry, size_t *length,
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
case 'p': case 'p':
@@ -857,10 +858,15 @@ get_one_option(const struct my_option *opt,
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
if (argument) if (argument)
{ {
char *start=argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; /* Cut length of argument */ start[1]=0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -221,7 +221,7 @@ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n");
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {
@@ -230,10 +230,15 @@ get_one_option(const struct my_option *opt, char *argument,
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
if (argument) if (argument)
{ {
char *start=argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE)); opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; /* Cut length of argument */ start[1]=0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -289,7 +289,7 @@ are shown.");
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {
@@ -301,10 +301,15 @@ get_one_option(const struct my_option *opt, char *argument,
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
if (argument) if (argument)
{ {
char *start=argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_password=my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; /* Cut length of argument */ start[1]=0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -726,7 +726,7 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
@@ -739,10 +739,15 @@ get_one_option(const struct my_option *opt, char *argument,
argument= (char*) ""; /* Don't require password */ argument= (char*) ""; /* Don't require password */
if (argument) if (argument)
{ {
char *start= argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE)); opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]= 0; /* Cut length of argument */ start[1]= 0; /* Cut length of argument */
tty_password= 0; tty_password= 0;

View File

@@ -96,7 +96,8 @@ static int setenv(const char *name, const char *value, int overwrite);
C_MODE_START C_MODE_START
static sig_handler signal_handler(int sig); static sig_handler signal_handler(int sig);
static my_bool get_one_option(const struct my_option *, char *, const char *); static my_bool get_one_option(const struct my_option *, const char *,
const char *);
C_MODE_END C_MODE_END
enum { enum {
@@ -7138,7 +7139,7 @@ void read_embedded_server_arguments(const char *name)
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case '#': case '#':
@@ -7186,9 +7187,14 @@ get_one_option(const struct my_option *opt, char *argument, const char *)
argument= const_cast<char*>(""); // Don't require password argument= const_cast<char*>(""); // Don't require password
if (argument) if (argument)
{ {
/*
One should not really change the argument, but we make an
exception for passwords
*/
my_free(opt_pass); my_free(opt_pass);
opt_pass= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_pass= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*)argument++= 'x'; /* Destroy argument */
tty_password= 0; tty_password= 0;
} }
else else

View File

@@ -1140,7 +1140,7 @@ static void print_version(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__ ((unused)), const char *argument __attribute__ ((unused)),
const char *filename __attribute__ ((unused))) const char *filename __attribute__ ((unused)))
{ {
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");

View File

@@ -1332,7 +1332,7 @@ static void usage(void)
extern "C" my_bool extern "C" my_bool
innochecksum_get_one_option( innochecksum_get_one_option(
const struct my_option *opt, const struct my_option *opt,
char *argument MY_ATTRIBUTE((unused)), const char *argument MY_ATTRIBUTE((unused)),
const char *) const char *)
{ {
switch (opt->id) { switch (opt->id) {

View File

@@ -88,7 +88,7 @@ char *opt_ibx_incremental_history_name = NULL;
char *opt_ibx_incremental_history_uuid = NULL; char *opt_ibx_incremental_history_uuid = NULL;
char *opt_ibx_user = NULL; char *opt_ibx_user = NULL;
char *opt_ibx_password = NULL; const char *opt_ibx_password = NULL;
char *opt_ibx_host = NULL; char *opt_ibx_host = NULL;
char *opt_ibx_defaults_group = NULL; char *opt_ibx_defaults_group = NULL;
char *opt_ibx_socket = NULL; char *opt_ibx_socket = NULL;
@@ -731,7 +731,7 @@ indicates an error.\n");
static static
my_bool my_bool
ibx_get_one_option(const struct my_option *opt, ibx_get_one_option(const struct my_option *opt,
char *argument, const char *) const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case '?': case '?':

View File

@@ -90,7 +90,7 @@ static int get_options(int *argc, char ***argv);
static int mode_create(int argc, char **argv); static int mode_create(int argc, char **argv);
static int mode_extract(int n_threads, int argc, char **argv); static int mode_extract(int n_threads, int argc, char **argv);
static my_bool get_one_option(const struct my_option *opt, static my_bool get_one_option(const struct my_option *opt,
char *argument, const char *filename); const char *argument, const char *filename);
int int
main(int argc, char **argv) main(int argc, char **argv)
@@ -138,7 +138,8 @@ get_options(int *argc, char ***argv)
int ho_error; int ho_error;
if ((ho_error= handle_options(argc, argv, my_long_options, if ((ho_error= handle_options(argc, argv, my_long_options,
get_one_option))) { get_one_option)))
{
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@@ -191,7 +192,7 @@ set_run_mode(run_mode_t mode)
static static
my_bool my_bool
get_one_option(const struct my_option *opt, char *, const char *) get_one_option(const struct my_option *opt, const char *, const char *)
{ {
switch (opt->id) { switch (opt->id) {
case 'c': case 'c':

View File

@@ -310,7 +310,7 @@ char *opt_incremental_history_name;
char *opt_incremental_history_uuid; char *opt_incremental_history_uuid;
char *opt_user; char *opt_user;
char *opt_password; const char *opt_password;
char *opt_host; char *opt_host;
char *opt_defaults_group; char *opt_defaults_group;
char *opt_socket; char *opt_socket;
@@ -1846,7 +1846,7 @@ check_if_param_set(const char *param)
my_bool my_bool
xb_get_one_option(const struct my_option *opt, xb_get_one_option(const struct my_option *opt,
char *argument, const char *) const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case 'h': case 'h':
@@ -6323,9 +6323,10 @@ void handle_options(int argc, char **argv, char ***argv_server,
if (opt_password) if (opt_password)
{ {
char *argument= opt_password; char *argument= (char*) opt_password;
char *start= argument; char *start= (char*) opt_password;
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, opt_password, MYF(MY_FAE)); opt_password= my_strdup(PSI_NOT_INSTRUMENTED, opt_password,
MYF(MY_FAE));
while (*argument) while (*argument)
*argument++= 'x'; // Destroy argument *argument++= 'x'; // Destroy argument
if (*start) if (*start)

View File

@@ -144,7 +144,7 @@ extern char *opt_incremental_history_name;
extern char *opt_incremental_history_uuid; extern char *opt_incremental_history_uuid;
extern char *opt_user; extern char *opt_user;
extern char *opt_password; extern const char *opt_password;
extern char *opt_host; extern char *opt_host;
extern char *opt_defaults_group; extern char *opt_defaults_group;
extern char *opt_socket; extern char *opt_socket;

View File

@@ -105,7 +105,7 @@ static void usage()
static my_bool static my_bool
get_one_option(const struct my_option *opt __attribute__((unused)), get_one_option(const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename) const char *filename)
{ {
switch (opt->id) { switch (opt->id) {

View File

@@ -45,7 +45,7 @@ static struct my_option my_long_options[] =
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -97,7 +97,7 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {

View File

@@ -112,7 +112,7 @@ void local_exit(int error)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -72,7 +72,7 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {

View File

@@ -89,7 +89,7 @@ struct my_option
void *app_type; /**< To be used by an application */ void *app_type; /**< To be used by an application */
}; };
typedef my_bool (*my_get_one_option)(const struct my_option *, char *, const char *); typedef my_bool (*my_get_one_option)(const struct my_option *, const char *, const char *);
/** /**
Used to retrieve a reference to the object (variable) that holds the value Used to retrieve a reference to the object (variable) that holds the value

View File

@@ -270,7 +270,8 @@ typedef struct st_typelib {
const char **type_names; const char **type_names;
unsigned int *type_lengths; unsigned int *type_lengths;
} TYPELIB; } TYPELIB;
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib,
int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib, extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option); const char *option);
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);

View File

@@ -313,6 +313,12 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
const type def_val; \ const type def_val; \
} MYSQL_SYSVAR_NAME(name) } MYSQL_SYSVAR_NAME(name)
#define DECLARE_MYSQL_SYSVAR_CONST_BASIC(name, type) struct { \
MYSQL_PLUGIN_VAR_HEADER; \
const type *value; \
const type def_val; \
} MYSQL_SYSVAR_NAME(name)
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ #define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
MYSQL_PLUGIN_VAR_HEADER; \ MYSQL_PLUGIN_VAR_HEADER; \
type *value; type def_val; \ type *value; type def_val; \
@@ -367,6 +373,11 @@ DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def} #name, comment, check, update, &varname, def}
#define MYSQL_SYSVAR_CONST_STR(name, varname, opt, comment, check, update, def) \
DECLARE_MYSQL_SYSVAR_CONST_BASIC(name, char *) = { \
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def}
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ #define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \

View File

@@ -27,7 +27,8 @@ typedef struct st_typelib { /* Different types saved here */
unsigned int *type_lengths; unsigned int *type_lengths;
} TYPELIB; } TYPELIB;
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib,
int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib, extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option); const char *option);
#define FIND_TYPE_BASIC 0 #define FIND_TYPE_BASIC 0

View File

@@ -623,6 +623,7 @@ References Databases,Tables To have references on tables
Reload Server Admin To reload or refresh tables, logs and privileges Reload Server Admin To reload or refresh tables, logs and privileges
Binlog admin Server To purge binary logs Binlog admin Server To purge binary logs
Binlog monitor Server To use SHOW BINLOG STATUS and SHOW BINARY LOG Binlog monitor Server To use SHOW BINLOG STATUS and SHOW BINARY LOG
Binlog replay Server To use BINLOG (generated by mariadb-binlog)
Replication master admin Server To monitor connected slaves Replication master admin Server To monitor connected slaves
Replication slave admin Server To start/stop slave and apply binlog events Replication slave admin Server To start/stop slave and apply binlog events
Slave monitor Server To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS Slave monitor Server To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS

View File

@@ -1257,3 +1257,21 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
mysqlbinlog Ver VER for OS at ARCH mysqlbinlog Ver VER for OS at ARCH
#
# Test --rewrite-db
#
RESET MASTER;
CREATE TABLE t1 (a int);
INSERT INTO t1 values(1);
DROP TABLE t1;
FLUSH LOGS;
ERROR: Bad syntax in rewrite-db: missing '->'
ERROR: Bad syntax in rewrite-db: empty TO db
ERROR: Bad syntax in rewrite-db: empty TO db
ERROR: Bad syntax in rewrite-db: empty FROM db
ERROR: Bad syntax in rewrite-db: empty FROM db

View File

@@ -130,6 +130,7 @@ select "--- reading stdin --" as "";
# postion is constant to correspond to an event in pre-recorded binlog # postion is constant to correspond to an event in pre-recorded binlog
--let $binlog_start_pos=79 --let $binlog_start_pos=79
--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 --exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
drop table t1,t2; drop table t1,t2;
# #
@@ -595,3 +596,30 @@ eval SET GLOBAL SERVER_ID = $old_server_id;
# #
replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/; replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/;
exec $MYSQL_BINLOG --version; exec $MYSQL_BINLOG --version;
--echo #
--echo # Test --rewrite-db
--echo #
RESET MASTER;
CREATE TABLE t1 (a int);
INSERT INTO t1 values(1);
DROP TABLE t1;
FLUSH LOGS;
--error 1
--exec $MYSQL_BINLOG --rewrite-db=a --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--error 1
--exec $MYSQL_BINLOG --rewrite-db="a->" --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--error 1
--exec $MYSQL_BINLOG --rewrite-db="a-> " --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--error 1
--exec $MYSQL_BINLOG --rewrite-db="->b" --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--error 1
--exec $MYSQL_BINLOG --rewrite-db=" ->" --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--exec $MYSQL_BINLOG --rewrite-db=" test -> foo " --short-form $MYSQLD_DATADIR/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn

View File

@@ -81,6 +81,8 @@ show create table t2;
connection master; connection master;
drop table t2; drop table t2;
sync_slave_with_master;
connection master;
--echo # --echo #
--echo # Test RENAME --echo # Test RENAME

View File

@@ -105,6 +105,8 @@ t2 CREATE TABLE `t2` (
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
connection master; connection master;
drop table t2; drop table t2;
connection slave;
connection master;
# #
# Test RENAME # Test RENAME
# #

View File

@@ -13,10 +13,14 @@ PARTITION BY HASH (c1)
PARTITIONS 3; PARTITIONS 3;
INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202); INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
ALTER TABLE t1 ENGINE=S3; ALTER TABLE t1 ENGINE=S3;
connection slave;
connection master;
ALTER TABLE t1 ADD PARTITION PARTITIONS 6; ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
select sum(c1) from t1; select sum(c1) from t1;
sum(c1) sum(c1)
609 609
connection slave;
connection master;
ALTER TABLE t1 ADD COLUMN c INT; ALTER TABLE t1 ADD COLUMN c INT;
select sum(c1) from t1; select sum(c1) from t1;
sum(c1) sum(c1)
@@ -108,6 +112,8 @@ select sum(c1) from t1;
ERROR 42S02: Table 'database.t1' doesn't exist ERROR 42S02: Table 'database.t1' doesn't exist
start slave; start slave;
connection master; connection master;
connection slave;
connection master;
# #
# Check altering partitioned table to S3 and back # Check altering partitioned table to S3 and back
# Checks also rename partitoned table and drop partition # Checks also rename partitoned table and drop partition

View File

@@ -29,8 +29,12 @@ CREATE TABLE t1 (
PARTITIONS 3; PARTITIONS 3;
INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202); INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
ALTER TABLE t1 ENGINE=S3; ALTER TABLE t1 ENGINE=S3;
sync_slave_with_master;
connection master;
ALTER TABLE t1 ADD PARTITION PARTITIONS 6; ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
select sum(c1) from t1; select sum(c1) from t1;
sync_slave_with_master;
connection master;
ALTER TABLE t1 ADD COLUMN c INT; ALTER TABLE t1 ADD COLUMN c INT;
select sum(c1) from t1; select sum(c1) from t1;
sync_slave_with_master; sync_slave_with_master;
@@ -85,6 +89,8 @@ select sum(c1) from t1;
--file_exists $MYSQLD_DATADIR/$database/t1.par --file_exists $MYSQLD_DATADIR/$database/t1.par
start slave; start slave;
connection master; connection master;
sync_slave_with_master;
connection master;
--echo # --echo #
--echo # Check altering partitioned table to S3 and back --echo # Check altering partitioned table to S3 and back

View File

@@ -105,6 +105,8 @@ t2 CREATE TABLE `t2` (
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
connection master; connection master;
drop table t2; drop table t2;
connection slave;
connection master;
# #
# Test RENAME # Test RENAME
# #

View File

@@ -25,12 +25,12 @@ else
{ {
if (!$ENV{'S3_HOST_NAME'}) if (!$ENV{'S3_HOST_NAME'})
{ {
return "Environment variable S3_HOST_NAME need to be set"; $ENV{'S3_HOST_NAME'} = "s3.amazonaws.com";
} }
if (!$ENV{'S3_BUCKET'}) if (!$ENV{'S3_BUCKET'})
{ {
return "Environment variable S3_BUCKET need to be set"; $ENV{'S3_BUCKET'} = "MariaDB";
} }
if (!$ENV{'S3_REGION'}) if (!$ENV{'S3_REGION'})

View File

@@ -182,11 +182,11 @@ const char *get_type(TYPELIB *typelib, uint nr)
a integer representation of the supplied string a integer representation of the supplied string
*/ */
my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err) my_ulonglong find_typeset(const char *x, TYPELIB *lib, int *err)
{ {
my_ulonglong result; my_ulonglong result;
int find; int find;
char *i; const char *i;
DBUG_ENTER("find_set"); DBUG_ENTER("find_set");
DBUG_PRINT("enter",("x: '%s' lib: %p", x, lib)); DBUG_PRINT("enter",("x: '%s' lib: %p", x, lib));

View File

@@ -103,7 +103,7 @@ static struct my_option my_long_options[]=
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *, const char *) get_one_option(const struct my_option *opt, const char *, const char *)
{ {
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch (opt->id) { switch (opt->id) {

View File

@@ -78,7 +78,7 @@ static struct my_option my_long_options[]=
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *, const char *) get_one_option(const struct my_option *opt, const char *, const char *)
{ {
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch (opt->id) { switch (opt->id) {

View File

@@ -332,7 +332,7 @@ static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_short_log_format= 0, opt_silent_startup= 0; static my_bool opt_short_log_format= 0, opt_silent_startup= 0;
ulong max_used_connections; ulong max_used_connections;
static char *mysqld_user, *mysqld_chroot; static const char *mysqld_user, *mysqld_chroot;
static char *default_character_set_name; static char *default_character_set_name;
static char *character_set_filesystem_name; static char *character_set_filesystem_name;
static char *lc_messages; static char *lc_messages;
@@ -375,6 +375,8 @@ uint volatile global_disable_checkpoint;
#if defined(_WIN32) #if defined(_WIN32)
ulong slow_start_timeout; ulong slow_start_timeout;
#endif #endif
static MEM_ROOT startup_root;
/** /**
@brief 'grant_option' is used to indicate if privileges needs @brief 'grant_option' is used to indicate if privileges needs
to be checked, in which case the lock, LOCK_grant, is used to be checked, in which case the lock, LOCK_grant, is used
@@ -1476,7 +1478,8 @@ static int mysql_init_variables(void);
static int get_options(int *argc_ptr, char ***argv_ptr); static int get_options(int *argc_ptr, char ***argv_ptr);
static bool add_terminator(DYNAMIC_ARRAY *options); static bool add_terminator(DYNAMIC_ARRAY *options);
static bool add_many_options(DYNAMIC_ARRAY *, my_option *, size_t); static bool add_many_options(DYNAMIC_ARRAY *, my_option *, size_t);
extern "C" my_bool mysqld_get_one_option(const struct my_option *, char *, const char *); extern "C" my_bool mysqld_get_one_option(const struct my_option *, const char *,
const char *);
static int init_thread_environment(); static int init_thread_environment();
static char *get_relative_path(const char *path); static char *get_relative_path(const char *path);
static int fix_paths(void); static int fix_paths(void);
@@ -2028,6 +2031,7 @@ static void clean_up(bool print_message)
thread_scheduler= 0; thread_scheduler= 0;
mysql_library_end(); mysql_library_end();
finish_client_errs(); finish_client_errs();
free_root(&startup_root, MYF(0));
cleanup_errmsgs(); cleanup_errmsgs();
free_error_messages(); free_error_messages();
/* Tell main we are ready */ /* Tell main we are ready */
@@ -3628,6 +3632,7 @@ static int init_early_variables()
set_current_thd(0); set_current_thd(0);
set_malloc_size_cb(my_malloc_size_cb_func); set_malloc_size_cb(my_malloc_size_cb_func);
global_status_var.global_memory_used= 0; global_status_var.global_memory_used= 0;
init_alloc_root(PSI_NOT_INSTRUMENTED, &startup_root, 1024, 0, MYF(0));
return 0; return 0;
} }
@@ -7674,7 +7679,7 @@ static int mysql_init_variables(void)
} }
my_bool my_bool
mysqld_get_one_option(const struct my_option *opt, char *argument, mysqld_get_one_option(const struct my_option *opt, const char *argument,
const char *filename) const char *filename)
{ {
if (opt->app_type) if (opt->app_type)
@@ -7851,31 +7856,43 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
case (int)OPT_REPLICATE_REWRITE_DB: case (int)OPT_REPLICATE_REWRITE_DB:
{ {
/* See also OPT_REWRITE_DB handling in client/mysqlbinlog.cc */ /* See also OPT_REWRITE_DB handling in client/mysqlbinlog.cc */
char* key = argument,*p, *val; const char* key= argument, *ptr, *val;
if (!(p= strstr(argument, "->"))) // Skipp pre-space in key
while (*key && my_isspace(mysqld_charset, *key))
key++;
// Where val begins
if (!(ptr= strstr(key, "->")))
{ {
sql_print_error("Bad syntax in replicate-rewrite-db - missing '->'!"); sql_print_error("Bad syntax in replicate-rewrite-db: missing '->'");
return 1; return 1;
} }
val= p--; val= ptr+2;
while (my_isspace(mysqld_charset, *p) && p > argument)
*p-- = 0; // Skip blanks at the end of key
/* Db name can be one char also */ while (ptr > key && my_isspace(mysqld_charset, ptr[-1]))
if (p == argument && my_isspace(mysqld_charset, *p)) ptr--;
if (ptr == key)
{ {
sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db!"); sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db");
return 1; return 1;
} }
*val= 0; key= strmake_root(&startup_root, key, (size_t) (ptr-key));
val+= 2;
/* Skipp pre space in value */
while (*val && my_isspace(mysqld_charset, *val)) while (*val && my_isspace(mysqld_charset, *val))
val++; val++;
if (!*val)
// Value ends with \0 or space
for (ptr= val; *ptr && !my_isspace(&my_charset_latin1, *ptr) ; ptr++)
{}
if (ptr == val)
{ {
sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!"); sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db");
return 1; return 1;
} }
val= strmake_root(&startup_root, val, (size_t) (ptr-val));
cur_rpl_filter->add_db_rewrite(key, val); cur_rpl_filter->add_db_rewrite(key, val);
break; break;
@@ -7902,7 +7919,7 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
{ {
if (cur_rpl_filter->add_do_table(argument)) if (cur_rpl_filter->add_do_table(argument))
{ {
sql_print_error("Could not add do table rule '%s'!", argument); sql_print_error("Could not add do table rule '%s'", argument);
return 1; return 1;
} }
break; break;
@@ -7911,7 +7928,7 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
{ {
if (cur_rpl_filter->add_wild_do_table(argument)) if (cur_rpl_filter->add_wild_do_table(argument))
{ {
sql_print_error("Could not add do table rule '%s'!", argument); sql_print_error("Could not add do table rule '%s'", argument);
return 1; return 1;
} }
break; break;
@@ -7920,7 +7937,7 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
{ {
if (cur_rpl_filter->add_wild_ignore_table(argument)) if (cur_rpl_filter->add_wild_ignore_table(argument))
{ {
sql_print_error("Could not add ignore table rule '%s'!", argument); sql_print_error("Could not add ignore table rule '%s'", argument);
return 1; return 1;
} }
break; break;
@@ -7929,7 +7946,7 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
{ {
if (cur_rpl_filter->add_ignore_table(argument)) if (cur_rpl_filter->add_ignore_table(argument))
{ {
sql_print_error("Could not add ignore table rule '%s'!", argument); sql_print_error("Could not add ignore table rule '%s'", argument);
return 1; return 1;
} }
break; break;
@@ -8040,10 +8057,14 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
/* Parse instrument name and value from argument string */ /* Parse instrument name and value from argument string */
char* name = argument,*p, *val; const char *name= argument, *ptr, *val;
/* Trim leading spaces from instrument name */
while (*name && my_isspace(mysqld_charset, *name))
name++;
/* Assignment required */ /* Assignment required */
if (!(p= strchr(argument, '='))) if (!(ptr= strchr(name, '=')))
{ {
my_getopt_error_reporter(WARNING_LEVEL, my_getopt_error_reporter(WARNING_LEVEL,
"Missing value for performance_schema_instrument " "Missing value for performance_schema_instrument "
@@ -8052,54 +8073,43 @@ mysqld_get_one_option(const struct my_option *opt, char *argument,
} }
/* Option value */ /* Option value */
val= p + 1; val= ptr + 1;
if (!*val)
{
my_getopt_error_reporter(WARNING_LEVEL,
"Missing value for performance_schema_instrument "
"'%s'", argument);
return 0;
}
/* Trim leading spaces from instrument name */
while (*name && my_isspace(mysqld_charset, *name))
name++;
/* Trim trailing spaces and slashes from instrument name */ /* Trim trailing spaces and slashes from instrument name */
while (p > argument && (my_isspace(mysqld_charset, p[-1]) || p[-1] == '/')) while (ptr > name && (my_isspace(mysqld_charset, ptr[-1]) ||
p--; ptr[-1] == '/'))
*p= 0; ptr--;
if (ptr == name)
if (!*name)
{ {
my_getopt_error_reporter(WARNING_LEVEL, my_getopt_error_reporter(WARNING_LEVEL,
"Invalid instrument name for " "Invalid instrument name for "
"performance_schema_instrument '%s'", argument); "performance_schema_instrument '%s'", name);
return 0; return 0;
} }
name= strmake_root(&startup_root, name, (size_t) (ptr - name));
/* Trim leading spaces from option value */ /* Trim leading spaces from option value */
while (*val && my_isspace(mysqld_charset, *val)) while (*val && my_isspace(mysqld_charset, *val))
val++; val++;
/* Trim trailing spaces from option value */ /* Find end of value */
if ((p= my_strchr(mysqld_charset, val, val+strlen(val), ' ')) != NULL) for (ptr= val; *ptr && !my_isspace(mysqld_charset, *ptr) ; ptr++)
*p= 0; {}
if (ptr == val)
if (!*val)
{ {
my_getopt_error_reporter(WARNING_LEVEL, my_getopt_error_reporter(WARNING_LEVEL,
"Invalid value for performance_schema_instrument " "No value for performance_schema_instrument "
"'%s'", argument); "'%s'", name);
return 0; return 0;
} }
val= strmake_root(&startup_root, val, (size_t) (ptr - val));
/* Add instrument name and value to array of configuration options */ /* Add instrument name and value to array of configuration options */
if (add_pfs_instr_to_array(name, val)) if (add_pfs_instr_to_array(name, val))
{ {
my_getopt_error_reporter(WARNING_LEVEL, my_getopt_error_reporter(WARNING_LEVEL,
"Invalid value for performance_schema_instrument " "Invalid value for performance_schema_instrument "
"'%s'", argument); "'%s'", name);
return 0; return 0;
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
@@ -8266,7 +8276,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
/* Skip unknown options so that they may be processed later by plugins */ /* Skip unknown options so that they may be processed later by plugins */
my_getopt_skip_unknown= TRUE; my_getopt_skip_unknown= TRUE;
if ((ho_error= handle_options(argc_ptr, argv_ptr, (my_option*)(all_options.buffer), if ((ho_error= handle_options(argc_ptr, argv_ptr,
(my_option*) (all_options.buffer),
mysqld_get_one_option))) mysqld_get_one_option)))
return ho_error; return ho_error;

View File

@@ -7174,23 +7174,24 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
4) Close the table that have already been opened but didn't stumble on 4) Close the table that have already been opened but didn't stumble on
the abort locked previously. This is done as part of the the abort locked previously. This is done as part of the
alter_close_table call. alter_close_table call.
5) Write the bin log 5) Old place for binary logging
Unfortunately the writing of the binlog is not synchronised with
other logging activities. So no matter in which order the binlog
is written compared to other activities there will always be cases
where crashes make strange things occur. In this placement it can
happen that the ALTER TABLE DROP PARTITION gets performed in the
master but not in the slaves if we have a crash, after writing the
ddl log but before writing the binlog. A solution to this would
require writing the statement first in the ddl log and then
when recovering from the crash read the binlog and insert it into
the binlog if not written already.
6) Install the previously written shadow frm file 6) Install the previously written shadow frm file
7) Prepare handlers for drop of partitions 7) Prepare handlers for drop of partitions
8) Drop the partitions 8) Drop the partitions
9) Remove entries from ddl log 9) Remove entries from ddl log
10) Reopen table if under lock tables 10) Reopen table if under lock tables
11) Complete query 11) Write the bin log
Unfortunately the writing of the binlog is not synchronised with
other logging activities. So no matter in which order the binlog
is written compared to other activities there will always be cases
where crashes make strange things occur. In this placement it can
happen that the ALTER TABLE DROP PARTITION gets performed in the
master but not in the slaves if we have a crash, after writing the
ddl log but before writing the binlog. A solution to this would
require writing the statement first in the ddl log and then
when recovering from the crash read the binlog and insert it into
the binlog if not written already.
12) Complete query
We insert Error injections at all places where it could be interesting We insert Error injections at all places where it could be interesting
to test if recovery is properly done. to test if recovery is properly done.
@@ -7211,9 +7212,6 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
alter_close_table(lpt) || alter_close_table(lpt) ||
ERROR_INJECT_CRASH("crash_drop_partition_5") || ERROR_INJECT_CRASH("crash_drop_partition_5") ||
ERROR_INJECT_ERROR("fail_drop_partition_5") || ERROR_INJECT_ERROR("fail_drop_partition_5") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_drop_partition_6") || ERROR_INJECT_CRASH("crash_drop_partition_6") ||
ERROR_INJECT_ERROR("fail_drop_partition_6") || ERROR_INJECT_ERROR("fail_drop_partition_6") ||
(frm_install= TRUE, FALSE) || (frm_install= TRUE, FALSE) ||
@@ -7225,6 +7223,9 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT_CRASH("crash_drop_partition_8") || ERROR_INJECT_CRASH("crash_drop_partition_8") ||
ERROR_INJECT_ERROR("fail_drop_partition_8") || ERROR_INJECT_ERROR("fail_drop_partition_8") ||
(write_log_completed(lpt, FALSE), FALSE) || (write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_drop_partition_9") || ERROR_INJECT_CRASH("crash_drop_partition_9") ||
ERROR_INJECT_ERROR("fail_drop_partition_9")) ERROR_INJECT_ERROR("fail_drop_partition_9"))
{ {
@@ -7257,7 +7258,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
3) Write an entry to remove the new parttions if crash occurs 3) Write an entry to remove the new parttions if crash occurs
4) Add the new partitions. 4) Add the new partitions.
5) Close all instances of the table and remove them from the table cache. 5) Close all instances of the table and remove them from the table cache.
6) Write binlog 6) Old place for write binlog
7) Now the change is completed except for the installation of the 7) Now the change is completed except for the installation of the
new frm file. We thus write an action in the log to change to new frm file. We thus write an action in the log to change to
the shadow frm file the shadow frm file
@@ -7265,7 +7266,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
added to the table. added to the table.
9) Remove entries from ddl log 9) Remove entries from ddl log
10)Reopen tables if under lock tables 10)Reopen tables if under lock tables
11)Complete query 11)Write to binlog
12)Complete query
*/ */
if (write_log_drop_shadow_frm(lpt) || if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_1") || ERROR_INJECT_CRASH("crash_add_partition_1") ||
@@ -7285,9 +7287,6 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
alter_close_table(lpt) || alter_close_table(lpt) ||
ERROR_INJECT_CRASH("crash_add_partition_6") || ERROR_INJECT_CRASH("crash_add_partition_6") ||
ERROR_INJECT_ERROR("fail_add_partition_6") || ERROR_INJECT_ERROR("fail_add_partition_6") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_add_partition_7") || ERROR_INJECT_CRASH("crash_add_partition_7") ||
ERROR_INJECT_ERROR("fail_add_partition_7") || ERROR_INJECT_ERROR("fail_add_partition_7") ||
write_log_rename_frm(lpt) || write_log_rename_frm(lpt) ||
@@ -7300,6 +7299,9 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT_CRASH("crash_add_partition_9") || ERROR_INJECT_CRASH("crash_add_partition_9") ||
ERROR_INJECT_ERROR("fail_add_partition_9") || ERROR_INJECT_ERROR("fail_add_partition_9") ||
(write_log_completed(lpt, FALSE), FALSE) || (write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_add_partition_10") || ERROR_INJECT_CRASH("crash_add_partition_10") ||
ERROR_INJECT_ERROR("fail_add_partition_10")) ERROR_INJECT_ERROR("fail_add_partition_10"))
{ {
@@ -7356,13 +7358,14 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
5) Close the table. 5) Close the table.
6) Log that operation is completed and log all complete actions 6) Log that operation is completed and log all complete actions
needed to complete operation from here. needed to complete operation from here.
7) Write bin log. 7) Old place for write bin log.
8) Prepare handlers for rename and delete of partitions. 8) Prepare handlers for rename and delete of partitions.
9) Rename and drop the reorged partitions such that they are no 9) Rename and drop the reorged partitions such that they are no
longer used and rename those added to their real new names. longer used and rename those added to their real new names.
10) Install the shadow frm file. 10) Install the shadow frm file.
11) Reopen the table if under lock tables. 11) Reopen the table if under lock tables.
12) Complete query. 12) Write to binlog
13) Complete query.
*/ */
if (write_log_drop_shadow_frm(lpt) || if (write_log_drop_shadow_frm(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_1") || ERROR_INJECT_CRASH("crash_change_partition_1") ||
@@ -7386,9 +7389,6 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
(action_completed= TRUE, FALSE) || (action_completed= TRUE, FALSE) ||
ERROR_INJECT_CRASH("crash_change_partition_7") || ERROR_INJECT_CRASH("crash_change_partition_7") ||
ERROR_INJECT_ERROR("fail_change_partition_7") || ERROR_INJECT_ERROR("fail_change_partition_7") ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_change_partition_8") || ERROR_INJECT_CRASH("crash_change_partition_8") ||
ERROR_INJECT_ERROR("fail_change_partition_8") || ERROR_INJECT_ERROR("fail_change_partition_8") ||
((frm_install= TRUE), FALSE) || ((frm_install= TRUE), FALSE) ||
@@ -7403,6 +7403,9 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT_CRASH("crash_change_partition_11") || ERROR_INJECT_CRASH("crash_change_partition_11") ||
ERROR_INJECT_ERROR("fail_change_partition_11") || ERROR_INJECT_ERROR("fail_change_partition_11") ||
(write_log_completed(lpt, FALSE), FALSE) || (write_log_completed(lpt, FALSE), FALSE) ||
((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE,
thd->query(), thd->query_length()), FALSE)) ||
ERROR_INJECT_CRASH("crash_change_partition_12") || ERROR_INJECT_CRASH("crash_change_partition_12") ||
ERROR_INJECT_ERROR("fail_change_partition_12")) ERROR_INJECT_ERROR("fail_change_partition_12"))
{ {

View File

@@ -4043,8 +4043,10 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
DBUG_RETURN(opts); DBUG_RETURN(opts);
} }
extern "C" my_bool mark_changed(const struct my_option *, char *, const char *); extern "C" my_bool mark_changed(const struct my_option *, const char *,
my_bool mark_changed(const struct my_option *opt, char *, const char *filename) const char *);
my_bool mark_changed(const struct my_option *opt, const char *,
const char *filename)
{ {
if (opt->app_type) if (opt->app_type)
{ {

View File

@@ -483,6 +483,7 @@ static struct show_privileges_st sys_privileges[]=
{"Reload", "Server Admin", "To reload or refresh tables, logs and privileges"}, {"Reload", "Server Admin", "To reload or refresh tables, logs and privileges"},
{"Binlog admin", "Server", "To purge binary logs"}, {"Binlog admin", "Server", "To purge binary logs"},
{"Binlog monitor", "Server", "To use SHOW BINLOG STATUS and SHOW BINARY LOG"}, {"Binlog monitor", "Server", "To use SHOW BINLOG STATUS and SHOW BINARY LOG"},
{"Binlog replay", "Server", "To use BINLOG (generated by mariadb-binlog)"},
{"Replication master admin", "Server", "To monitor connected slaves"}, {"Replication master admin", "Server", "To monitor connected slaves"},
{"Replication slave admin", "Server", "To start/stop slave and apply binlog events"}, {"Replication slave admin", "Server", "To start/stop slave and apply binlog events"},
{"Slave monitor", "Server", "To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS"}, {"Slave monitor", "Server", "To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS"},
@@ -618,8 +619,7 @@ db_dirs_hash_get_key(const uchar *data, size_t *len_ret,
@retval FALSE success @retval FALSE success
*/ */
bool bool push_ignored_db_dir(const char *path)
push_ignored_db_dir(char *path)
{ {
LEX_CSTRING *new_elt; LEX_CSTRING *new_elt;
char *new_elt_buffer; char *new_elt_buffer;

View File

@@ -253,7 +253,7 @@ bool ignore_db_dirs_init();
void ignore_db_dirs_free(); void ignore_db_dirs_free();
void ignore_db_dirs_reset(); void ignore_db_dirs_reset();
bool ignore_db_dirs_process_additions(); bool ignore_db_dirs_process_additions();
bool push_ignored_db_dir(char *path); bool push_ignored_db_dir(const char *path);
extern char *opt_ignore_db_dirs; extern char *opt_ignore_db_dirs;
#endif /* SQL_SHOW_H */ #endif /* SQL_SHOW_H */

View File

@@ -2656,7 +2656,8 @@ static struct my_option my_long_options[] =
C_MODE_START C_MODE_START
static my_bool get_one_option(const struct my_option *, char *, const char *); static my_bool get_one_option(const struct my_option *, const char *,
const char *);
C_MODE_END C_MODE_END
static void print_version(void) static void print_version(void)
@@ -2678,7 +2679,7 @@ static void print_usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, const char *) get_one_option(const struct my_option *opt, const char *argument, const char *)
{ {
switch(opt->id) { switch(opt->id) {
case '#': case '#':

View File

@@ -128,7 +128,7 @@ int main(int argc, char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
my_setup_stacktrace(); my_setup_stacktrace();
default_log_dir= opt_log_dir= maria_data_root= (char *)"."; default_log_dir= opt_log_dir= maria_data_root= ".";
maria_chk_init(&check_param); maria_chk_init(&check_param);
check_param.opt_lock_memory= 1; /* Lock memory if possible */ check_param.opt_lock_memory= 1; /* Lock memory if possible */
check_param.using_global_keycache = 0; check_param.using_global_keycache = 0;
@@ -322,7 +322,7 @@ static struct my_option my_long_options[] =
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
{"datadir", 'h', {"datadir", 'h',
"Path for control file (and logs if --logdir not used).", "Path for control file (and logs if --logdir not used).",
&maria_data_root, 0, 0, GET_STR, REQUIRED_ARG, (char**) &maria_data_root, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"logdir", OPT_LOG_DIR, {"logdir", OPT_LOG_DIR,
"Path for log files.", "Path for log files.",
@@ -639,7 +639,8 @@ TYPELIB maria_stats_method_typelib= {
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
#ifdef __NETWARE__ #ifdef __NETWARE__

View File

@@ -88,7 +88,7 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
@@ -143,7 +143,7 @@ int main(int argc, char **argv)
translog_table_init(); translog_table_init();
translog_fill_overhead_table(); translog_fill_overhead_table();
maria_data_root= (char *)"."; maria_data_root= ".";
if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0)
{ {

View File

@@ -21,7 +21,8 @@
static void usage(); static void usage();
static void complain(int val); static void complain(int val);
static my_bool get_one_option(const struct my_option *, char *, const char*); static my_bool get_one_option(const struct my_option *, const char *,
const char*);
static int count=0, stats=0, dump=0, lstats=0; static int count=0, stats=0, dump=0, lstats=0;
static my_bool verbose; static my_bool verbose;
@@ -233,7 +234,7 @@ err:
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -229,7 +229,7 @@ int main(int argc, char **argv)
my_bool no_control_file= 0; my_bool no_control_file= 0;
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
default_argv= argv; default_argv= argv;
get_options(&argc,&argv); get_options(&argc,&argv);
@@ -316,7 +316,7 @@ static struct my_option my_long_options[] =
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'h', {"datadir", 'h',
"Path for control file (and logs if --logdir not used).", "Path for control file (and logs if --logdir not used).",
&maria_data_root, 0, 0, GET_STR, REQUIRED_ARG, (char**) &maria_data_root, 0, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -381,7 +381,8 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
uint length; uint length;

View File

@@ -83,7 +83,7 @@ int main(int argc, char **argv)
uint warnings_count; uint warnings_count;
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
default_argv= argv; default_argv= argv;
@@ -248,7 +248,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0 }, 0, 0, 0, 0 },
{"aria-log-dir-path", 'h', {"aria-log-dir-path", 'h',
"Path to the directory where to store transactional log", "Path to the directory where to store transactional log",
(uchar **) &maria_data_root, (uchar **) &maria_data_root, 0, (char **) &maria_data_root, (char **) &maria_data_root, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "page-buffer-size", 'P', { "page-buffer-size", 'P',
"The size of the buffer used for index blocks for Aria tables", "The size of the buffer used for index blocks for Aria tables",
@@ -343,7 +343,8 @@ static uchar* my_hash_get_string(const uchar *record, size_t *length,
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
case '?': case '?':

View File

@@ -138,7 +138,7 @@ ATTRIBUTE_NORETURN static void my_exit(int exit_code)
extern "C" my_bool get_one_option(const struct my_option *opt extern "C" my_bool get_one_option(const struct my_option *opt
__attribute__((unused)), __attribute__((unused)),
char *argument, const char *filename) const char *argument, const char *filename)
{ {
switch (opt->id) { switch (opt->id) {
case 'V': case 'V':

View File

@@ -187,12 +187,11 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0,
"with PAGE_CHECKSUM clause in CREATE TABLE)", 0, 0, 1); "with PAGE_CHECKSUM clause in CREATE TABLE)", 0, 0, 1);
/* It is only command line argument */ /* It is only command line argument */
static MYSQL_SYSVAR_STR(log_dir_path, maria_data_root, static MYSQL_SYSVAR_CONST_STR(log_dir_path, maria_data_root,
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to the directory where to store transactional log", "Path to the directory where to store transactional log",
NULL, NULL, mysql_real_data_home); NULL, NULL, mysql_real_data_home);
static MYSQL_SYSVAR_ULONG(log_file_size, log_file_size, static MYSQL_SYSVAR_ULONG(log_file_size, log_file_size,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Limit for transaction log size", "Limit for transaction log size",

View File

@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
get_options(argc, argv); get_options(argc, argv);
/* Maria requires that we always have a page cache */ /* Maria requires that we always have a page cache */
if (maria_init() || if (maria_init() ||
@@ -616,8 +616,8 @@ static struct my_option my_long_options[] =
#endif #endif
{"help", '?', "Display help and exit", {"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'h', "Path to the database root.", &maria_data_root, {"datadir", 'h', "Path to the database root.", (char**) &maria_data_root,
&maria_data_root, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (char**) &maria_data_root, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"row-fixed-size", 'S', "Fixed size records", {"row-fixed-size", 'S', "Fixed size records",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rows-in-block", 'M', "Store rows in block format", {"rows-in-block", 'M', "Store rows in block format",
@@ -645,7 +645,7 @@ static struct my_option my_long_options[] =
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -62,7 +62,7 @@ PAGECACHE *maria_pagecache= &maria_pagecache_var;
PAGECACHE maria_log_pagecache_var; PAGECACHE maria_log_pagecache_var;
PAGECACHE *maria_log_pagecache= &maria_log_pagecache_var; PAGECACHE *maria_log_pagecache= &maria_log_pagecache_var;
MY_TMPDIR *maria_tmpdir; /* Tempdir for redo */ MY_TMPDIR *maria_tmpdir; /* Tempdir for redo */
char *maria_data_root; const char *maria_data_root;
HASH maria_stored_state; HASH maria_stored_state;
int (*maria_create_trn_hook)(MARIA_HA *); int (*maria_create_trn_hook)(MARIA_HA *);

View File

@@ -25,7 +25,7 @@
#include "trnman.h" #include "trnman.h"
extern PAGECACHE *maria_log_pagecache; extern PAGECACHE *maria_log_pagecache;
extern char *maria_data_root; extern const char *maria_data_root;
#define MAX_REC_LENGTH 1024 #define MAX_REC_LENGTH 1024
@@ -75,7 +75,7 @@ int main(int argc,char *argv[])
safe_mutex_deadlock_detector= 1; safe_mutex_deadlock_detector= 1;
#endif #endif
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
get_options(argc,argv); get_options(argc,argv);
/* Maria requires that we always have a page cache */ /* Maria requires that we always have a page cache */
if (maria_init() || if (maria_init() ||
@@ -739,8 +739,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Undocumented", {"debug", '#', "Undocumented",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"datadir", 'h', "Path to the database root.", &maria_data_root, {"datadir", 'h', "Path to the database root.", (char**) &maria_data_root,
&maria_data_root, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (char**) &maria_data_root, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delete-rows", 'd', "Abort after this many rows has been deleted", {"delete-rows", 'd', "Abort after this many rows has been deleted",
(uchar**) &remove_count, (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, (uchar**) &remove_count, (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG,
1000, 0, 0, 0, 0, 0}, 1000, 0, 0, 0, 0, 0},
@@ -813,7 +813,7 @@ static struct my_option my_long_options[] =
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
#endif #endif
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
get_options(argc,argv); get_options(argc,argv);
fn_format(filename, "test2", maria_data_root, "", MYF(0)); fn_format(filename, "test2", maria_data_root, "", MYF(0));

View File

@@ -1238,7 +1238,7 @@ extern uchar maria_file_magic[], maria_pack_file_magic[];
extern uchar maria_uuid[MY_UUID_SIZE]; extern uchar maria_uuid[MY_UUID_SIZE];
extern uint32 maria_read_vec[], maria_readnext_vec[]; extern uint32 maria_read_vec[], maria_readnext_vec[];
extern uint maria_quick_table_bits; extern uint maria_quick_table_bits;
extern char *maria_data_root; extern const char *maria_data_root;
extern uchar maria_zero_string[]; extern uchar maria_zero_string[];
extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data; extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data;
extern my_bool maria_recovery_verbose, maria_checkpoint_disabled; extern my_bool maria_recovery_verbose, maria_checkpoint_disabled;

View File

@@ -41,7 +41,7 @@ int main(int argc __attribute__((unused)), char *argv[])
safe_mutex_deadlock_detector= 1; safe_mutex_deadlock_detector= 1;
#endif #endif
MY_INIT(argv[0]); MY_INIT(argv[0]);
maria_data_root= (char *)"."; maria_data_root= ".";
/* Maria requires that we always have a page cache */ /* Maria requires that we always have a page cache */
if (maria_init() || if (maria_init() ||

View File

@@ -580,7 +580,7 @@ static void version(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -190,7 +190,7 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {

View File

@@ -589,7 +589,7 @@ static struct my_option my_long_options[] =
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -22,7 +22,8 @@
static void usage(); static void usage();
static void complain(int val); static void complain(int val);
static my_bool get_one_option(const struct my_option *, char *, const char *); static my_bool get_one_option(const struct my_option *, const char *,
const char *);
static int count=0, stats=0, dump=0, lstats=0; static int count=0, stats=0, dump=0, lstats=0;
static my_bool verbose; static my_bool verbose;
@@ -229,7 +230,7 @@ err:
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch(opt->id) { switch(opt->id) {

View File

@@ -471,7 +471,7 @@ TYPELIB myisam_stats_method_typelib= {
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument, const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
case 'a': case 'a':

View File

@@ -317,7 +317,8 @@ static void usage(void)
static my_bool static my_bool
get_one_option(const struct my_option *opt, get_one_option(const struct my_option *opt,
char *argument, const char *filename __attribute__((unused))) const char *argument,
const char *filename __attribute__((unused)))
{ {
uint length; uint length;

View File

@@ -335,7 +335,7 @@ add_query(const char *q)
static my_bool static my_bool
handle_option(const struct my_option *opt, char *arg, handle_option(const struct my_option *opt, const char *arg,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) switch (opt->id)

View File

@@ -1272,7 +1272,7 @@ static struct my_tests_st *get_my_tests(); /* To be defined in main .c file */
static struct my_tests_st *my_testlist= 0; static struct my_tests_st *my_testlist= 0;
static my_bool static my_bool
get_one_option(const struct my_option *opt, char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
switch (opt->id) { switch (opt->id) {
@@ -1285,10 +1285,15 @@ get_one_option(const struct my_option *opt, char *argument,
case 'p': case 'p':
if (argument) if (argument)
{ {
char *start=argument; /*
One should not really change the argument, but we make an
exception for passwords
*/
char *start= (char*) argument;
my_free(opt_password); my_free(opt_password);
opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE)); opt_password= my_strdup(PSI_NOT_INSTRUMENTED, argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */ while (*argument)
*(char*) argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
start[1]=0; start[1]=0;
} }

View File

@@ -61,7 +61,7 @@ static struct my_option mopts_options[]=
}; };
my_bool dummy_get_one_option(const struct my_option *opt __attribute__((unused)), my_bool dummy_get_one_option(const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused)), const char *argument __attribute__((unused)),
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
return FALSE; return FALSE;
@@ -235,7 +235,7 @@ static struct my_option auto_options[]=
my_bool auto_get_one_option(const struct my_option *opt, my_bool auto_get_one_option(const struct my_option *opt,
char *argument, const char *argument,
const char *filename __attribute__((unused))) const char *filename __attribute__((unused)))
{ {
if (argument == autoset_my_option) if (argument == autoset_my_option)