Skip to content

Commit 84db10f

Browse files
committed
Merge 10.2 into 10.3
2 parents 9aacda4 + ccaec18 commit 84db10f

File tree

127 files changed

+2213
-1319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2213
-1319
lines changed

client/client_priv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
3-
Copyright (c) 2009, 2016, MariaDB
3+
Copyright (c) 2009, 2020, MariaDB
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -99,6 +99,7 @@ enum options_client
9999
OPT_REPORT_PROGRESS,
100100
OPT_SKIP_ANNOTATE_ROWS_EVENTS,
101101
OPT_SSL_CRL, OPT_SSL_CRLPATH,
102+
OPT_IGNORE_DATA,
102103
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
103104
OPT_MAX_CLIENT_OPTION /* should be always the last */
104105
};

client/mysql_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
503503

504504
len= (int)(last_fn_libchar - self_name);
505505

506-
my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
506+
my_snprintf(tool_executable_name, FN_REFLEN, "%.*b%c%s",
507507
len, self_name, FN_LIBCHAR, tool_name);
508508
}
509509

client/mysqldump.c

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
3-
Copyright (c) 2010, 2019, MariaDB Corporation.
3+
Copyright (c) 2010, 2020, MariaDB Corporation.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -90,6 +90,7 @@
9090
/* Max length GTID position that we will output. */
9191
#define MAX_GTID_LENGTH 1024
9292

93+
static my_bool ignore_table_data(const uchar *hash_key, size_t len);
9394
static void add_load_option(DYNAMIC_STRING *str, const char *option,
9495
const char *option_value);
9596
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
@@ -212,7 +213,7 @@ TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
212213

213214
#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
214215

215-
static HASH ignore_table;
216+
static HASH ignore_table, ignore_data;
216217

217218
static HASH ignore_database;
218219

@@ -383,6 +384,12 @@ static struct my_option my_long_options[] =
383384
"use the directive multiple times, once for each database. Only takes effect "
384385
"when used together with --all-databases|-A",
385386
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
387+
{"ignore-table-data", OPT_IGNORE_DATA,
388+
"Do not dump the specified table data. To specify more than one table "
389+
"to ignore, use the directive multiple times, once for each table. "
390+
"Each table must be specified with both database and table names, e.g., "
391+
"--ignore-table-data=database.table.",
392+
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
386393
{"ignore-table", OPT_IGNORE_TABLE,
387394
"Do not dump the specified table. To specify more than one table to ignore, "
388395
"use the directive multiple times, once for each table. Each table must "
@@ -911,6 +918,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
911918
if (my_hash_insert(&ignore_database, (uchar*) my_strdup(argument, MYF(0))))
912919
exit(EX_EOM);
913920
break;
921+
case (int) OPT_IGNORE_DATA:
922+
{
923+
if (!strchr(argument, '.'))
924+
{
925+
fprintf(stderr,
926+
"Illegal use of option --ignore-table-data=<database>.<table>\n");
927+
exit(1);
928+
}
929+
if (my_hash_insert(&ignore_data, (uchar*)my_strdup(argument, MYF(0))))
930+
exit(EX_EOM);
931+
break;
932+
}
914933
case (int) OPT_IGNORE_TABLE:
915934
{
916935
if (!strchr(argument, '.'))
@@ -1018,6 +1037,10 @@ static int get_options(int *argc, char ***argv)
10181037
(uchar*) my_strdup("mysql.transaction_registry", MYF(MY_WME))))
10191038
return(EX_EOM);
10201039

1040+
if (my_hash_init(&ignore_data, charset_info, 16, 0, 0,
1041+
(my_hash_get_key) get_table_key, my_free, 0))
1042+
return(EX_EOM);
1043+
10211044
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
10221045
return(ho_error);
10231046

@@ -1674,6 +1697,8 @@ static void free_resources()
16741697
my_hash_free(&ignore_database);
16751698
if (my_hash_inited(&ignore_table))
16761699
my_hash_free(&ignore_table);
1700+
if (my_hash_inited(&ignore_data))
1701+
my_hash_free(&ignore_data);
16771702
dynstr_free(&extended_row);
16781703
dynstr_free(&dynamic_where);
16791704
dynstr_free(&insert_pat);
@@ -3678,7 +3703,7 @@ static char *alloc_query_str(size_t size)
36783703
*/
36793704

36803705

3681-
static void dump_table(char *table, char *db)
3706+
static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
36823707
{
36833708
char ignore_flag;
36843709
char buf[200], table_buff[NAME_LEN+3];
@@ -3708,7 +3733,7 @@ static void dump_table(char *table, char *db)
37083733
DBUG_VOID_RETURN;
37093734

37103735
/* Check --no-data flag */
3711-
if (opt_no_data)
3736+
if (opt_no_data || (hash_key && ignore_table_data(hash_key, len)))
37123737
{
37133738
verbose_msg("-- Skipping dump data for table '%s', --no-data was used\n",
37143739
table);
@@ -4653,10 +4678,14 @@ static int init_dumping(char *database, int init_func(char*))
46534678

46544679
/* Return 1 if we should copy the table */
46554680

4656-
my_bool include_table(const uchar *hash_key, size_t len)
4681+
static my_bool include_table(const uchar *hash_key, size_t len)
46574682
{
46584683
return ! my_hash_search(&ignore_table, hash_key, len);
46594684
}
4685+
static my_bool ignore_table_data(const uchar *hash_key, size_t len)
4686+
{
4687+
return my_hash_search(&ignore_data, hash_key, len) != NULL;
4688+
}
46604689

46614690

46624691
static int dump_all_tables_in_db(char *database)
@@ -4722,7 +4751,7 @@ static int dump_all_tables_in_db(char *database)
47224751
char *end= strmov(afterdot, table);
47234752
if (include_table((uchar*) hash_key, end - hash_key))
47244753
{
4725-
dump_table(table,database);
4754+
dump_table(table, database, (uchar*) hash_key, end - hash_key);
47264755
my_free(order_by);
47274756
order_by= 0;
47284757
if (opt_dump_triggers && mysql_get_server_version(mysql) >= 50009)
@@ -5120,7 +5149,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
51205149
for (pos= dump_tables; pos < end; pos++)
51215150
{
51225151
DBUG_PRINT("info",("Dumping table %s", *pos));
5123-
dump_table(*pos, db);
5152+
dump_table(*pos, db, NULL, 0);
51245153
if (opt_dump_triggers &&
51255154
mysql_get_server_version(mysql) >= 50009)
51265155
{

0 commit comments

Comments
 (0)