Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-06 17:45:27+02:00, mats@romeo.(none) +3 -0
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@stripped, 2006-09-06 17:45:24+02:00, mats@romeo.(none) +40 -0
Result file change
mysql-test/t/rpl_row_basic_11bugs.test@stripped, 2006-09-06 17:45:25+02:00, mats@romeo.(none) +40 -0
Adding test to trigger failure
sql/log_event.cc@stripped, 2006-09-06 17:45:25+02:00, mats@romeo.(none) +6 -0
Adding code to invalidate the query cache just after opening the tables
for processing the rows of one statement.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mats
# Host: romeo.(none)
# Root: /home/bk/b17620-mysql-5.1-new-rpl
--- 1.237/sql/log_event.cc 2006-09-06 17:45:34 +02:00
+++ 1.238/sql/log_event.cc 2006-09-06 17:45:34 +02:00
@@ -5425,6 +5425,9 @@
/*
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 @@
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();
}
--- 1.9/mysql-test/r/rpl_row_basic_11bugs.result 2006-09-06 17:45:34 +02:00
+++ 1.10/mysql-test/r/rpl_row_basic_11bugs.result 2006-09-06 17:45:34 +02:00
@@ -60,3 +60,43 @@
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;
--- 1.8/mysql-test/t/rpl_row_basic_11bugs.test 2006-09-06 17:45:34 +02:00
+++ 1.9/mysql-test/t/rpl_row_basic_11bugs.test 2006-09-06 17:45:34 +02:00
@@ -54,3 +54,43 @@
--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;
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.2257) BUG#17620 | Mats Kindahl | 6 Sep |