diff options
author | unknown <mats@romeo.(none)> | 2006-09-06 17:45:27 +0200 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2006-09-06 17:45:27 +0200 |
commit | d247c70d265b4714a5e0468f570903efb6eaa589 (patch) | |
tree | c3c5bc5b924fd0e89a79037bba8b66f308696514 | |
parent | 0014295da5cfc6d58bbc36be5f903ab0061c2823 (diff) | |
download | mariadb-git-d247c70d265b4714a5e0468f570903efb6eaa589.tar.gz |
BUG#17620: Row-based replication fails when query cache enabled on slave
Invalidating query cache when processing rows for a statement on the slave.
mysql-test/r/rpl_row_basic_11bugs.result:
Result file change
mysql-test/t/rpl_row_basic_11bugs.test:
Adding test to trigger failure
sql/log_event.cc:
Adding code to invalidate the query cache just after opening the tables
for processing the rows of one statement.
-rw-r--r-- | mysql-test/r/rpl_row_basic_11bugs.result | 40 | ||||
-rw-r--r-- | mysql-test/t/rpl_row_basic_11bugs.test | 40 | ||||
-rw-r--r-- | sql/log_event.cc | 6 |
3 files changed, 86 insertions, 0 deletions
diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result index e8be537816e..d768797717b 100644 --- a/mysql-test/r/rpl_row_basic_11bugs.result +++ b/mysql-test/r/rpl_row_basic_11bugs.result @@ -60,3 +60,43 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F +DROP TABLE t1; +================ Test for BUG#17620 ================ +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** On Slave **** +SET GLOBAL QUERY_CACHE_SIZE=0; +**** On Master **** +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +**** On Slave **** +SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024; +**** On Master **** +INSERT INTO t1 VALUES (4),(5),(6); +**** On Slave **** +SELECT * FROM t1; +a +1 +2 +3 +4 +5 +6 +**** On Master **** +INSERT INTO t1 VALUES (7),(8),(9); +**** On Slave **** +SELECT * FROM t1; +a +1 +2 +3 +4 +5 +6 +7 +8 +9 +DROP TABLE t1; diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test index af7e9af4005..e636824284d 100644 --- a/mysql-test/t/rpl_row_basic_11bugs.test +++ b/mysql-test/t/rpl_row_basic_11bugs.test @@ -54,3 +54,43 @@ UPDATE t1 SET a=99 WHERE a = 0; --replace_result $SERVER_VERSION SERVER_VERSION --replace_regex /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS; + +DROP TABLE t1; + +# BUG#17620: Replicate (Row Based) Fails when Query Cache enabled on +# slave +--echo ================ Test for BUG#17620 ================ +--disable_query_log +--source include/master-slave-reset.inc +--enable_query_log + +--echo **** On Slave **** +connection slave; +SET GLOBAL QUERY_CACHE_SIZE=0; + +--echo **** On Master **** +connection master; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--echo **** On Slave **** +sync_slave_with_master; +SET GLOBAL QUERY_CACHE_SIZE=16*1024*1024; + +--echo **** On Master **** +connection master; +INSERT INTO t1 VALUES (4),(5),(6); + +--echo **** On Slave **** +sync_slave_with_master; +SELECT * FROM t1; + +--echo **** On Master **** +connection master; +INSERT INTO t1 VALUES (7),(8),(9); + +--echo **** On Slave **** +sync_slave_with_master; +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/sql/log_event.cc b/sql/log_event.cc index ebd90446a7e..d5da1468b14 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5425,6 +5425,9 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) /* When the open and locking succeeded, we add all the tables to the table map and remove them from tables to lock. + + We also invalidate the query cache for all the tables, since + they will now be changed. */ TABLE_LIST *ptr; @@ -5433,6 +5436,9 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) rli->m_table_map.set_table(ptr->table_id, ptr->table); rli->touching_table(ptr->db, ptr->table_name, ptr->table_id); } +#ifdef HAVE_QUERY_CACHE + query_cache.invalidate_locked_for_write(rli->tables_to_lock); +#endif rli->clear_tables_to_lock(); } |