diff options
author | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2022-08-24 15:49:50 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2022-08-24 15:49:50 +0300 |
commit | 839fa95011b4a293361147d052357bc0987fe9a6 (patch) | |
tree | d8c7a2d798a2540d4d4499c78ca4b9e9531aea1a | |
parent | 392023d2b967d8bea4650cca7dd77c5134f29a97 (diff) | |
download | mariadb-git-839fa95011b4a293361147d052357bc0987fe9a6.tar.gz |
Fixup
-rw-r--r-- | client/mysqlbinlog.cc | 3 | ||||
-rw-r--r-- | sql/rpl_filter.cc | 35 | ||||
-rw-r--r-- | sql/rpl_filter.h | 2 | ||||
-rw-r--r-- | sql/rpl_mi.cc | 8 |
4 files changed, 13 insertions, 35 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index f0a81344206..c7b719d949d 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2435,7 +2435,8 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi } val= strmake_root(&glob_root, val, (size_t) (ptr-val)); - binlog_filter->add_db_rewrite(key, val); + //TODO(cvicentiu) + binlog_filter->add_rewrite_db(key); break; } case OPT_PRINT_ROW_COUNT: diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index c7d4e5c6ca4..71a2c4a6834 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -470,14 +470,6 @@ Rpl_filter::set_wild_ignore_table(const char* table_spec) } -void -Rpl_filter::add_db_rewrite(const char* from_db, const char* to_db) -{ - i_string_pair *db_pair = new i_string_pair(from_db, to_db); - rewrite_db.push_back(db_pair); -} - - int Rpl_filter::add_table_rule(HASH* h, const char* table_spec) { @@ -553,7 +545,6 @@ Rpl_filter::add_string_pair_list(const char* spec) len= (size_t)(ptr - spec); if (! (from_db= (char *) my_malloc(PSI_NOT_INSTRUMENTED, len, MYF(0)))) { - my_free(from_db); return 1; } memcpy(from_db, spec, len); @@ -565,6 +556,7 @@ Rpl_filter::add_string_pair_list(const char* spec) if (!strlen(val_ptr)) { // Bad syntax: Empty value \n" + my_free(from_db); return 1; } @@ -573,12 +565,13 @@ Rpl_filter::add_string_pair_list(const char* spec) len= (size_t)(ptr - val_ptr); if(! (to_db= (char *) my_malloc(PSI_NOT_INSTRUMENTED, len, MYF(0)))) { - my_free(to_db); + my_free(from_db); return 1; } memcpy(to_db, val_ptr, len); to_db[len]='\0'; - add_db_rewrite(from_db, to_db); + i_string_pair *db_pair = new i_string_pair(from_db, to_db); + rewrite_db.push_back(db_pair); return false; } @@ -747,16 +740,12 @@ Rpl_filter::free_string_list(I_List<i_string> *l) void Rpl_filter::free_string_pair_list(I_List<i_string_pair> *l) { - void *key; - void *val; i_string_pair *tmp; while ((tmp= l->get())) { - key= (void *) tmp->key; - my_free(key); - val= (void *) tmp->val; - my_free(val); + my_free((void *) tmp->key); + my_free((void *) tmp->val); delete tmp; } @@ -897,18 +886,6 @@ Rpl_filter::get_rewrite_db(const char* db, size_t *new_len) } -void -Rpl_filter::copy_rewrite_db(Rpl_filter *from) -{ - I_List_iterator<i_string_pair> it(from->rewrite_db); - i_string_pair* tmp; - DBUG_ASSERT(rewrite_db.is_empty()); - - /* TODO: Add memory checking here and in all add_xxxx functions ! */ - while ((tmp=it++)) - add_db_rewrite(tmp->key, tmp->val); -} - I_List<i_string>* Rpl_filter::get_do_db() { diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h index 302c2a50fe0..bb801f9795a 100644 --- a/sql/rpl_filter.h +++ b/sql/rpl_filter.h @@ -89,8 +89,6 @@ public: return parallel_mode; } - void add_db_rewrite(const char* from_db, const char* to_db); - /* Getters - to get information about current rules */ void get_do_table(String* str); diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index ab2523d960b..3c698f27a19 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1024,10 +1024,12 @@ void copy_filter_setting(Rpl_filter* dst_filter, Rpl_filter* src_filter) dst_filter->set_wild_ignore_table(tmp.ptr()); } - if (dst_filter->rewrite_db_is_empty()) + dst_filter->get_rewrite_db(&tmp); + if (tmp.is_empty()) { - if (!src_filter->rewrite_db_is_empty()) - dst_filter->copy_rewrite_db(src_filter); + src_filter->get_rewrite_db(&tmp); + if (!tmp.is_empty()) + dst_filter->set_rewrite_db(tmp.ptr()); } } |