summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-08-26 16:25:28 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-09-02 13:12:23 +0530
commitcd36bc01a5f1c1cd126cdd0668c6049cc78be40a (patch)
tree4804eb86f4514bcec67417ab310bcb410962aa64
parent94e9dc95d4bebf711f001e16bbb53fd8d6a58b8c (diff)
downloadmariadb-git-cd36bc01a5f1c1cd126cdd0668c6049cc78be40a.tar.gz
MDEV-23534: SIGSEGV in sf_malloc_usable_size/my_free on SET GLOBAL REPLICATE_DO_TABLE
Backporting fixes for: MDEV-22317: SIGSEGV in my_free/delete_dynamic in optimized builds (ARIA) Backported following commits from: 10.5.3 commit 77e1b0c39771f47bb2602530b8d1e584ac1d3731 -- Post push fix. commit 2e6b21be4a8d0bf094da288cadff866f1bb38062 MDEV-22059: MSAN report at replicate_ignore_table_grant Backported following commits from: 10.5.4 commit 840fb495ce2c0c00b20f2a9ba44b6fcc20c56118
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test2
-rw-r--r--sql/rpl_filter.cc52
5 files changed, 46 insertions, 14 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
index 5a746c88458..9709e24fbde 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
@@ -5,6 +5,8 @@ ERROR HY000: This operation cannot be performed as you have a running slave '';
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
+SET @@GLOBAL.replicate_do_table="";
+SET @@GLOBAL.replicate_ignore_table="";
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
index 19d8e513e6f..338f4b3bbcf 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
@@ -5,6 +5,8 @@ ERROR HY000: This operation cannot be performed as you have a running slave '';
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc
+SET @@GLOBAL.replicate_wild_do_table="";
+SET @@GLOBAL.replicate_wild_ignore_table="";
SET @@GLOBAL.replicate_wild_do_table="test.a%";
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test b/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
index 97ecc167356..ebededc36b3 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
@@ -51,6 +51,8 @@ SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
connection slave;
source include/stop_slave.inc;
+SET @@GLOBAL.replicate_do_table="";
+SET @@GLOBAL.replicate_ignore_table="";
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
source include/start_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test b/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
index c822c81f270..09db91aa4d3 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
@@ -13,6 +13,8 @@ SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
connection slave;
source include/stop_slave.inc;
+SET @@GLOBAL.replicate_wild_do_table="";
+SET @@GLOBAL.replicate_wild_ignore_table="";
SET @@GLOBAL.replicate_wild_do_table="test.a%";
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
source include/start_slave.inc;
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index 366902c1f26..0d5d9ffeea8 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -349,14 +349,20 @@ Rpl_filter::set_do_table(const char* table_spec)
int status;
if (do_table_inited)
- my_hash_reset(&do_table);
+ {
+ my_hash_free(&do_table);
+ do_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
- if (!do_table.records)
+ if (do_table_inited && status)
{
- my_hash_free(&do_table);
- do_table_inited= 0;
+ if (!do_table.records)
+ {
+ my_hash_free(&do_table);
+ do_table_inited= 0;
+ }
}
return status;
@@ -369,14 +375,20 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status;
if (ignore_table_inited)
- my_hash_reset(&ignore_table);
+ {
+ my_hash_free(&ignore_table);
+ ignore_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
- if (!ignore_table.records)
+ if (ignore_table_inited && status)
{
- my_hash_free(&ignore_table);
- ignore_table_inited= 0;
+ if (!ignore_table.records)
+ {
+ my_hash_free(&ignore_table);
+ ignore_table_inited= 0;
+ }
}
return status;
@@ -411,14 +423,20 @@ Rpl_filter::set_wild_do_table(const char* table_spec)
int status;
if (wild_do_table_inited)
+ {
free_string_array(&wild_do_table);
+ wild_do_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_wild_do_table);
- if (!wild_do_table.elements)
+ if (wild_do_table_inited && status)
{
- delete_dynamic(&wild_do_table);
- wild_do_table_inited= 0;
+ if (!wild_do_table.elements)
+ {
+ delete_dynamic(&wild_do_table);
+ wild_do_table_inited= 0;
+ }
}
return status;
@@ -431,14 +449,20 @@ Rpl_filter::set_wild_ignore_table(const char* table_spec)
int status;
if (wild_ignore_table_inited)
+ {
free_string_array(&wild_ignore_table);
+ wild_ignore_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_wild_ignore_table);
- if (!wild_ignore_table.elements)
+ if (wild_ignore_table_inited && status)
{
- delete_dynamic(&wild_ignore_table);
- wild_ignore_table_inited= 0;
+ if (!wild_ignore_table.elements)
+ {
+ delete_dynamic(&wild_ignore_table);
+ wild_ignore_table_inited= 0;
+ }
}
return status;