List:Commits« Previous MessageNext Message »
From:guilhem Date:July 3 2006 4:51pm
Subject:bk commit into 5.1 tree (guilhem:1.2232) BUG#18590
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of guilhem. When guilhem 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
  1.2232 06/07/03 16:51:05 guilhem@stripped +4 -0
  (new fresh commit, had forgotten one file in the previous cset)
  Fix for BUG#20649 "mixed replication mode does not work with INSERT DELAYED".
  The bug was that if the server was running in mixed binlogging mode,
  and an INSERT DELAYED used some needing-row-based components like UUID(),
  the server didn't binlog this row-based but statement-based.
  As the delayed_insert thread does some grouping of rows, some could need
  row-based and some others, but the generation of row-based table map events
  happens early (before locking the tables), we cannot easily binlog some
  rows statement-based and some other row-based.
  So this changeset implements that when a delayed_insert thread is created,
  if the server's global binlog mode is "mixed", that thread will use row-based.
  To test this, we re-enable rpl_switch_stm_row_mixed.test (so BUG#18590
  which was about re-enabling this test, will be closed).
  Between when it was disabled and now, some good changes to row-based
  binlogging (no generation of table map events for non-changed tables)
  induce changes in the test's result file.

  sql/sql_insert.cc
    1.208 06/07/03 16:50:56 guilhem@stripped +14 -0
    In mixed binlogging mode, the delayed_insert system thread now always
    uses row-based binlogging.

  mysql-test/t/rpl_switch_stm_row_mixed.test
    1.5 06/07/03 16:50:56 guilhem@stripped +7 -0
    testing fix to make INSERT DELAYED work in mixed mode

  mysql-test/t/disabled.def
    1.171 06/07/03 16:50:56 guilhem@stripped +0 -1
    this test works now

  mysql-test/r/rpl_switch_stm_row_mixed.result
    1.6 06/07/03 16:50:56 guilhem@stripped +17 -7
    result update.
    Note that some pieces of binlog are gone, not due to my test but to changes
    to the row-based binlogging code (non-changed tables don't generate
    table map binlog events now) done while the test was disabled.

# 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:	guilhem
# Host:	gbichot3.local
# Root:	/home/mysql_src/mysql-5.1

--- 1.207/sql/sql_insert.cc	2006-07-01 06:19:16 +02:00
+++ 1.208/sql/sql_insert.cc	2006-07-03 16:50:56 +02:00
@@ -1290,6 +1290,20 @@
     thd.command=COM_DELAYED_INSERT;
     thd.lex->current_select= 0; 		// for my_message_sql
     thd.lex->sql_command= SQLCOM_INSERT;        // For innodb::store_lock()
+#ifdef HAVE_ROW_BASED_REPLICATION
+    /*
+      In mixed binlogging mode, some rows may require row-based, some would
+      be ok with statement-based.  But if the two types are in the same
+      bunch, given that the generation of row-based table map events happens
+      at table locking time, we would have to analyze the bunch before
+      locking the table, to know if at least one row need row-based. Or we
+      would have, when we queue a row, to be sure to create a new bunch if
+      the row must be row-based and the others ones in the queue were
+      statement-based. This is complicated, so we simply say that in mixed
+      binlogging mode, the delayed inserts always happen in row-based.
+    */
+    thd.set_current_stmt_binlog_row_based_if_mixed();
+#endif
 
     bzero((char*) &thd.net, sizeof(thd.net));		// Safety
     bzero((char*) &table_list, sizeof(table_list));	// Safety

--- 1.5/mysql-test/r/rpl_switch_stm_row_mixed.result	2006-03-13 15:34:15 +01:00
+++ 1.6/mysql-test/r/rpl_switch_stm_row_mixed.result	2006-07-03 16:50:56 +02:00
@@ -142,12 +142,20 @@
 ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
 select * from t1 where a="alarm";
 a
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+Warnings:
+Warning	1265	Data truncated for column 'UUID()' at row 1
+insert delayed into t2 values("delay_3_"),(concat("delay_4_",UUID())),("delay_5_");
+Warnings:
+Warning	1265	Data truncated for column 'UUID()' at row 2
+insert delayed into t2 values("delay_6_");
 select count(*) from t1;
 count(*)
 36
 select count(*) from t2;
 count(*)
-1
+7
 select count(*) from t3;
 count(*)
 2
@@ -160,8 +168,6 @@
 show binlog events from 102;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	drop database if exists mysqltest1
-master-bin.000001	#	Table_map	1	#	table_id: # (mysql.proc)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	1	#	create database mysqltest1
 master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
 master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
@@ -178,10 +184,6 @@
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values("work")
 master-bin.000001	#	User var	1	#	@`string`=_latin1 0x656D657267656E6379 COLLATE
latin1_swedish_ci
 master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 select @'string'
@@ -268,5 +270,13 @@
 master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t1)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t2)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t2)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t2)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	1	#	table_id: # (mysqltest1.t2)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 drop database mysqltest1;

--- 1.4/mysql-test/t/rpl_switch_stm_row_mixed.test	2006-03-13 15:34:15 +01:00
+++ 1.5/mysql-test/t/rpl_switch_stm_row_mixed.test	2006-07-03 16:50:56 +02:00
@@ -154,6 +154,13 @@
 select foo3();
 select * from t1 where a="alarm";
 
+# Test that INSERT DELAYED works in mixed mode
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_3_"),(concat("delay_4_",UUID())),("delay_5_");
+insert delayed into t2 values("delay_6_");
+sleep 4; # time for the delayed insert to reach disk
+
 # If you want to do manual testing of the mixed mode regarding UDFs (not
 # testable automatically as quite platform- and compiler-dependent),
 # you just need to set the variable below to 1, and to

--- 1.170/mysql-test/t/disabled.def	2006-06-27 01:38:38 +02:00
+++ 1.171/mysql-test/t/disabled.def	2006-07-03 16:50:56 +02:00
@@ -32,7 +32,6 @@
 rpl_ndb_innodb2ndb       : Bug #19710  Cluster replication to partition table fails on
DELETE FROM statement
 #rpl_ndb_log              : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create
table and insert (on different table) not determ
 rpl_ndb_myisam2ndb       : Bug #19710  Cluster replication to partition table fails on
DELETE FROM statement
-rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian
 rpl_row_blob_innodb      : BUG#18980 2006-04-10 kent    Test fails randomly
 rpl_row_func003          : BUG#19074 2006-13-04 andrei  test failed
 rpl_sp                   : BUG#16456 2006-02-16 jmiller
Thread
bk commit into 5.1 tree (guilhem:1.2232) BUG#18590guilhem3 Jul