diff options
author | guilhem@mysql.com <> | 2003-09-11 23:17:28 +0200 |
---|---|---|
committer | guilhem@mysql.com <> | 2003-09-11 23:17:28 +0200 |
commit | 59663fc661891a375f59a87d17ed9545175975be (patch) | |
tree | 17368ba287e00c5ee8a4b28a65a34bbf5fb4e4f5 /sql/repl_failsafe.cc | |
parent | 99490870e6fbc26208d044d712e28b1095f0aada (diff) | |
download | mariadb-git-59663fc661891a375f59a87d17ed9545175975be.tar.gz |
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly".
Now LOAD DATA FROM MASTER does not drop the database, instead it only tries to
create it, and drops/creates table-by-table.
* replicate_wild_ignore_table='db1.%' is now considered as "ignore the 'db1'
database as a whole", as it already works for CREATE DATABASE and DROP DATABASE.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r-- | sql/repl_failsafe.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index dc3f3c87dde..8deb23e8586 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -717,7 +717,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db, if (!tables_ok(thd, &table)) continue; } - if ((error= fetch_master_table(thd, db, table_name, mi, mysql))) + /* download master's table and overwrite slave's table */ + if ((error= fetch_master_table(thd, db, table_name, mi, mysql, 1))) return error; } return 0; @@ -819,8 +820,11 @@ int load_master_data(THD* thd) char* db = row[0]; /* - Do not replicate databases excluded by rules - also skip mysql database - in most cases the user will + Do not replicate databases excluded by rules. We also test + replicate_wild_*_table rules (replicate_wild_ignore_table='db1.%' will + be considered as "ignore the 'db1' database as a whole, as it already + works for CREATE DATABASE and DROP DATABASE). + Also skip 'mysql' database - in most cases the user will mess up and not exclude mysql database with the rules when he actually means to - in this case, he is up for a surprise if his priv tables get dropped and downloaded from master @@ -830,14 +834,14 @@ int load_master_data(THD* thd) */ if (!db_ok(db, replicate_do_db, replicate_ignore_db) || + !db_ok_with_wild_table(db) || !strcmp(db,"mysql")) { *cur_table_res = 0; continue; } - if (mysql_rm_db(thd, db, 1,1) || - mysql_create_db(thd, db, 0, 1)) + if (mysql_create_db(thd, db, HA_LEX_CREATE_IF_NOT_EXISTS, 1)) { send_error(&thd->net, 0, 0); cleanup_mysql_results(db_res, cur_table_res - 1, table_res); |