mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Merge 10.3 into 10.4
In main.index_merge_myisam we remove the test that was added in commita2d24def8cbecause it duplicates the test case that was added in commit5af12e4635.
This commit is contained in:
commit
af91266498
140 changed files with 2568 additions and 1409 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2016, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -99,6 +99,7 @@ enum options_client
|
|||
OPT_REPORT_PROGRESS,
|
||||
OPT_SKIP_ANNOTATE_ROWS_EVENTS,
|
||||
OPT_SSL_CRL, OPT_SSL_CRLPATH,
|
||||
OPT_IGNORE_DATA,
|
||||
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
|
||||
OPT_SHUTDOWN_WAIT_FOR_SLAVES,
|
||||
OPT_MAX_CLIENT_OPTION /* should be always the last */
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
|
|||
|
||||
len= (int)(last_fn_libchar - self_name);
|
||||
|
||||
my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
|
||||
my_snprintf(tool_executable_name, FN_REFLEN, "%.*b%c%s",
|
||||
len, self_name, FN_LIBCHAR, tool_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2010, 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -90,6 +90,7 @@
|
|||
/* Max length GTID position that we will output. */
|
||||
#define MAX_GTID_LENGTH 1024
|
||||
|
||||
static my_bool ignore_table_data(const uchar *hash_key, size_t len);
|
||||
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
||||
const char *option_value);
|
||||
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
|
||||
|
|
@ -209,7 +210,7 @@ TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
|
|||
|
||||
#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
|
||||
|
||||
static HASH ignore_table;
|
||||
static HASH ignore_table, ignore_data;
|
||||
|
||||
static HASH ignore_database;
|
||||
|
||||
|
|
@ -380,6 +381,12 @@ static struct my_option my_long_options[] =
|
|||
"use the directive multiple times, once for each database. Only takes effect "
|
||||
"when used together with --all-databases|-A",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ignore-table-data", OPT_IGNORE_DATA,
|
||||
"Do not dump the specified table data. To specify more than one table "
|
||||
"to ignore, use the directive multiple times, once for each table. "
|
||||
"Each table must be specified with both database and table names, e.g., "
|
||||
"--ignore-table-data=database.table.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ignore-table", OPT_IGNORE_TABLE,
|
||||
"Do not dump the specified table. To specify more than one table to ignore, "
|
||||
"use the directive multiple times, once for each table. Each table must "
|
||||
|
|
@ -904,6 +911,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
if (my_hash_insert(&ignore_database, (uchar*) my_strdup(argument, MYF(0))))
|
||||
exit(EX_EOM);
|
||||
break;
|
||||
case (int) OPT_IGNORE_DATA:
|
||||
{
|
||||
if (!strchr(argument, '.'))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Illegal use of option --ignore-table-data=<database>.<table>\n");
|
||||
exit(1);
|
||||
}
|
||||
if (my_hash_insert(&ignore_data, (uchar*)my_strdup(argument, MYF(0))))
|
||||
exit(EX_EOM);
|
||||
break;
|
||||
}
|
||||
case (int) OPT_IGNORE_TABLE:
|
||||
{
|
||||
if (!strchr(argument, '.'))
|
||||
|
|
@ -1011,6 +1030,10 @@ static int get_options(int *argc, char ***argv)
|
|||
(uchar*) my_strdup("mysql.transaction_registry", MYF(MY_WME))))
|
||||
return(EX_EOM);
|
||||
|
||||
if (my_hash_init(&ignore_data, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
return(EX_EOM);
|
||||
|
||||
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
return(ho_error);
|
||||
|
||||
|
|
@ -1667,6 +1690,8 @@ static void free_resources()
|
|||
my_hash_free(&ignore_database);
|
||||
if (my_hash_inited(&ignore_table))
|
||||
my_hash_free(&ignore_table);
|
||||
if (my_hash_inited(&ignore_data))
|
||||
my_hash_free(&ignore_data);
|
||||
dynstr_free(&extended_row);
|
||||
dynstr_free(&dynamic_where);
|
||||
dynstr_free(&insert_pat);
|
||||
|
|
@ -3668,7 +3693,7 @@ static char *alloc_query_str(size_t size)
|
|||
*/
|
||||
|
||||
|
||||
static void dump_table(char *table, char *db)
|
||||
static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
|
||||
{
|
||||
char ignore_flag;
|
||||
char buf[200], table_buff[NAME_LEN+3];
|
||||
|
|
@ -3698,7 +3723,7 @@ static void dump_table(char *table, char *db)
|
|||
DBUG_VOID_RETURN;
|
||||
|
||||
/* Check --no-data flag */
|
||||
if (opt_no_data)
|
||||
if (opt_no_data || (hash_key && ignore_table_data(hash_key, len)))
|
||||
{
|
||||
verbose_msg("-- Skipping dump data for table '%s', --no-data was used\n",
|
||||
table);
|
||||
|
|
@ -4643,10 +4668,14 @@ static int init_dumping(char *database, int init_func(char*))
|
|||
|
||||
/* Return 1 if we should copy the table */
|
||||
|
||||
my_bool include_table(const uchar *hash_key, size_t len)
|
||||
static my_bool include_table(const uchar *hash_key, size_t len)
|
||||
{
|
||||
return ! my_hash_search(&ignore_table, hash_key, len);
|
||||
}
|
||||
static my_bool ignore_table_data(const uchar *hash_key, size_t len)
|
||||
{
|
||||
return my_hash_search(&ignore_data, hash_key, len) != NULL;
|
||||
}
|
||||
|
||||
|
||||
static int dump_all_tables_in_db(char *database)
|
||||
|
|
@ -4712,7 +4741,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
char *end= strmov(afterdot, table);
|
||||
if (include_table((uchar*) hash_key, end - hash_key))
|
||||
{
|
||||
dump_table(table,database);
|
||||
dump_table(table, database, (uchar*) hash_key, end - hash_key);
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
if (opt_dump_triggers && mysql_get_server_version(mysql) >= 50009)
|
||||
|
|
@ -5110,7 +5139,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
for (pos= dump_tables; pos < end; pos++)
|
||||
{
|
||||
DBUG_PRINT("info",("Dumping table %s", *pos));
|
||||
dump_table(*pos, db);
|
||||
dump_table(*pos, db, NULL, 0);
|
||||
if (opt_dump_triggers &&
|
||||
mysql_get_server_version(mysql) >= 50009)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -588,8 +588,7 @@ static void cleanup_and_exit(int exit_code);
|
|||
|
||||
ATTRIBUTE_NORETURN
|
||||
void really_die(const char *msg);
|
||||
void report_or_die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
|
||||
void report_or_die(const char *fmt, ...);
|
||||
void die(const char *fmt, ...);
|
||||
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args);
|
||||
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
|
||||
|
|
@ -718,7 +717,7 @@ public:
|
|||
DBUG_ASSERT(ds->str);
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
DBUG_PRINT("extra", ("str: %*s", (int) ds->length, ds->str));
|
||||
DBUG_PRINT("extra", ("str: %*b", (int) ds->length, ds->str));
|
||||
#endif
|
||||
|
||||
if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)
|
||||
|
|
@ -1140,71 +1139,6 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Run query and dump the result to stderr in vertical format
|
||||
|
||||
NOTE! This function should be safe to call when an error
|
||||
has occurred and thus any further errors will be ignored (although logged)
|
||||
|
||||
SYNOPSIS
|
||||
show_query
|
||||
mysql - connection to use
|
||||
query - query to run
|
||||
|
||||
*/
|
||||
|
||||
static void show_query(MYSQL* mysql, const char* query)
|
||||
{
|
||||
MYSQL_RES* res;
|
||||
DBUG_ENTER("show_query");
|
||||
|
||||
if (!mysql)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
if (mysql_query(mysql, query))
|
||||
{
|
||||
log_msg("Error running query '%s': %d %s",
|
||||
query, mysql_errno(mysql), mysql_error(mysql));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
if ((res= mysql_store_result(mysql)) == NULL)
|
||||
{
|
||||
/* No result set returned */
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
unsigned int i;
|
||||
unsigned int row_num= 0;
|
||||
unsigned int num_fields= mysql_num_fields(res);
|
||||
MYSQL_FIELD *fields= mysql_fetch_fields(res);
|
||||
|
||||
fprintf(stderr, "=== %s ===\n", query);
|
||||
while ((row= mysql_fetch_row(res)))
|
||||
{
|
||||
unsigned long *lengths= mysql_fetch_lengths(res);
|
||||
row_num++;
|
||||
|
||||
fprintf(stderr, "---- %d. ----\n", row_num);
|
||||
for(i= 0; i < num_fields; i++)
|
||||
{
|
||||
fprintf(stderr, "%s\t%.*s\n",
|
||||
fields[i].name,
|
||||
(int)lengths[i], row[i] ? row[i] : "NULL");
|
||||
}
|
||||
}
|
||||
for (i= 0; i < strlen(query)+8; i++)
|
||||
fprintf(stderr, "=");
|
||||
fprintf(stderr, "\n\n");
|
||||
}
|
||||
mysql_free_result(res);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Show any warnings just before the error. Since the last error
|
||||
is added to the warning stack, only print @@warning_count-1 warnings.
|
||||
|
|
@ -1363,7 +1297,7 @@ void check_command_args(struct st_command *command,
|
|||
|
||||
/* Check required arg */
|
||||
if (arg->ds->length == 0 && arg->required)
|
||||
die("Missing required argument '%s' to command '%.*s'", arg->argname,
|
||||
die("Missing required argument '%s' to command '%.*b'", arg->argname,
|
||||
command->first_word_len, command->query);
|
||||
|
||||
}
|
||||
|
|
@ -1372,7 +1306,7 @@ void check_command_args(struct st_command *command,
|
|||
while(ptr <= command->end && *ptr != '#')
|
||||
{
|
||||
if (*ptr && *ptr != ' ')
|
||||
die("Extra argument '%s' passed to '%.*s'",
|
||||
die("Extra argument '%s' passed to '%.*b'",
|
||||
ptr, command->first_word_len, command->query);
|
||||
ptr++;
|
||||
}
|
||||
|
|
@ -1392,7 +1326,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
|
||||
if (command->abort_on_error)
|
||||
{
|
||||
report_or_die("command \"%.*s\" failed with error: %u my_errno: %d "
|
||||
report_or_die("command \"%.*b\" failed with error: %u my_errno: %d "
|
||||
"errno: %d",
|
||||
command->first_word_len, command->query, error, my_errno,
|
||||
sys_errno);
|
||||
|
|
@ -1410,7 +1344,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (command->expected_errors.count > 0)
|
||||
report_or_die("command \"%.*s\" failed with wrong error: %u "
|
||||
report_or_die("command \"%.*b\" failed with wrong error: %u "
|
||||
"my_errno: %d errno: %d",
|
||||
command->first_word_len, command->query, error, my_errno,
|
||||
sys_errno);
|
||||
|
|
@ -1419,7 +1353,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
command->expected_errors.err[0].code.errnum != 0)
|
||||
{
|
||||
/* Error code we wanted was != 0, i.e. not an expected success */
|
||||
report_or_die("command \"%.*s\" succeeded - should have failed with "
|
||||
report_or_die("command \"%.*b\" succeeded - should have failed with "
|
||||
"errno %d...",
|
||||
command->first_word_len, command->query,
|
||||
command->expected_errors.err[0].code.errnum);
|
||||
|
|
@ -2372,7 +2306,7 @@ static int strip_surrounding(char* str, char c1, char c2)
|
|||
static void strip_parentheses(struct st_command *command)
|
||||
{
|
||||
if (strip_surrounding(command->first_argument, '(', ')'))
|
||||
die("%.*s - argument list started with '%c' must be ended with '%c'",
|
||||
die("%.*b - argument list started with '%c' must be ended with '%c'",
|
||||
command->first_word_len, command->query, '(', ')');
|
||||
}
|
||||
|
||||
|
|
@ -3028,7 +2962,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
|
|||
/* Make sure there was just a $variable and nothing else */
|
||||
const char* end= *p_end + 1;
|
||||
if (end < expected_end && !open_end)
|
||||
die("Found junk '%.*s' after $variable in expression",
|
||||
die("Found junk '%.*b' after $variable in expression",
|
||||
(int)(expected_end - end - 1), end);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
@ -3522,10 +3456,10 @@ int do_modify_var(struct st_command *command,
|
|||
const char *p= command->first_argument;
|
||||
VAR* v;
|
||||
if (!*p)
|
||||
die("Missing argument to %.*s", command->first_word_len,
|
||||
die("Missing argument to %.*b", command->first_word_len,
|
||||
command->query);
|
||||
if (*p != '$')
|
||||
die("The argument to %.*s must be a variable (start with $)",
|
||||
die("The argument to %.*b must be a variable (start with $)",
|
||||
command->first_word_len, command->query);
|
||||
v= var_get(p, &p, 1, 0);
|
||||
if (! v->is_int)
|
||||
|
|
@ -4792,9 +4726,6 @@ void do_sync_with_master2(struct st_command *command, long offset,
|
|||
if (!result_str || result < 0)
|
||||
{
|
||||
/* master_pos_wait returned NULL or < 0 */
|
||||
show_query(mysql, "SHOW MASTER STATUS");
|
||||
show_query(mysql, "SHOW SLAVE STATUS");
|
||||
show_query(mysql, "SHOW PROCESSLIST");
|
||||
fprintf(stderr, "analyze: sync_with_master\n");
|
||||
|
||||
if (!result_str)
|
||||
|
|
@ -4805,18 +4736,18 @@ void do_sync_with_master2(struct st_command *command, long offset,
|
|||
information is not initialized, the arguments are
|
||||
incorrect, or an error has occurred
|
||||
*/
|
||||
die("%.*s failed: '%s' returned NULL " \
|
||||
die("%.*b failed: '%s' returned NULL " \
|
||||
"indicating slave SQL thread failure",
|
||||
command->first_word_len, command->query, query_buf);
|
||||
|
||||
}
|
||||
|
||||
if (result == -1)
|
||||
die("%.*s failed: '%s' returned -1 " \
|
||||
die("%.*b failed: '%s' returned -1 " \
|
||||
"indicating timeout after %d seconds",
|
||||
command->first_word_len, command->query, query_buf, timeout);
|
||||
else
|
||||
die("%.*s failed: '%s' returned unknown result :%d",
|
||||
die("%.*b failed: '%s' returned unknown result :%d",
|
||||
command->first_word_len, command->query, query_buf, result);
|
||||
}
|
||||
|
||||
|
|
@ -4981,17 +4912,17 @@ int do_sleep(struct st_command *command, my_bool real_sleep)
|
|||
while (my_isspace(charset_info, *p))
|
||||
p++;
|
||||
if (!*p)
|
||||
die("Missing argument to %.*s", command->first_word_len,
|
||||
die("Missing argument to %.*b", command->first_word_len,
|
||||
command->query);
|
||||
sleep_start= p;
|
||||
/* Check that arg starts with a digit, not handled by my_strtod */
|
||||
if (!my_isdigit(charset_info, *sleep_start))
|
||||
die("Invalid argument to %.*s \"%s\"", command->first_word_len,
|
||||
die("Invalid argument to %.*b \"%s\"", command->first_word_len,
|
||||
command->query, sleep_start);
|
||||
sleep_val= my_strtod(sleep_start, &sleep_end, &error);
|
||||
check_eol_junk_line(sleep_end);
|
||||
if (error)
|
||||
die("Invalid argument to %.*s \"%s\"", command->first_word_len,
|
||||
die("Invalid argument to %.*b \"%s\"", command->first_word_len,
|
||||
command->query, command->first_argument);
|
||||
dynstr_free(&ds_sleep);
|
||||
|
||||
|
|
@ -6012,7 +5943,7 @@ void do_connect(struct st_command *command)
|
|||
csname= strdup(con_options + sizeof("CHARSET=") - 1);
|
||||
}
|
||||
else
|
||||
die("Illegal option to connect: %.*s",
|
||||
die("Illegal option to connect: %.*b",
|
||||
(int) (end - con_options), con_options);
|
||||
/* Process next option */
|
||||
con_options= end;
|
||||
|
|
@ -6321,7 +6252,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
|||
|
||||
enum block_op operand= find_operand(curr_ptr);
|
||||
if (operand == ILLEG_OP)
|
||||
die("Found junk '%.*s' after $variable in condition",
|
||||
die("Found junk '%.*b' after $variable in condition",
|
||||
(int)(expr_end - curr_ptr), curr_ptr);
|
||||
|
||||
/* We could silently allow this, but may be confusing */
|
||||
|
|
@ -9510,6 +9441,7 @@ int main(int argc, char **argv)
|
|||
case Q_LET: do_let(command); break;
|
||||
case Q_EVAL_RESULT:
|
||||
die("'eval_result' command is deprecated");
|
||||
break; // never called but keep compiler calm
|
||||
case Q_EVAL:
|
||||
case Q_EVALP:
|
||||
case Q_QUERY_VERTICAL:
|
||||
|
|
@ -10232,6 +10164,7 @@ void append_replace_regex(char* expr, char *expr_end, struct st_replace_regex* r
|
|||
return;
|
||||
|
||||
err:
|
||||
my_free(res->regex_arr.buffer);
|
||||
my_free(res);
|
||||
die("Error parsing replace_regex \"%s\"", expr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue