Skip to content

Commit

Permalink
Merge 10.3 into 10.4
Browse files Browse the repository at this point in the history
In main.index_merge_myisam we remove the test that was added in
commit a2d24de because
it duplicates the test case that was added in
commit 5af12e4.
  • Loading branch information
dr-m committed Apr 16, 2020
2 parents 5679a2b + 6577a7a commit af91266
Show file tree
Hide file tree
Showing 140 changed files with 2,568 additions and 1,409 deletions.
3 changes: 2 additions & 1 deletion client/client_priv.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
43 changes: 36 additions & 7 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 *);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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, '.'))
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit af91266

Please sign in to comment.