diff options
author | Daniel Black <daniel@mariadb.org> | 2021-01-22 16:03:07 +1100 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2021-01-25 17:58:36 +1100 |
commit | c58d2c941c49550a85d610b1ad7b51cf0d4cd8db (patch) | |
tree | 981befc05df067e2e6959ef9eee607307d48ba31 /client | |
parent | 1a99958545f923f39344abe8b57bc80a2072510d (diff) | |
download | mariadb-git-c58d2c941c49550a85d610b1ad7b51cf0d4cd8db.tar.gz |
MDEV-20939: Race condition between mysqldump import and InnoDB persistent
statistics calculation
mysqldump --system=stats and --system=timezones by default used
ordinary INSERT statements populate EITS, innodb stats, and timezone tables.
As these all have primary keys it could result in conflict.
The behavior desired with --system= is to replace the tables.
As such we assume --replace for the purposes of stats and timezone tables
there if --insert-ignore isn't specified.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqldump.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 96bfd754d42..2eaec829867 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -4640,7 +4640,7 @@ static int dump_all_servers() static int dump_all_stats() { - my_bool prev_no_create_info; + my_bool prev_no_create_info, prev_opt_replace_into; if (mysql_select_db(mysql, "mysql")) { @@ -4648,6 +4648,8 @@ static int dump_all_stats() return 1; /* If --force */ } fprintf(md_result_file,"\nUSE mysql;\n"); + prev_opt_replace_into= opt_replace_into; + opt_replace_into|= !opt_ignore; prev_no_create_info= opt_no_create_info; opt_no_create_info= 1; /* don't overwrite recreate tables */ /* EITS added in 10.0.1 */ @@ -4666,6 +4668,7 @@ static int dump_all_stats() dump_table("innodb_table_stats", "mysql", NULL, 0); } opt_no_create_info= prev_no_create_info; + opt_replace_into= prev_opt_replace_into; return 0; } @@ -4676,12 +4679,14 @@ static int dump_all_stats() static int dump_all_timezones() { - my_bool opt_prev_no_create_info; + my_bool opt_prev_no_create_info, opt_prev_replace_into; if (mysql_select_db(mysql, "mysql")) { DB_error(mysql, "when selecting the database"); return 1; /* If --force */ } + opt_prev_replace_into= opt_replace_into; + opt_replace_into|= !opt_ignore; opt_prev_no_create_info= opt_no_create_info; opt_no_create_info= 1; fprintf(md_result_file,"\nUSE mysql;\n"); @@ -4691,6 +4696,7 @@ static int dump_all_timezones() dump_table("time_zone_transition", "mysql", NULL, 0); dump_table("time_zone_transition_type", "mysql", NULL, 0); opt_no_create_info= opt_prev_no_create_info; + opt_replace_into= opt_prev_replace_into; return 0; } |