mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -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 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 188 Table_map 1 227 table_id: # (test.t1)
|
||||||
master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F
|
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;
|
||||||
|
@ -54,3 +54,43 @@ UPDATE t1 SET a=99 WHERE a = 0;
|
|||||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
SHOW BINLOG EVENTS;
|
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;
|
||||||
|
@ -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
|
When the open and locking succeeded, we add all the tables to
|
||||||
the table map and remove them from tables to lock.
|
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;
|
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->m_table_map.set_table(ptr->table_id, ptr->table);
|
||||||
rli->touching_table(ptr->db, ptr->table_name, ptr->table_id);
|
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();
|
rli->clear_tables_to_lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user