diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-01-21 11:34:05 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-01-27 22:13:07 +0530 |
commit | cbc75e9948acd849956aa78e1d31ed4ec350c35f (patch) | |
tree | f3714b36525d950474e8f4f3cc50c2a8183300f5 /client | |
parent | 5fd3c7471e3e0673b50d309567c9747d36f09412 (diff) | |
download | mariadb-git-cbc75e9948acd849956aa78e1d31ed4ec350c35f.tar.gz |
MDEV-20939: Race condition between mysqldump import and InnoDB persistent
statistics calculation
Analysis: When --replace or --insert-ignore is not given, dumping of
mysql.innodb_index_stats and mysql.innodb_table_stats will result into race
condition.
Fix: Check if these options are present with --system=stats (because dumping
under --system=stats is safe). Otherwise, dump only structure, ignoring data
because innodb will recalculate data anyway.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqldump.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 2eaec829867..ecca380777f 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1052,6 +1052,20 @@ static int get_options(int *argc, char ***argv) if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option))) return(ho_error); + /* + Dumping under --system=stats with --replace or --inser-ignore is safe and will not + retult into race condition. Otherwise dump only structure and ignore data by default + while dumping. + */ + if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into)) + { + if (my_hash_insert(&ignore_data, + (uchar*) my_strdup("mysql.innodb_index_stats", MYF(MY_WME))) || + my_hash_insert(&ignore_data, + (uchar*) my_strdup("mysql.innodb_table_stats", MYF(MY_WME)))) + return(EX_EOM); + } + if (opt_system & OPT_SYSTEM_ALL) opt_system|= ~0; |