List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:January 3 2006 9:10pm
Subject:bk commit into 5.1 tree (mkindahl:1.2027) BUG#15923
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mkindahl. When mkindahl 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.2027 06/01/03 22:09:55 mkindahl@stripped +3 -0
  Bug#15923 (Test ps_7ndb cause master crash):
    Always logging statements of the form "DELETE FROM x" statement-based.

  sql/sql_delete.cc
    1.167 06/01/03 22:07:00 mkindahl@stripped +21 -3
    Logging statements of the form "DELETE FROM x" statement-based.

  mysql-test/t/disabled.def
    1.29 06/01/03 22:07:00 mkindahl@stripped +1 -1
    Enabling test ps_7ndb

  mysql-test/r/binlog_row_mix_innodb_myisam.result
    1.2 06/01/03 22:07:00 mkindahl@stripped +17 -16
    Result change.

# 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:	mkindahl
# Host:	dl145h.mysql.com
# Root:	/users/mkindahl/bk/b15923-mysql-5.1-new

--- 1.166/sql/sql_delete.cc	2005-12-31 05:54:34 +01:00
+++ 1.167/sql/sql_delete.cc	2006-01-03 22:07:00 +01:00
@@ -41,6 +41,7 @@
   uint usable_index= MAX_KEY;
   SELECT_LEX   *select_lex= &thd->lex->select_lex;
   bool          ha_delete_row_bypassed= 0;
+  bool          ha_delete_all_rows= 0;
   DBUG_ENTER("mysql_delete");
 
   if (open_and_lock_tables(thd, table_list))
@@ -79,6 +80,7 @@
       !(table->triggers && table->triggers->has_delete_triggers()))
   {
     ha_rows const maybe_deleted= table->file->records;
+    ha_delete_all_rows= 1;
     if (!(error=table->file->delete_all_rows()))
     {
       error= -1;				// ok
@@ -200,6 +202,15 @@
   init_ftfuncs(thd, select_lex, 1);
   thd->proc_info="updating";
   will_batch= !table->file->start_bulk_delete();
+
+  /*
+    Save the thread options before clearing the OPTION_BIN_LOG,
+    effectively disabling the binary log.
+  */
+  ulonglong const saved_options= thd->options;
+  if (ha_delete_all_rows)
+    thd->options&= ~static_cast<ulonglong>(OPTION_BIN_LOG);
+
   while (!(error=info.read_record(&info)) && !thd->killed &&
 	 !thd->net.report_error)
   {
@@ -290,6 +301,13 @@
 
   delete select;
   transactional_table= table->file->has_transactions();
+
+  /*
+    Restore the saved value of the OPTION_BIN_LOG bit in the thread
+    options before executing binlog_query() below.
+  */
+  thd->options|= (saved_options & OPTION_BIN_LOG);
+
   /* See similar binlogging code in sql_update.cc, for comments */
   if ((error < 0) || (deleted && !transactional_table))
   {
@@ -304,9 +322,9 @@
         delete specific rows which we might log row-based.
       */
       THD::enum_binlog_query_type const
-          query_type(ha_delete_row_bypassed ?
-                     THD::STMT_QUERY_TYPE :
-                     THD::ROW_QUERY_TYPE);
+	query_type(ha_delete_all_rows ?
+		   THD::STMT_QUERY_TYPE :
+		   THD::ROW_QUERY_TYPE);
       int log_result= thd->binlog_query(query_type,
                                         thd->query, thd->query_length,
                                         transactional_table, FALSE);

--- 1.28/mysql-test/t/disabled.def	2005-12-22 11:09:40 +01:00
+++ 1.29/mysql-test/t/disabled.def	2006-01-03 22:07:00 +01:00
@@ -23,5 +23,5 @@
 subselect       : Bug#15706
 type_time       : Bug#15805
 #rpl000002       : Bug#15920 Temporary tables are not binlogged in SBR
-ps_7ndb         : Bug#15923 Core dump in RBR mode when executing test suite
+#ps_7ndb         : Bug#15923 Core dump in RBR mode when executing test suite
 sp_trans        : Bug#15924 Code dump in RBR mode when executing test suite

--- 1.1/mysql-test/r/binlog_row_mix_innodb_myisam.result	2005-12-22 06:34:51 +01:00
+++ 1.2/mysql-test/r/binlog_row_mix_innodb_myisam.result	2006-01-03 22:07:00 +01:00
@@ -262,21 +262,22 @@
 master-bin.000001	243	Table_map	1	#	test.t1
 master-bin.000001	282	Write_rows	1	#	
 master-bin.000001	316	Xid	1	#	COMMIT /* xid= */
-master-bin.000001	343	Table_map	1	#	test.t1
-master-bin.000001	382	Delete_rows	1	#	
-master-bin.000001	421	Xid	1	#	COMMIT /* xid= */
-master-bin.000001	448	Query	1	#	use `test`; alter table t2 type=MyISAM
-master-bin.000001	537	Table_map	1	#	test.t1
-master-bin.000001	576	Write_rows	1	#	
-master-bin.000001	610	Xid	1	#	COMMIT /* xid= */
-master-bin.000001	637	Table_map	1	#	test.t2
-master-bin.000001	676	Write_rows	1	#	
-master-bin.000001	710	Query	1	#	use `test`; drop table t1,t2
-master-bin.000001	789	Query	1	#	use `test`; create table t0 (n int)
-master-bin.000001	875	Table_map	1	#	test.t0
-master-bin.000001	914	Write_rows	1	#	
-master-bin.000001	948	Table_map	1	#	test.t0
-master-bin.000001	987	Write_rows	1	#	
-master-bin.000001	1021	Query	1	#	use `test`; create table t2 (n int) engine=innodb
+master-bin.000001	343	Query	1	#	use `test`; delete from t1
+master-bin.000001	420	Xid	1	#	COMMIT /* xid= */
+master-bin.000001	447	Query	1	#	use `test`; delete from t2
+master-bin.000001	524	Xid	1	#	COMMIT /* xid= */
+master-bin.000001	551	Query	1	#	use `test`; alter table t2 type=MyISAM
+master-bin.000001	640	Table_map	1	#	test.t1
+master-bin.000001	679	Write_rows	1	#	
+master-bin.000001	713	Xid	1	#	COMMIT /* xid= */
+master-bin.000001	740	Table_map	1	#	test.t2
+master-bin.000001	779	Write_rows	1	#	
+master-bin.000001	813	Query	1	#	use `test`; drop table t1,t2
+master-bin.000001	892	Query	1	#	use `test`; create table t0 (n int)
+master-bin.000001	978	Table_map	1	#	test.t0
+master-bin.000001	1017	Write_rows	1	#	
+master-bin.000001	1051	Table_map	1	#	test.t0
+master-bin.000001	1090	Write_rows	1	#	
+master-bin.000001	1124	Query	1	#	use `test`; create table t2 (n int) engine=innodb
 do release_lock("lock1");
 drop table t0,t2;
Thread
bk commit into 5.1 tree (mkindahl:1.2027) BUG#15923Mats Kindahl3 Jan