List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:March 21 2005 6:25pm
Subject:bk commit into 5.1 tree (mats:1.1796)
View as plain text  
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
  1.1796 05/03/21 19:25:00 mats@stripped +49 -0
  WL#1012: row-level binary logging
    Using bitvectors instead of arrays.
    Split row-event functionality over handler, MYSQL_LOG, and THD.
    Adaptions to support injector.
  WL#2324: Injector interface to MySQL server
    Injector hooked up to mysql server internal.
    There are some outstanding issues, but it should work.

  sql/sql_union.cc
    1.114 05/03/21 19:24:56 mats@stripped +1 -1
    Calling ha_write_row instead of write_row

  sql/sql_class.h
    1.224 05/03/21 19:24:56 mats@stripped +26 -3
    Moved pending events to THD structure (now together with cached events).

  sql/sql_class.cc
    1.171 05/03/21 19:24:56 mats@stripped +125 -0
    Moved pending events to THD structure (now together with cached events).

  sql/rpl_injector.h
    1.5 05/03/21 19:24:56 mats@stripped +39 -12
    Injector now hooked up to mysql server.

  sql/rpl_injector.cc
    1.5 05/03/21 19:24:56 mats@stripped +51 -19
    Injector now hooked up to mysql server.

  sql/slave.h
    1.87 05/03/21 19:24:55 mats@stripped +7 -10
    Moved table map to MYSQL_LOG.

  sql/slave.cc
    1.242 05/03/21 19:24:55 mats@stripped +2 -82
    Moved table map to MYSQL_LOG.

  sql/log_event.h
    1.106 05/03/21 19:24:55 mats@stripped +27 -21
    Switched to using bitvector instead of array.
    Using table map in MYSQL_LOG to get table id:s.

  sql/log_event.cc
    1.167 05/03/21 19:24:55 mats@stripped +96 -106
    Switched to using bitvector instead of array.
    Using table map in MYSQL_LOG to get table id:s.

  sql/log.cc
    1.154 05/03/21 19:24:55 mats@stripped +35 -9
    Added table_mapping to binary log.

  sql/handler.h
    1.131 05/03/21 19:24:55 mats@stripped +24 -116
    Switched to using bitvector instead of array
    Moved pending_events to THD structure.

  sql/handler.cc
    1.145 05/03/21 19:24:55 mats@stripped +114 -123
    Switched to using bitvector instead of array
    Moved pending_events to THD structure.

  sql/Makefile.am
    1.104 05/03/21 19:24:55 mats@stripped +5 -2
    Added rpl_injector, rpl_tblmap, and bitvector.

  mysql-test/t/rpl_row_trans.test
    1.2 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/t/rpl_row_basic.test
    1.2 05/03/21 19:24:55 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/t/rpl_multi_query.test
    1.5 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/t/rpl_deadlock.test
    1.3 05/03/21 19:24:55 mats@stripped +2 -2
    Updated binlog positions

  mysql-test/t/binlog.test
    1.4 05/03/21 19:24:55 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/r/user_var.result
    1.29 05/03/21 19:24:55 mats@stripped +6 -6
    Updated binlog positions

  mysql-test/r/rpl_user_variables.result
    1.15 05/03/21 19:24:55 mats@stripped +29 -29
    Updated binlog positions

  mysql-test/r/rpl_until.result
    1.21 05/03/21 19:24:55 mats@stripped +19 -19
    Updated binlog positions

  mysql-test/r/rpl_timezone.result
    1.9 05/03/21 19:24:55 mats@stripped +7 -7
    Updated binlog positions

  mysql-test/r/rpl_temporary.result
    1.18 05/03/21 19:24:55 mats@stripped +13 -13
    Updated binlog positions

  mysql-test/r/rpl_server_id2.result
    1.9 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_server_id1.result
    1.8 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_row_basic.result
    1.2 05/03/21 19:24:55 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/r/rpl_rotate_logs.result
    1.67 05/03/21 19:24:55 mats@stripped +4 -4
    Updated binlog positions

  mysql-test/r/rpl_reset_slave.result
    1.14 05/03/21 19:24:55 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/r/rpl_replicate_do.result
    1.29 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_relayrotate.result
    1.17 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_multi_query.result
    1.4 05/03/21 19:24:55 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_max_relay_size.result
    1.20 05/03/21 19:24:55 mats@stripped +6 -6
    Updated binlog positions

  mysql-test/r/rpl_log_pos.result
    1.43 05/03/21 19:24:55 mats@stripped +10 -10
    Updated binlog positions

  mysql-test/r/rpl_log.result
    1.57 05/03/21 19:24:54 mats@stripped +51 -51
    Updated binlog positions

  mysql-test/r/rpl_loaddata_rule_s.result
    1.8 05/03/21 19:24:54 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_loaddata_rule_m.result
    1.14 05/03/21 19:24:54 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/r/rpl_loaddata.result
    1.28 05/03/21 19:24:54 mats@stripped +4 -4
    Updated binlog positions

  mysql-test/r/rpl_flush_tables.result
    1.12 05/03/21 19:24:54 mats@stripped +17 -17
    Updated binlog positions

  mysql-test/r/rpl_flush_log_loop.result
    1.23 05/03/21 19:24:54 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_error_ignored_table.result
    1.20 05/03/21 19:24:54 mats@stripped +11 -11
    Updated binlog positions

  mysql-test/r/rpl_deadlock.result
    1.3 05/03/21 19:24:54 mats@stripped +5 -5
    Updated binlog positions

  mysql-test/r/rpl_charset.result
    1.19 05/03/21 19:24:54 mats@stripped +1 -1
    Updated binlog positions

  mysql-test/r/rpl_change_master.result
    1.17 05/03/21 19:24:54 mats@stripped +2 -2
    Updated binlog positions

  mysql-test/r/rpl000015.result
    1.35 05/03/21 19:24:54 mats@stripped +2 -2
    Updated binlog positions

  mysql-test/r/mysqlbinlog.result
    1.16 05/03/21 19:24:54 mats@stripped +0 -5
    Updated binlog positions

  mysql-test/r/mix_innodb_myisam_binlog.result
    1.21 05/03/21 19:24:54 mats@stripped +62 -62
    Updated binlog positions

  mysql-test/r/insert_select.result
    1.27 05/03/21 19:24:54 mats@stripped +3 -3
    Updated binlog positions

  mysql-test/r/ctype_ucs.result
    1.32 05/03/21 19:24:54 mats@stripped +3 -3
    Updated binlog positions

  client/Makefile.am
    1.46 05/03/21 19:24:54 mats@stripped +1 -1
    Added bitvector.h

  sql/rpl_injector.h
    1.4 05/03/21 19:07:48 mats@stripped +0 -0
    Rename: sql/injector.h -> sql/rpl_injector.h

  sql/rpl_injector.cc
    1.4 05/03/21 19:07:43 mats@stripped +0 -0
    Rename: sql/injector.cc -> sql/rpl_injector.cc

# 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.kindahl.net
# Root:	/home/bk/w1012-mysql-5.1

--- 1.45/client/Makefile.am	2005-02-08 23:49:31 +01:00
+++ 1.46/client/Makefile.am	2005-03-21 19:24:54 +01:00
@@ -34,7 +34,7 @@
 mysqltest_LDADD =		$(top_builddir)/regex/libregex.a $(LDADD)
 mysqlbinlog_SOURCES =   mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c
 mysqlmanagerc_SOURCES =   mysqlmanagerc.c 
-sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
+sql_src=bitvector.h log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
 strings_src=decimal.c
 
 # Fix for mit-threads

--- 1.103/sql/Makefile.am	2005-03-16 13:18:04 +01:00
+++ 1.104/sql/Makefile.am	2005-03-21 19:24:55 +01:00
@@ -49,12 +49,14 @@
 			mysql_priv.h item_geofunc.h sql_bitmap.h \
 			procedure.h sql_class.h sql_lex.h sql_list.h \
 			sql_manager.h sql_map.h sql_string.h unireg.h \
-			field.h handler.h injector.h mysqld_suffix.h \
+			field.h handler.h mysqld_suffix.h \
 			ha_myisammrg.h\
+	                rpl_tblmap.h rpl_injector.h \
 			ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \
 			ha_ndbcluster.h opt_range.h protocol.h \
 			sql_select.h structs.h table.h sql_udf.h hash_filo.h\
 			lex.h lex_symbol.h sql_acl.h sql_crypt.h  \
+	                bitvector.h \
 			log_event.h sql_repl.h slave.h \
 			stacktrace.h sql_sort.h sql_cache.h set_var.h \
 			spatial.h gstream.h client_settings.h tzfile.h \
@@ -83,7 +85,8 @@
 			log.cc log_event.cc init.cc derror.cc sql_acl.cc \
 			unireg.cc des_key_file.cc \
 			discover.cc time.cc opt_range.cc opt_sum.cc \
-		   	records.cc filesort.cc handler.cc injector.cc \
+		   	records.cc filesort.cc handler.cc \
+	                rpl_tblmap.cc rpl_injector.cc \
 		        ha_heap.cc ha_myisam.cc ha_myisammrg.cc \
 	                ha_berkeley.cc ha_innodb.cc \
 			ha_ndbcluster.cc \

--- 1.144/sql/handler.cc	2005-03-14 14:53:47 +01:00
+++ 1.145/sql/handler.cc	2005-03-21 19:24:55 +01:00
@@ -25,6 +25,7 @@
 #include "ha_heap.h"
 #include "ha_myisam.h"
 #include "ha_myisammrg.h"
+#include "bitvector.h"
 #ifdef HAVE_ISAM
 #include "ha_isam.h"
 #include "ha_isammrg.h"
@@ -2257,30 +2258,110 @@
   return &known_extensions;
 }
 
-/**************************************************************************
-	Pending_rows_events member functions
-**************************************************************************/
-
-int Pending_rows_events::
-set(THD* thd, Rows_log_event* ev) 
+int handler::
+ha_write_row(byte *buf) 
 {
-  DBUG_ENTER("Pending_rows_events::set(THD*, Rows_log_event*)");
-  thd->transaction.m_pending_rows_event = ev;
-  DBUG_RETURN(0);		// Ok
+  DBUG_ENTER("ha_write_row");
+  DBUG_PRINT("enter", ("row: 0x%0x", buf));
+#ifndef DBUG_OFF
+  THD* thd = current_thd;
+  DBUG_PRINT("info", ("thd->query_id=%lu", thd->query_id));
+  for (size_t i = 0 ; i < table->s->fields ; ++i) 
+  {
+    DBUG_PRINT("info", ("Field '%s': query_id=%lu, offset=%d, ptr=%p",
+			table->field[i]->field_name,
+			table->field[i]->query_id,
+			table->field[i]->offset(),
+			table->field[i]->ptr));
+  }
+#endif
+  if (int error = write_row(buf)) {
+    DBUG_PRINT("exit", ("error = %d", error));
+    DBUG_RETURN(error);
+  }
+  bitvector const bv(table->s->fields, true);
+  m_row_writer.write_row(bv, buf);
+  DBUG_PRINT("exit", ("error = %d", 0));
+  DBUG_RETURN(0);
 }
-
-Rows_log_event* Pending_rows_events::
-get(THD* thd) const 
+  
+int handler::
+ha_update_row(const byte *old_data, byte *new_data) 
+{
+  DBUG_ENTER("ha_update_row");
+  DBUG_PRINT("enter", ("before: 0x%0x; after: 0x%0x", old_data, new_data));
+#ifndef DBUG_OFF
+  THD* thd = current_thd;
+  DBUG_PRINT("info", ("thd->query_id=%lu", thd->query_id));
+  for (size_t i = 0 ; i < table->s->fields ; ++i) 
+  {
+    DBUG_PRINT("info", ("Field '%s': query_id=%lu, offset=%d, ptr=%p",
+			table->field[i]->field_name,
+			table->field[i]->query_id,
+			table->field[i]->offset(),
+			table->field[i]->ptr));
+  }
+#endif
+  if (int error = update_row(old_data, new_data)) {
+    DBUG_PRINT("exit", ("error = %d", error));
+    DBUG_RETURN(error);
+  }
+  bitvector const cols(table->s->fields, true);
+  m_row_writer.update_row(cols, old_data, new_data);
+  DBUG_PRINT("exit", ("error = %d", 0));
+  DBUG_RETURN(0);
+}
+  
+int handler::
+ha_delete_row(const byte *buf) 
 {
-  DBUG_ENTER("Pending_rows_events::get(THD*)");
-  Rows_log_event* ev = thd->transaction.m_pending_rows_event;
-  DBUG_RETURN(ev);
+  DBUG_ENTER("ha_delete_row");
+  DBUG_PRINT("enter", ("row: 0x%0x", buf));
+#ifndef DBUG_OFF
+  THD* thd = current_thd;
+  DBUG_PRINT("info", ("thd->query_id=%lu", thd->query_id));
+  for (size_t i = 0 ; i < table->s->fields ; ++i) 
+  {
+    DBUG_PRINT("info", ("Field '%s': query_id=%lu, offset=%d, ptr=%p",
+			table->field[i]->field_name,
+			table->field[i]->query_id,
+			table->field[i]->offset(),
+			table->field[i]->ptr));
+  }
+#endif
+  if (int error = delete_row(buf)) {
+    DBUG_PRINT("exit", ("error = %d", error));
+    DBUG_RETURN(error);
+  }
+  bitvector const cols(table->s->fields, true);
+  m_row_writer.delete_row(cols, buf);
+  DBUG_PRINT("exit", ("error = %d", 0));
+  DBUG_RETURN(0);
+}    
+  
+int handler::
+ha_stmt_begin() 
+{ 
+  return m_row_writer.transaction_begin(); 
 }
 
+int handler::
+ha_stmt_end()
+{ 
+  return m_row_writer.transaction_end(); 
+}
+
+
 /**************************************************************************
 	Row_rw_base member functions
 **************************************************************************/
 
+Row_rw_base::
+Row_rw_base(THD *thd, TABLE *table)
+  : m_thd(thd), m_table(table)
+{ 
+}
+
 size_t Row_rw_base::
 max_row_length(const byte * const record) const
 {
@@ -2335,108 +2416,13 @@
 	Row_writer member functions
 **************************************************************************/
 
-extern ulong opt_binlog_rows_event_max_size;
-
-/*
-  Template member function for ensuring that there is an rows log
-  event of the apropriate type before proceeding.
-
-  PRE CONDITION:
-    - Events of type 'RowEventT' have the type code 'type_code'.
-    
-  POST CONDITION:
-    If a non-NULL pointer is returned, the pending event for thread
-    'thd' will be an event of type 'RowEventT' (which have the type
-    code 'type_code') will either empty or have enough space to hold
-    'needed' bytes.
- */
-
-template <class RowsEventT>
-Rows_log_event* Row_writer::
-prepare_pending(THD* thd, size_t needed) 
-{
-  // Fetch the type code for the RowsEventT template parameter
-  int const type_code = RowsEventT::TYPE_CODE;
-
-  Rows_log_event* pending = m_pending.get(thd);
-  DBUG_ENTER("Row_writer::prepare_pending<RowsEventT>(THD*,size_t)");
-  DBUG_PRINT("enter", ("type_code=%d, needed=%d", type_code, needed));
-
-  if (pending) 
-  {
-      DBUG_PRINT("info", ("pending=0x%08x [type_code=%d, size=%d]",
-			  pending, 
-			  pending->get_type_code(),
-			  pending->get_data_size()));
-  }
-  else 
-  {
-      DBUG_PRINT("info", ("pending=0x%08x", pending));
-  }
-
-  DBUG_PRINT("info", ("opt_binlog_rows_event_max_size=%d", 
-		      opt_binlog_rows_event_max_size));
-
-  // Check if the current event is non-NULL and a write-rows event. 
-  if (!pending
-      || pending->get_type_code() != type_code
-      || pending->get_data_size() + needed > opt_binlog_rows_event_max_size) 
-  {
-    // If not, flush the event and create a new Write_rows_log_event.
-    Rows_log_event* ev = new RowsEventT(thd, m_table, m_tid, m_has_trans);
-    if (flush_and_set_event(thd, ev))
-      DBUG_RETURN(NULL);
-    DBUG_RETURN(ev);
-  }
-  DBUG_RETURN(pending);
-}
-
-/*
-  Instansiate the versions we need, we have -fno-implicit-template as
-  compiling option.
-*/
-
-template Rows_log_event* Row_writer::
-prepare_pending<Write_rows_log_event>(THD*, size_t);
-
-template Rows_log_event* Row_writer::
-prepare_pending<Delete_rows_log_event>(THD*, size_t);
-
-template Rows_log_event* Row_writer::
-prepare_pending<Update_rows_log_event>(THD*, size_t);
-
 
 int Row_writer::
-flush_and_set_event(THD* thd, Rows_log_event* event)
-{
-  DBUG_ENTER("Row_writer::flush_and_set_event");
-  DBUG_PRINT("enter", ("thd = 0x%0x (%s event)", 
-		       thd, 
-		       (event ? event->get_type_str() : "No")));
-
-  DBUG_ASSERT(opt_binlog_row_level);
-  DBUG_ASSERT(mysql_bin_log.is_open());
-  
-  if (Rows_log_event* pending = m_pending.get(thd)) {
-    if (mysql_bin_log.write(pending)) {
-      DBUG_PRINT("exit", ("1"));
-      DBUG_RETURN(1);		// Something failed
-    }
-
-    delete pending;
-  }
-
-  m_pending.set(thd, event);
-
-  DBUG_PRINT("exit", ("0"));
-  DBUG_RETURN(0);		// All OK
-}
-
-int Row_writer::
-write_row(byte const *record) 
+write_row(bitvector const& cols, byte const *record) 
 { 
   DBUG_ENTER("Row_writer::write_row");
-  DBUG_PRINT("enter", ("record = 0x%0x", record));
+  DBUG_PRINT("enter", ("cols = { size: %d, data = %p }; record = %p", 
+		       cols.size(), cols.data(), record));
 
   if (!opt_binlog_row_level || !mysql_bin_log.is_open())
     DBUG_RETURN(0);
@@ -2452,21 +2438,22 @@
   size_t const len     = pack_row(row_data, max_len, record);
 
   Rows_log_event* const
-    ev = prepare_pending<Write_rows_log_event>(thd, len);
+    ev = thd->prepare_pending<Write_rows_log_event>(m_table, m_server_id, cols, len);
 
   if (ev == NULL)
     DBUG_RETURN(1);
 
+  // add_row_data copies row_data to internal buffer
   ev->add_row_data(row_data,len);
 
-  // add_row_data copies row_data to internal buffer
   my_free(row_data, MYF(MY_WME));
 
   DBUG_RETURN(0);
 }
 
 int Row_writer::
-update_row(const byte *before_record, const byte *after_record)
+update_row(bitvector const& cols,
+	   const byte *before_record, const byte *after_record)
 { 
   DBUG_ENTER("Row_writer::update_row");
   DBUG_PRINT("enter", ("before: 0x%0x; after: 0x%0x", 
@@ -2490,7 +2477,9 @@
   size_t const after_size = pack_row(after_row, after_maxlen, after_record);
   
   Rows_log_event* const
-    ev = prepare_pending<Update_rows_log_event>(thd, before_size + after_size);
+    ev = thd->prepare_pending<Update_rows_log_event>(m_table, 
+						     m_server_id, cols, 
+						     before_size + after_size);
 
   if (ev == NULL)
     DBUG_RETURN(1);
@@ -2506,7 +2495,7 @@
 }
 
 int Row_writer::
-delete_row(byte const *record)
+delete_row(bitvector const& cols, byte const *record)
 { 
   DBUG_ENTER("Row_writer::delete_row");
   DBUG_PRINT("enter", ("record = 0x%0x", record));
@@ -2525,7 +2514,8 @@
   size_t const len     = pack_row(row_data, max_len, record);
 
   Rows_log_event* const
-    ev = prepare_pending<Delete_rows_log_event>(thd, len);
+    ev = thd->prepare_pending<Delete_rows_log_event>(m_table, 
+						     m_server_id, cols, len);
 
   if (ev == NULL)
     DBUG_RETURN(1);
@@ -2546,8 +2536,9 @@
     DBUG_RETURN(0);
 
   THD* const thd = current_thd;
-  Table_map_log_event ev(thd, m_table, m_tid, m_has_trans);
-  if (mysql_bin_log.write(&ev))
+  ulong table_id = mysql_bin_log.get_table_id(m_table);
+  Table_map_log_event the_event(thd, m_table, table_id, m_has_trans);
+  if (mysql_bin_log.write(&the_event))
     DBUG_RETURN(1);
   DBUG_RETURN(0);
 }
@@ -2566,12 +2557,12 @@
     set. 
   */
   if (stmt_end) {
-    if (Rows_log_event* pending = m_pending.get(thd)) {
+    if (Rows_log_event* pending = thd->get_pending_event()) {
       pending->set_flags(Rows_log_event::STMT_END_F);
     }
   }
   
   DBUG_PRINT("flush", ("thd = 0x%0x", thd));
-  int const error = flush_and_set_event(thd, 0);
+  int const error = thd->flush_and_set_pending_event(0);
   DBUG_RETURN(error);
 }

--- 1.130/sql/handler.h	2005-03-14 15:07:16 +01:00
+++ 1.131/sql/handler.h	2005-03-21 19:24:55 +01:00
@@ -150,6 +150,9 @@
 /* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
 #define MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
 
+// Forward declarations
+class bitvector;
+
 enum db_type
 {
   DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
@@ -418,12 +421,7 @@
 
 class Row_rw_base {
 public:
-  typedef uint16 table_id;
-
-  Row_rw_base(THD *thd, TABLE *table)
-    : m_thd(thd), m_table(table), m_tid(4711 /* !!! dummy table id !!! */)
-  { 
-  }
+  Row_rw_base(THD *thd, TABLE *table);
 
   virtual ~Row_rw_base() { }
 
@@ -434,36 +432,10 @@
 protected:
   // These are declared 'const' since you're not supposed to change
   // them for the lifetime of the object.
-  THD      *const m_thd;
-  TABLE    *const m_table;
-  table_id  const m_tid;
-};
-
-
-/*****************************************************************************
-
- Pending rows event class
-
- RESPONSIBILITIES
-
-     The pending rows event class will keep track of the pending rows
-     events based on the thread id. 
-
-     One pending event will be available for each thread.
-
- COLLABORATION
-
-     THD
-
- *****************************************************************************/
-
-class Pending_rows_events {
-public:
-  Rows_log_event* get(THD* thd) const;
-  int             set(THD* thd, Rows_log_event* ev);
+  THD   *const m_thd;
+  TABLE *const m_table;
 };
 
-
 /*****************************************************************************
 
   Row event writer class.
@@ -502,18 +474,20 @@
 
   ~Row_writer() {}
  
-  /* Get table id for a table */
-  table_id get_table_id(TABLE* tbl) const;
+  int write_row(bitvector const& cols, 
+		const byte *buf);
+  int delete_row(bitvector const& cols, 
+		 const byte *buf);
+  int update_row(bitvector const& cols, 
+		 const byte *old_data, const byte *new_data);
 
-  int write_row(const byte *buf);
-  int update_row(const byte *old_data, const byte *new_data);
-  int delete_row(const byte *buf);
+  void set_server_id(uint32 sid) { m_server_id = sid; }
 
-  int stmt_begin() { 
+  int transaction_begin() { 
     return write_table_map(); 
   }
 
-  int stmt_end() { 
+  int transaction_end() { 
     return flush_pending_event(true); 
   }
 
@@ -521,41 +495,10 @@
   int flush_pending_event(bool stmt_end);
   int write_table_map();
 
-  int flush_and_set_event(THD*, Rows_log_event*);
-
-  template <class RowsEventT>
-    Rows_log_event* prepare_pending(THD* thd, size_t needed);
-
-  Pending_rows_events m_pending;
+  uint32 m_server_id;
   bool m_has_trans;
 };
 
-#if 0
-/*****************************************************************************
-
-  Row event reader class
-
-    The row event reader serves as a facade to the real row-level
-    events. It takes care of reading events from the binary log.
-
-  RESPONSIBILITIES
-
-  - keeping a mapping from tables to table ids
-  - unpacking rows into record format
-
- ****************************************************************************/
-
-class Row_reader : public Row_rw_base
-{
-public:
-  Row_reader(THD *thd, TABLE *table)
-    : Row_rw_base(thd, table)
-  { 
-  }
-
-  virtual ~Row_reader() {}
-};
-#endif
 
 class handler :public Sql_alloc
 {
@@ -696,50 +639,12 @@
   virtual int open(const char *name, int mode, uint test_if_locked)=0;
   virtual int close(void)=0;
 
-  int ha_write_row(byte *buf) 
-  {
-    DBUG_ENTER("ha_write_row");
-    DBUG_PRINT("enter", ("row: 0x%0x", buf));
-    if (int error = write_row(buf))
-      {
-	DBUG_PRINT("exit", ("error = %d", error));
-	DBUG_RETURN(error);
-      }
-    m_row_writer.write_row(buf);
-    DBUG_PRINT("exit", ("error = %d", 0));
-    DBUG_RETURN(0);
-  }
+  int ha_write_row(byte *buf);  
+  int ha_update_row(const byte *old_data, byte *new_data);
+  int ha_delete_row(const byte *buf);
   
-  int ha_update_row(const byte *old_data, byte *new_data) 
-  {
-    DBUG_ENTER("ha_update_row");
-    DBUG_PRINT("enter", ("before: 0x%0x; after: 0x%0x", old_data, new_data));
-    if (int error = update_row(old_data, new_data))
-      {
-	DBUG_PRINT("exit", ("error = %d", error));
-	DBUG_RETURN(error);
-      }
-    m_row_writer.update_row(old_data, new_data);
-    DBUG_PRINT("exit", ("error = %d", 0));
-    DBUG_RETURN(0);
-  }
-  
-  int ha_delete_row(const byte *buf) 
-  {
-    DBUG_ENTER("ha_delete_row");
-    DBUG_PRINT("enter", ("row: 0x%0x", buf));
-    if (int error = delete_row(buf))
-      {
-	DBUG_PRINT("exit", ("error = %d", error));
-	DBUG_RETURN(error);
-      }
-    m_row_writer.delete_row(buf);
-    DBUG_PRINT("exit", ("error = %d", 0));
-    DBUG_RETURN(0);
-  }    
-  
-  int ha_stmt_begin() { return m_row_writer.stmt_begin(); }
-  int ha_stmt_end() { return m_row_writer.stmt_end(); }
+  int ha_stmt_begin();
+  int ha_stmt_end();
 
   virtual int index_read(byte * buf, const byte * key,
 			 uint key_len, enum ha_rkey_function find_flag)
@@ -959,6 +864,9 @@
      Pops the top if condition stack, if stack is not empty
  */
  virtual void cond_pop() { return; };
+
+  // This is a temporary solution
+  Row_writer* row_writer() { return &m_row_writer; }
 
 private:
   /*

--- 1.153/sql/log.cc	2005-03-14 15:07:16 +01:00
+++ 1.154/sql/log.cc	2005-03-21 19:24:55 +01:00
@@ -346,8 +346,9 @@
 MYSQL_LOG::MYSQL_LOG()
   :bytes_written(0), last_time(0), query_start(0), name(0),
    file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
-   need_start_event(1), prepared_xids(0), description_event_for_exec(0),
-   description_event_for_queue(0)
+   need_start_event(1), prepared_xids(0), 
+   m_table_map(NULL), m_next_table_id(0), 
+   description_event_for_exec(0), description_event_for_queue(0)
 {
   /*
     We don't want to initialize LOCK_Log here as such initialization depends on
@@ -414,6 +415,7 @@
   no_auto_events = no_auto_events_arg;
   max_size=max_size_arg;
   DBUG_PRINT("info",("log_type: %d max_size: %lu", log_type, max_size));
+
   DBUG_VOID_RETURN;
 }
 
@@ -1588,15 +1590,16 @@
 
 #ifdef USING_TRANSACTIONS
     /*
-      Should we write to the binlog cache or to the binlog on disk?
-      Write to the binlog cache if:
-      - it is already not empty (meaning we're in a transaction; note that the
-     present event could be about a non-transactional table, but still we need
-     to write to the binlog cache in that case to handle updates to mixed
-     trans/non-trans table types the best possible in binlogging)
+      Should we write to the binlog cache or to the binlog on disk?  Write to
+      the binlog cache if the statement can be cached (can_be_cached() ==
+      true) and the binlog cache:
+      - is already not empty (meaning we're in a transaction; note that the
+        present event could be about a non-transactional table, but still we
+        need to write to the binlog cache in that case to handle updates to
+        mixed trans/non-trans table types the best possible in binlogging)
       - or if the event asks for it (cache_stmt == true).
     */
-    if (opt_using_transactions && thd)
+    if (opt_using_transactions && thd && event_info->can_be_cached())
     {
       IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot];
 
@@ -2297,6 +2300,29 @@
   DBUG_VOID_RETURN;
 }
 
+
+ulong MYSQL_LOG::
+get_table_id(TABLE* table)
+{
+  DBUG_ENTER("MYSQL_LOG::get_table_id(TABLE*)");
+  DBUG_PRINT("enter", ("table=%p", table)); 
+
+  // Have to create it here since it relies on my_malloc, which requires
+  // my_init() to have been executed prior to this.
+  if (m_table_map == NULL)
+    m_table_map = new table_mapping;
+
+  DBUG_ASSERT(m_table_map != NULL);
+  ulong tid = m_table_map->get_table_id(table);
+  if (tid == m_table_map->count()) {
+    // We can't use the number of tables in the list since the highest table
+    // id might be larger than the number of elements in the list. 
+    tid = m_next_table_id++;
+    m_table_map->set_table(tid, table);
+  }
+  DBUG_PRINT("return", ("table_id=%d", tid));
+  DBUG_RETURN(tid);
+}
 
 #ifdef __NT__
 void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,

--- 1.166/sql/log_event.cc	2005-03-14 15:07:16 +01:00
+++ 1.167/sql/log_event.cc	2005-03-21 19:24:55 +01:00
@@ -4454,21 +4454,21 @@
 
 #ifndef MYSQL_CLIENT
 Rows_log_event::
-Rows_log_event(THD* thd_arg, TABLE* tbl_arg, table_id tid, bool using_trans)
+Rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid, 
+	       bitvector const& cols, bool using_trans)
   : Log_event(thd_arg, 0, using_trans),
     m_dbnam(thd_arg->db), m_dblen(m_dbnam ? strlen(m_dbnam) : 0),
     m_table(tbl_arg), 
     m_tblnam(tbl_arg->s->table_name),
     m_tbllen(strlen(tbl_arg->s->table_name)),
     m_table_id(tid), 
-    m_width(tbl_arg->s->fields),
+    m_cols(cols),
     m_thread_id(thd_arg->thread_id),
     m_rows_buf(my_malloc(1024 * sizeof(*m_rows_buf), MYF(MY_WME))),
     m_rows_cur(m_rows_buf),
     m_rows_end(m_rows_buf + 1024),
     m_rows_flags(0)
 {
-  memset(m_cols, 0xFF, (m_width + 7)/8);
 }
 #endif
 
@@ -4497,18 +4497,22 @@
   byte const* const var_begin = post_begin + ROWS_HEADER_LEN;
 
   byte const* const ptr_width = var_begin;
-  m_width = *(unsigned char*) ptr_width;
-  DBUG_PRINT("info",("m_width=%d", m_width));
+  size_t const width = *reinterpret_cast<unsigned char const*>(ptr_width);
+  DBUG_PRINT("info",("width=%u", width));
 
-  const char* const ptr_rows_data = var_begin + (m_width + 7) / 8 + 1;
+  const char* const ptr_rows_data = var_begin + (width + 7) / 8 + 1;
 
   size_t const data_size = event_len - (ptr_rows_data - buf);
   DBUG_PRINT("info",("data_size=%lu", data_size));
 
   if ((m_rows_buf = my_malloc(data_size, MYF(0)))) 
   {
-    memcpy(m_cols, ptr_width + 1, (m_width + 7)/8);
-    DBUG_PRINT("info",("m_cols[0]=%lx", m_cols[0]));
+    // Construct a new bitvector of the right size with the data and swap the
+    // guts of it with the member variable.
+    bitvector cols(ptr_width + 1, width);
+    m_cols.swap(cols);
+
+    DBUG_PRINT("info",("*m_cols.data()=0x%lx", *m_cols.data() & 0xFF));
 
     m_rows_end = m_rows_buf + data_size;
     m_rows_cur = m_rows_end;
@@ -4561,29 +4565,14 @@
 
 #ifndef MYSQL_CLIENT
 /*
-  Get the value of the bit at position 'pos' in the array of bytes 'bits'.
-  Bit number 0 is the most significant bit of the byte 'bits[0]'.
-*/
-static inline bool 
-bitpos(byte* const bits, size_t const pos) 
-{
-  byte const mask = (1 << (7 - (pos % 8)));
-  if (bits[pos / 8] & mask)
-    return true;
-  else
-    return false;
-}
-
-/*
   Unpack a row into a record. The row is assumed to only consist of the fields
   for which the bitset represented by 'arr' and 'bits'; the other parts of the
   record are left alone.
  */
 static char const* 
-unpack_row(TABLE* table, 
-	   char* record, 
-	   char const* row, 
-	   byte *arr, size_t const bits)
+unpack_row(THD* thd, TABLE* table, 
+	   char* record, char const* row, 
+	   bitvector const& cols)
 {
   DBUG_ENTER("unpack_row(char* record, char const* row, TABLE* table)");
   DBUG_PRINT("enter", ("record = %p, row = %p, table = %p (%s)", 
@@ -4591,13 +4580,13 @@
   DBUG_PRINT("info", ("table->null_bytes = %d, table->fields = %d", 
 		      table->s->null_bytes, table->s->fields));
   DBUG_ASSERT(record && row);
+  DBUG_ASSERT(table->s->fields == cols.size());
   char const* ptr = row;
   memcpy(record, ptr, table->s->null_bytes);
   ptr += table->s->null_bytes;
   for (size_t i = 0 ; i < table->s->fields ; ++i) 
   {
-    DBUG_ASSERT(i < bits);
-    if (bitpos(arr,i)) {
+    if (cols.get_bit(i)) {
       int const offset = table->field[i]->offset();
       DBUG_PRINT("info", ("Unpacking length %d field '%s' from %p to %p + %d",
 			  table->field[i]->field_length, 
@@ -4617,28 +4606,29 @@
   'query_id' value of the field to the value of the 'query_id' field of the
   thread 'thd'.
 */
-static void 
-tag_new_fields(THD* thd, TABLE* table, byte *arr, size_t const bits)
+static inline void 
+tag_new_fields(THD* thd, TABLE* table, bitvector const& cols)
 {
+  DBUG_ENTER("tag_new_fields(THD*, TABLE*, byte*, size_t)");
+  DBUG_PRINT("info", ("Query id for thread is %lu", thd->query_id));    
+  DBUG_ASSERT(table->s->fields == cols.size());
   for (size_t i = 0 ; i < table->s->fields ; ++i) {
-    DBUG_ASSERT(i < bits);
-    if (bitpos(arr,i) == true) {
-#if 0
-      // This does not work currently, I've propably got something wrong.
-      DBUG_ASSERT(table->field[i]->query_id != thd->query_id);
-#endif
-      table->field[i]->query_id = thd->query_id;
-    }
-  }  
+    // ULONG_MAX is used to flag fields that are not used and whose value
+    // should be ignored. This is similar to how InnoDB flags the fields.
+    table->field[i]->query_id = cols.get_bit(i) ? thd->query_id : ULONG_MAX;
+    DBUG_PRINT("info", ("Query id for field '%s' is %lu",
+			table->field[i]->field_name,
+			table->field[i]->query_id));    
+  }
+  DBUG_VOID_RETURN;
 }
 
-
 int Rows_log_event::
 exec_event(st_relay_log_info* rli)
 {
   DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)");
   int error = 0;
-  TABLE* const table = rli->get_table(m_table_id);
+  TABLE* const table = rli->m_table_map.get_table(m_table_id);
   THD* const thd = current_thd;
   char const* row_start = m_rows_buf;
 
@@ -4646,11 +4636,10 @@
   while (error == 0 && row_start < m_rows_end) {
     DBUG_PRINT("info", ("row_start = %p, m_rows_end = %p", 
 			row_start, m_rows_end));
-    char const* row_end = do_prepare_row(table, row_start);
+    char const* row_end = do_prepare_row(thd, table, row_start);
     DBUG_ASSERT(row_end != NULL);
     DBUG_PRINT("info", ("row_start = %p, row_end = %p, (length %u)", 
 			row_start, row_end, row_end - row_start));
-    tag_new_fields(thd, table, m_cols, m_width);
     error = do_exec_row(table, rli);
     DBUG_PRINT("info", ("error = %d", error));
     row_start = row_end;
@@ -4664,7 +4653,7 @@
     // !!! This will clear *all* mappings, not only those that are open for
     // !!! the thread. There is not good handle for on-close actions for
     // !!! tables.  
-    rli->clear_tables();
+    rli->m_table_map.clear_tables();
     close_thread_tables(thd);
   }
     
@@ -4689,13 +4678,14 @@
 write_data_body(IO_CACHE* file)
 {
   DBUG_ENTER("Rows_log_event::write_data_body(IO_CACHE*)");
-  byte const wbuf[] = { m_width };
+  // Note that this should be the number of *bits*, not the number of bytes
+  byte const sbuf[] = { m_cols.size() }; 
   DBUG_PRINT("info", ("writing %d bytes", 
-		      sizeof(wbuf) + (m_width + 7) / 8 
+		      sizeof(sbuf) + m_cols.bytes()
 		      + (m_rows_cur - m_rows_buf)));
-  DBUG_ASSERT(m_width < 128);
-  DBUG_RETURN(my_b_safe_write(file, wbuf, sizeof(wbuf)) 
-	      || my_b_safe_write(file, m_cols,    (m_width + 7)/8)
+  DBUG_ASSERT(m_cols.bytes() < 128);
+  DBUG_RETURN(my_b_safe_write(file, sbuf, sizeof(sbuf)) 
+	      || my_b_safe_write(file, m_cols.data(), m_cols.bytes())
 	      || my_b_safe_write(file, m_rows_buf, m_rows_cur - m_rows_buf));
 }
 
@@ -4721,7 +4711,7 @@
  */
 #ifndef MYSQL_CLIENT
 Table_map_log_event::
-Table_map_log_event(THD* thd, TABLE* tbl, table_id tid, bool using_trans)
+Table_map_log_event(THD* thd, TABLE* tbl, ulong tid, bool using_trans)
   : Log_event(thd, 0, using_trans), 
     m_table(tbl),
     m_dbnam(thd->db), 
@@ -4739,9 +4729,10 @@
   m_data_size += m_tbllen + 2;	// Include length and terminating \0
   m_data_size += 1 + m_colcnt;	// COLCNT and column types
 
+  DBUG_ASSERT(m_memory == NULL);
   if ((m_memory = my_multi_malloc(MYF(0), 
-				    &m_coltype, m_colcnt, 
-				    NULL)))
+				  &m_coltype, m_colcnt, 
+				  NULL)))
   {
       for (unsigned int i = 0 ; i < m_table->s->fields ; ++i)
 	  m_coltype[i] = m_table->field[i]->type();
@@ -4796,11 +4787,12 @@
   DBUG_PRINT("info",("m_colcnt = %d; offset %d", m_colcnt, ptr_colcnt-vpart));
 
   /* Allocate memory for all fields in one go */
-  m_memory= my_multi_malloc(MYF(0),
-			      &m_dbnam, m_dblen + 1,
-			      &m_tblnam, m_tbllen + 1,
-			      &m_coltype, m_colcnt,
-			      NULL);
+  DBUG_ASSERT(m_memory == NULL);
+  m_memory = my_multi_malloc(MYF(0),
+			     &m_dbnam, m_dblen + 1,
+			     &m_tblnam, m_tbllen + 1,
+			     &m_coltype, m_colcnt,
+			     NULL);
 
   if (m_memory) {
     /* Copy the different parts into their memory */
@@ -4822,6 +4814,7 @@
 ~Table_map_log_event()
 {
   my_free(m_memory, MYF(0));
+  m_memory = NULL;
 }
 
 #ifndef MYSQL_CLIENT
@@ -4830,17 +4823,23 @@
 {
   DBUG_ENTER("Table_map_log_event::exec_event(st_relay_log_info*)");
   
-  // Open and lock the table
   THD* const thd = current_thd;
+
+  // Step the query id to mark what columns that are actually used.
+  pthread_mutex_lock(&LOCK_thread_count);
+  thd->query_id = next_query_id();
+  pthread_mutex_unlock(&LOCK_thread_count);
+
+  // Open and lock the table
   TABLE_LIST table_list;
-  bzero(&table_list, sizeof(table_list));
+  memset(&table_list, 0, sizeof(table_list));
   table_list.db = const_cast<char*>(m_dbnam);
   table_list.alias = table_list.table_name = const_cast<char*>(m_tblnam);
   if (open_ltable(thd, &table_list, TL_WRITE) == NULL)
     DBUG_RETURN(1);		// Failed to open and lock table
   m_table = table_list.table;
 
-  int error = rli->set_table(m_table_id, m_table);
+  int error = rli->m_table_map.set_table(m_table_id, m_table);
   DBUG_RETURN(error || Log_event::exec_event(rli));
 }
 #endif
@@ -4923,9 +4922,10 @@
  */
 #ifndef MYSQL_CLIENT
 Write_rows_log_event::
-Write_rows_log_event(THD* thd_arg, TABLE* tbl_arg, 
-		     table_id tid, bool using_trans)
-  : Rows_log_event(thd_arg, tbl_arg, tid, using_trans)
+Write_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid_arg, 
+		     bitvector const& cols, 
+		     bool using_trans)
+  : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, using_trans)
 {
 }
 #endif
@@ -4955,11 +4955,15 @@
 }
 
 char const* Write_rows_log_event::
-do_prepare_row(TABLE* table, char const* row_start)
+do_prepare_row(THD* thd, TABLE* table, char const* row_start)
 {
-  DBUG_ENTER("Write_rows_log_event::do_prepare_row(TABLE*,...)");
+  DBUG_ENTER("Write_rows_log_event::do_prepare_row(THD*, TABLE*,...)");
+  DBUG_PRINT("enter", ("thd=%p, table=%p, row_start=%p", 
+		       thd, table, row_start));
+  DBUG_ASSERT(table != NULL);
   char const* ptr = row_start;
-  ptr = unpack_row(table, table->record[0], ptr, m_cols, m_width);
+  ptr = unpack_row(thd, table, table->record[0], ptr, m_cols);
+  tag_new_fields(thd, table, m_cols);
   DBUG_RETURN(ptr);
 }
 
@@ -5009,10 +5013,10 @@
  */
 #ifndef MYSQL_CLIENT
 Delete_rows_log_event::
-Delete_rows_log_event(THD* thd_arg, TABLE* tbl_arg, 
-		      table_id tid, bool using_trans)
-  : Rows_log_event(thd_arg, tbl_arg, tid, using_trans), 
-    m_search_record(NULL), m_key(NULL)
+Delete_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid, 
+		      bitvector const& cols, bool using_trans)
+  : Rows_log_event(thd_arg, tbl_arg, tid, cols, using_trans), 
+    m_memory(NULL), m_key(NULL), m_search_record(NULL)
 {
 }
 
@@ -5032,7 +5036,7 @@
   : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event)
 #else
   : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event),
-    m_search_record(NULL), m_key(NULL)
+    m_memory(NULL), m_key(NULL), m_search_record(NULL)
 #endif
 {
   DBUG_ENTER("Delete_rows_log_event::Delete_rows_log_event(char*,...)");
@@ -5047,6 +5051,7 @@
   DBUG_ENTER("Delete_rows_log_event::do_before_row_operations(TABLE*)");
   DBUG_PRINT("info", ("key_length = %u", table->key_info->key_length));
   DBUG_PRINT("info", ("keys = %u", table->s->keys));
+  DBUG_ASSERT(m_memory == NULL);
   m_memory = 
     my_multi_malloc(MYF(0), 
 		    &m_search_record, table->s->reclength, 
@@ -5077,21 +5082,22 @@
 
   table->file->ha_index_or_rnd_end();
   my_free(m_memory, MYF(MY_WME)); // Free for multi_malloc
-  m_search_record = m_key = NULL;
+  m_memory = m_search_record = m_key = NULL;
 
   DBUG_VOID_RETURN;
 }
 
 char const* Delete_rows_log_event::
-do_prepare_row(TABLE* table, char const* row_start)
+do_prepare_row(THD* thd, TABLE* table, char const* row_start)
 {
-  DBUG_ENTER("Delete_rows_log_event::do_prepare_row(TABLE*,...)");
+  DBUG_ENTER("Delete_rows_log_event::do_prepare_row(THD*, TABLE*,...)");
   DBUG_ASSERT(m_search_record);
 
   char const* ptr = row_start;
 
   DBUG_ASSERT(ptr != NULL);
-  ptr = unpack_row(table, table->record[0], ptr, m_cols, m_width);
+  ptr = unpack_row(thd, table, table->record[0], ptr, m_cols);
+  tag_new_fields(thd, table, m_cols);
 
   if (table->s->keys > 0) 
   {
@@ -5157,16 +5163,6 @@
 	  DBUG_RETURN(error);
 	}
       }    
-
-#if 0
-      // !!! Need to test if we have searched the entire table
-      table->file->position(m_search_record);
-      if (memcmp(table->file->ref, last_rowid, ) == 0) {
-	int const error = HA_ERR_END_OF_FILE;
-	DBUG_PRINT("return", ("error = %d", error));
-	DBUG_RETURN(error);
-      }
-#endif
     }
   }
 
@@ -5188,10 +5184,11 @@
  */
 #ifndef MYSQL_CLIENT
 Update_rows_log_event::
-Update_rows_log_event(THD* thd_arg, TABLE* tbl_arg, 
-		      table_id tid, bool using_trans)
-: Rows_log_event(thd_arg, tbl_arg, tid, using_trans),
-  m_key(NULL)
+Update_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid, 
+		      bitvector const& cols,
+		      bool using_trans)
+: Rows_log_event(thd_arg, tbl_arg, tid, cols, using_trans),
+  m_memory(NULL), m_key(NULL)
 {
 }
 #endif
@@ -5206,7 +5203,7 @@
   : Rows_log_event(buf, event_len, UPDATE_ROWS_EVENT, description_event)
 #else
   : Rows_log_event(buf, event_len, UPDATE_ROWS_EVENT, description_event),
-    m_key(NULL)
+    m_memory(NULL), m_key(NULL)
 #endif
 {
   DBUG_ENTER("Update_rows_log_event::Update_rows_log_event(char*,...)");
@@ -5221,6 +5218,7 @@
   DBUG_PRINT("info", ("key_length = %u", table->key_info->key_length));
   DBUG_PRINT("info", ("keys = %u", table->s->keys));
 
+  DBUG_ASSERT(m_memory == NULL);
   m_memory
     = my_multi_malloc(MYF(0), 
 		      &m_search_record, table->s->reclength, 
@@ -5250,26 +5248,28 @@
   DBUG_ENTER("Update_rows_log_event::do_after_row_operations(TABLE*)");
 
   table->file->ha_index_or_rnd_end();
-  my_free(m_memory, MYF(MY_WME)); // Free for multi_malloc
-  m_search_record = m_key = NULL;
+  my_free(m_memory, MYF(MY_WME));
+  m_memory = m_search_record = m_key = NULL;
 
   DBUG_VOID_RETURN;
 }
 
 char const* Update_rows_log_event::
-do_prepare_row(TABLE* table, char const* row_start)
+do_prepare_row(THD* thd, TABLE* table, char const* row_start)
 {
-  DBUG_ENTER("Update_rows_log_event::do_prepare_row(TABLE*,...)");
+  DBUG_ENTER("Update_rows_log_event::do_prepare_row(THD*, TABLE*,...)");
   DBUG_ASSERT(m_search_record);
 
   char const* ptr = row_start;
 
   DBUG_ASSERT(ptr != NULL);
   // record[0] is the before image for the update
-  ptr = unpack_row(table, table->record[0], ptr, m_cols, m_width); 
+  ptr = unpack_row(thd, table, table->record[0], ptr, m_cols); 
   DBUG_ASSERT(ptr != NULL);
   // record[1] is the after image for the update 
-  ptr = unpack_row(table, table->record[1],  ptr, m_cols, m_width);
+  ptr = unpack_row(thd, table, table->record[1],  ptr, m_cols);
+
+  tag_new_fields(thd, table, m_cols);
 
   if (table->s->keys > 0) 
   {
@@ -5335,16 +5335,6 @@
 	  DBUG_RETURN(error);
 	}
       }    
-
-#if 0
-      // !!! Need to test if we have searched all records
-      table->file->position(m_search_record);
-      if (table->file->ref == last_rowid) {
-	int const error = HA_ERR_END_OF_FILE;
-	DBUG_PRINT("return", ("error = %d", error));
-	DBUG_RETURN(error);
-      }
-#endif
     }
   }
 

--- 1.105/sql/log_event.h	2005-03-14 15:07:16 +01:00
+++ 1.106/sql/log_event.h	2005-03-21 19:24:55 +01:00
@@ -18,6 +18,8 @@
 #ifndef _log_event_h
 #define _log_event_h
 
+#include "bitvector.h"
+
 #ifdef __EMX__
 #undef write  // remove pthread.h macro definition, conflict with write() class member
 #endif
@@ -648,7 +650,8 @@
     for non-transactional tables written directly to the log file, bypassing
     any caching resulting from, e.g., transactions.
 
-    Return 'true' if this event can be put in the cache, 'false' otherwise.
+    Return 'true' if this event can be put in the (transaction) cache, 'false'
+    otherwise.
   */
   bool can_be_cached() const {
       return do_can_be_cached();
@@ -1490,15 +1493,13 @@
 class Table_map_log_event : public Log_event
 {
 public:
-  typedef uint16 table_id;
-
   // Constants
   enum {
     TYPE_CODE = TABLE_MAP_EVENT
   };
 
 #ifndef MYSQL_CLIENT
-  Table_map_log_event(THD *thd, TABLE* tbl, table_id tid, bool using_trans);
+  Table_map_log_event(THD *thd, TABLE* tbl, ulong tid, bool using_trans);
 #endif
   Table_map_log_event(const char* buf, uint event_len, 
                       const Format_description_log_event *description_event);
@@ -1534,7 +1535,7 @@
   byte          *m_coltype;
 
   gptr           m_memory;
-  table_id       m_table_id;
+  ulong          m_table_id;
 
   size_t         m_data_size;
   ulong          m_thread_id;
@@ -1567,8 +1568,6 @@
 class Rows_log_event : public Log_event
 {
 public:
-  typedef Table_map_log_event::table_id table_id;
-
   enum enum_flags {
     STMT_END_F  = (1 << 0),	// Last event of a statement
     TRANS_END_F = (1 << 1)	// Last event of a transaction
@@ -1600,10 +1599,14 @@
   // Member functions to implement superclass interface
   virtual int get_data_size() { 
       return 
-	  ROWS_HEADER_LEN + 1 + (m_width + 7) / 8 
+	  ROWS_HEADER_LEN + 1 + m_cols.bytes() 
 	  + (m_rows_cur - m_rows_buf); 
   }
 
+  virtual bitvector const& get_cols() const {
+      return m_cols;
+  }
+
   virtual bool write_data_header(IO_CACHE* file);
   virtual bool write_data_body(IO_CACHE* file);
 
@@ -1611,7 +1614,8 @@
   // The constructors are protected since you're supposed to inherit
   // this class, not create instances of this class.
 #ifndef MYSQL_CLIENT
-  Rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+  Rows_log_event(THD*, TABLE*, ulong table_id, 
+		 bitvector const& cols, bool using_trans);
 #endif
   Rows_log_event(const char* row_data, uint event_len, 
 		 Log_event_type event_type,
@@ -1627,9 +1631,8 @@
 #endif
   char const *m_tblnam;
   size_t      m_tbllen;
-  table_id    m_table_id;	// Table ID
-  size_t      m_width;		// Width of table, on the master [1..127]
-  byte        m_cols[128/8];	// Bitmask denoting columns available
+  ulong       m_table_id;	// Table ID
+  bitvector   m_cols;		// Bitvector denoting columns available
 
   ulong m_thread_id;		// Thread ID
 
@@ -1694,7 +1697,7 @@
       failed. Currently, preparation cannot fail, but don't rely on this
       behaviour. 
    */
-  virtual char const* do_prepare_row(TABLE* table, char const* row_start) = 0;
+  virtual char const* do_prepare_row(THD*, TABLE*, char const* row_start) = 0;
 
   /*
     Primitive to do the actual execution necessary for a row.
@@ -1730,7 +1733,8 @@
   };
 
 #ifndef MYSQL_CLIENT
-  Write_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+  Write_rows_log_event(THD*, TABLE*, ulong table_id, 
+		       bitvector const& cols, bool using_trans);
 #endif
   Write_rows_log_event(const char* buf, uint event_len, 
                        const Format_description_log_event *description_event);
@@ -1749,7 +1753,7 @@
 
   virtual int         do_before_row_operations(TABLE* table);
   virtual void        do_after_row_operations(TABLE* table);
-  virtual char const* do_prepare_row(TABLE* table, char const* row_start);
+  virtual char const* do_prepare_row(THD*, TABLE*, char const* row_start);
   virtual int         do_exec_row(TABLE* table, st_relay_log_info* rli);
 #endif
 };
@@ -1775,7 +1779,8 @@
   };
 
 #ifndef MYSQL_CLIENT
-  Update_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+  Update_rows_log_event(THD*, TABLE*, ulong table_id, 
+			bitvector const& cols, bool using_trans);
 #endif
   Update_rows_log_event(const char* buf, uint event_len, 
 			const Format_description_log_event *description_event);
@@ -1786,12 +1791,12 @@
 
 #ifndef MYSQL_CLIENT
   gptr  m_memory;
-  byte* m_search_record;
   byte* m_key;
+  byte* m_search_record;
 
   virtual int         do_before_row_operations(TABLE* table);
   virtual void        do_after_row_operations(TABLE* table);
-  virtual char const* do_prepare_row(TABLE* table, char const* row_start);
+  virtual char const* do_prepare_row(THD*, TABLE*, char const* row_start);
   virtual int         do_exec_row(TABLE* table, st_relay_log_info* rli);
 #endif
 };
@@ -1824,7 +1829,8 @@
   };
 
 #ifndef MYSQL_CLIENT
-  Delete_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+  Delete_rows_log_event(THD*, TABLE*, ulong, 
+			bitvector const& cols, bool using_trans);
   virtual ~Delete_rows_log_event();
 #endif
   Delete_rows_log_event(const char* buf, uint event_len, 
@@ -1836,12 +1842,12 @@
 
 #ifndef MYSQL_CLIENT
   gptr  m_memory;
-  byte* m_search_record;
   byte* m_key;
+  byte* m_search_record;
 
   virtual int         do_before_row_operations(TABLE* table);
   virtual void        do_after_row_operations(TABLE* table);
-  virtual char const* do_prepare_row(TABLE* table, char const* row_start);
+  virtual char const* do_prepare_row(THD*, TABLE*, char const* row_start);
   virtual int         do_exec_row(TABLE* table, st_relay_log_info* rli);
 #endif
 };

--- 1.241/sql/slave.cc	2005-03-14 14:53:49 +01:00
+++ 1.242/sql/slave.cc	2005-03-21 19:24:55 +01:00
@@ -26,6 +26,7 @@
 #include <thr_alarm.h>
 #include <my_dir.h>
 #include <sql_common.h>
+#include "rpl_tblmap.h"
 
 bool use_slave_mask = 0;
 MY_BITMAP slave_error_mask;
@@ -2529,13 +2530,11 @@
    ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0),
    abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0),
    inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
-   until_log_pos(0), table_array(0), table_count(0), table_reserve(16)
+   until_log_pos(0)
 {
   group_relay_log_name[0]= event_relay_log_name[0]=
     group_master_log_name[0]= 0;
   last_slave_error[0]=0; until_log_name[0]= 0;
-  table_array = (table_entry*) my_malloc(table_reserve * sizeof(*table_array), MYF(MY_WME));
-  bzero(table_array, table_reserve * sizeof(*table_array));
   bzero((char*) &info_file, sizeof(info_file));
   bzero((char*) &cache_buf, sizeof(cache_buf));
   cached_charset_invalidate();
@@ -2552,8 +2551,6 @@
 
 st_relay_log_info::~st_relay_log_info()
 {
-  my_free(reinterpret_cast<char*>(table_array), MYF(MY_WME));
-
   pthread_mutex_destroy(&run_lock);
   pthread_mutex_destroy(&data_lock);
   pthread_mutex_destroy(&log_space_lock);
@@ -3089,83 +3086,6 @@
   return ((until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_EQUAL && 
            log_pos >= until_log_pos) ||
           until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_GREATER);
-}
-
-ulong st_relay_log_info::
-find_pos(ulong table_id) const
-{
-  // !!! This is a linear search, it will be infeasible to use for larger 
-  // !!! number of tables in the air at the same time. Switch to a binary
-  // !!! search later.
-  for (ulong i = 0 ; i < table_count ; ++i) {
-    if (table_array[i].table_id == table_id)
-      return i;
-  }
-  return table_count;
-}
-
-TABLE* st_relay_log_info::
-get_table(ulong table_id)
-{
-  DBUG_ENTER("st_relay_log_info::get_table(ulong)");
-  ulong const pos = find_pos(table_id);
-  if (pos < table_count) {
-  DBUG_PRINT("info", ("tid %d -> table %p (%s)", 
-		      table_id, table_array[pos].table,
-		      table_array[pos].table->s->table_name));
-    DBUG_RETURN(table_array[pos].table);
-  }
-  DBUG_RETURN(NULL);
-}
-
-int st_relay_log_info::
-set_table(ulong table_id, TABLE* table)
-{
-  DBUG_ENTER("st_relay_log_info::set_table(ulong,TABLE*)");
-  ulong const pos = find_pos(table_id);
-
-  // See if we need to allocate a larger array
-  if (pos == table_count && table_reserve == table_count) {
-    if (table_reserve > ULONG_MAX/2)
-      DBUG_RETURN(1);			// Table upper limit exceeded
-
-    int const reserve = 2*table_reserve;
-    table_entry* const 
-      array = (table_entry*) my_realloc((char*) table_array, 
-					reserve*sizeof(*table_array), 
-					MYF(MY_WME));
-    if (array == NULL)
-      return 1;			// Memory allocation failed
-    table_reserve = reserve;
-    table_array = array;
-  }
-
-  table_array[pos].table_id = table_id;
-  table_array[pos].table = table;
-  ++table_count;
-  DBUG_PRINT("info", ("tid %d -> table %p (%s)", 
-		      table_id, table_array[pos].table,
-		      table_array[pos].table->s->table_name));
-  DBUG_RETURN(0);		// All OK
-}
-
-int st_relay_log_info::
-remove_table(ulong table_id)
-{
-  ulong pos = find_pos(table_id);
-  if (pos < table_count) {
-    while (++pos < table_count)
-      table_array[pos-1] = table_array[pos];
-    --table_count;
-    return 0;			// All OK
-  }
-  return 1;			// No table to remove
-}
-
-void st_relay_log_info::
-clear_tables()
-{
-  table_count = 0;
 }
 
 void st_relay_log_info::cached_charset_invalidate()

--- 1.170/sql/sql_class.cc	2005-03-14 15:07:16 +01:00
+++ 1.171/sql/sql_class.cc	2005-03-21 19:24:56 +01:00
@@ -1802,3 +1802,128 @@
 {
   bzero((char*) &status_var, sizeof(status_var));
 }
+
+int THD::
+set_pending_event(Rows_log_event* ev) 
+{
+  DBUG_ENTER("THD::set_pending_event(Rows_log_event*)");
+  transaction.m_pending_rows_event = ev;
+  DBUG_RETURN(0);		// Ok
+}
+
+Rows_log_event* THD::
+get_pending_event() const 
+{
+  DBUG_ENTER("THD::get_pending_event()");
+  Rows_log_event* ev = transaction.m_pending_rows_event;
+  DBUG_RETURN(ev);
+}
+
+extern ulong opt_binlog_rows_event_max_size;
+
+/*
+  Template member function for ensuring that there is an rows log
+  event of the apropriate type before proceeding.
+
+  PRE CONDITION:
+    - Events of type 'RowEventT' have the type code 'type_code'.
+    
+  POST CONDITION:
+    If a non-NULL pointer is returned, the pending event for thread 'thd' will
+    be an event of type 'RowEventT' (which have the type code 'type_code')
+    will either empty or have enough space to hold 'needed' bytes.  In
+    addition, the columns bitvector will be correct for the row, meaning that
+    the pending event will be flushed if the columns in the event differ from
+    the columns suppled to the function.
+ */
+
+template <class RowsEventT>
+Rows_log_event* THD::
+prepare_pending(TABLE* table, uint32 server_id, 
+		bitvector const& cols, size_t needed) 
+{
+  // Fetch the type code for the RowsEventT template parameter
+  int const type_code = RowsEventT::TYPE_CODE;
+  DBUG_ENTER("THD::prepare_pending<RowsEventT>(TABLE*, ...)");
+  DBUG_PRINT("enter", ("table=%p (%s), type_code=%d, needed=%d", 
+		       table, table->s->table_name,
+		       type_code, needed));
+
+  Rows_log_event* pending = get_pending_event();
+
+  if (pending) 
+  {
+      DBUG_PRINT("info", ("pending=%p [type_code=%d, size=%d]",
+			  pending, 
+			  pending->get_type_code(),
+			  pending->get_data_size()));
+  }
+  else 
+  {
+      DBUG_PRINT("info", ("pending=%p", pending));
+  }
+
+  DBUG_PRINT("info", ("opt_binlog_rows_event_max_size=%d", 
+		      opt_binlog_rows_event_max_size));
+
+  // Check if the current event is non-NULL and a write-rows event. 
+  if (!pending
+      || pending->server_id != server_id
+      || pending->get_type_code() != type_code
+      || pending->get_data_size() + needed > opt_binlog_rows_event_max_size
+      || pending->get_cols() != cols) 
+  {
+    // If not, flush the event and create a new RowsEventT.
+    ulong const tid = mysql_bin_log.get_table_id(table);
+
+    Rows_log_event* const 
+	ev = new RowsEventT(this, table, tid, cols, 
+			    table->file->has_transactions());
+    ev->server_id = server_id; // I don't like this, it's too easy to forget. 
+    if (flush_and_set_pending_event(ev))
+      DBUG_RETURN(NULL);
+    DBUG_RETURN(ev);
+  }
+  DBUG_RETURN(pending);
+}
+
+/*
+  Instanciate the versions we need, we have -fno-implicit-template as
+  compiling option.
+*/
+
+template Rows_log_event* THD::
+prepare_pending<Write_rows_log_event>(TABLE*, uint32, bitvector const&, size_t);
+
+template Rows_log_event* THD::
+prepare_pending<Delete_rows_log_event>(TABLE*, uint32, bitvector const&, size_t);
+
+template Rows_log_event* THD::
+prepare_pending<Update_rows_log_event>(TABLE*, uint32, bitvector const&, size_t);
+
+
+int THD::
+flush_and_set_pending_event(Rows_log_event* event)
+{
+  DBUG_ENTER("THD::flush_and_set_event");
+  DBUG_PRINT("enter", ("thd = 0x%0x (%s event)", 
+		       this, 
+		       (event ? event->get_type_str() : "No")));
+
+  DBUG_ASSERT(opt_binlog_row_level);
+  DBUG_ASSERT(mysql_bin_log.is_open());
+  
+  if (Rows_log_event* pending = get_pending_event()) {
+    if (mysql_bin_log.write(pending)) {
+      DBUG_PRINT("exit", ("1"));
+      DBUG_RETURN(1);		// Something failed
+    }
+
+    delete pending;
+  }
+
+  set_pending_event(event);
+
+  DBUG_PRINT("exit", ("0"));
+  DBUG_RETURN(0);		// All OK
+}

--- 1.223/sql/sql_class.h	2005-03-14 14:53:50 +01:00
+++ 1.224/sql/sql_class.h	2005-03-21 19:24:56 +01:00
@@ -23,6 +23,8 @@
 
 // TODO: create log.h and move all the log header stuff there
 
+#include "rpl_tblmap.h"
+
 class Query_log_event;
 class Load_log_event;
 class Slave_log_event;
@@ -54,6 +56,9 @@
 #define TC_HEURISTIC_RECOVER_ROLLBACK 2
 extern uint tc_heuristic_recover;
 
+// Forward declaration
+class THD;
+
 /*
   Transaction Coordinator log - a base abstract class
   for two different implementations
@@ -234,6 +239,9 @@
   pthread_cond_t  COND_prep_xids;
   friend class Log_event;
 
+  table_mapping* m_table_map;
+  ulong m_next_table_id;
+
 public:
   MYSQL_LOG();
   ~MYSQL_LOG();
@@ -244,6 +252,10 @@
   void unlog(ulong cookie, my_xid xid);
   int recover(IO_CACHE *log, Format_description_log_event *fdle);
 
+  // This will return a table id for the table. If the table is not known, a
+  // new table id will be invented and returned. 
+  ulong get_table_id(TABLE* table);
+
   /*
      These describe the log's format. This is used only for relay logs.
      _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
@@ -1072,6 +1084,19 @@
   my_bool    tablespace_op;	/* This is TRUE in DISCARD/IMPORT TABLESPACE */
   /* container for handler's private per-connection data */
   void *ha_data[MAX_HA];
+
+  /*
+    Member functions to handle pending event for row-level logging.
+  */
+  Rows_log_event* get_pending_event() const;
+  int             set_pending_event(Rows_log_event* ev);
+  int             flush_and_set_pending_event(Rows_log_event*);
+
+  template <class RowsEventT>
+    Rows_log_event* 
+      prepare_pending(TABLE* table, uint32 server_id, 
+		      bitvector const& cols, size_t needed);
+
   struct st_transactions {
     SAVEPOINT *savepoints;
     THD_TRANS all;			// Trans since BEGIN WORK
@@ -1079,9 +1104,7 @@
     bool on;                            // see ha_enable_transaction()
     XID  xid;                           // transaction identifier
     enum xa_states xa_state;            // used by external XA only
-    /*
-      Pending event for row-level logging.
-    */
+
     Rows_log_event* m_pending_rows_event;
 
     /*

--- 1.113/sql/sql_union.cc	2005-03-03 11:29:32 +01:00
+++ 1.114/sql/sql_union.cc	2005-03-21 19:24:56 +01:00
@@ -75,7 +75,7 @@
   if (thd->net.report_error)
     return 1;
 
-  if ((error= table->file->write_row(table->record[0])))
+  if ((error= table->file->ha_write_row(table->record[0])))
   {
     /* create_myisam_from_heap will generate error if needed */
     if (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE &&

--- 1.31/mysql-test/r/ctype_ucs.result	2005-03-14 15:07:15 +01:00
+++ 1.32/mysql-test/r/ctype_ucs.result	2005-03-21 19:24:54 +01:00
@@ -523,10 +523,10 @@
 set @v=convert('abc' using ucs2);
 reset master;
 insert into t2 values (@v);
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	User var	1	136	@`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001	136	Query	1	226	use `test`; insert into t2 values (@v)
+master-bin.000001	100	User var	1	140	@`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001	140	Query	1	230	use `test`; insert into t2 values (@v)
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 ROLLBACK;

--- 1.8/mysql-test/r/rpl_timezone.result	2005-03-14 15:07:16 +01:00
+++ 1.9/mysql-test/r/rpl_timezone.result	2005-03-21 19:24:55 +01:00
@@ -32,13 +32,13 @@
 2004-06-11 09:39:02
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	189	use `test`; create table t1 (t timestamp)
-master-bin.000001	189	Query	1	281	use `test`; create table t2 (t char(32))
-master-bin.000001	281	Query	1	373	use `test`; SET ONE_SHOT TIME_ZONE='UTC'
-master-bin.000001	373	Query	1	497	use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
-master-bin.000001	497	Query	1	575	use `test`; delete from t1
-master-bin.000001	575	Query	1	699	use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	193	use `test`; create table t1 (t timestamp)
+master-bin.000001	193	Query	1	285	use `test`; create table t2 (t char(32))
+master-bin.000001	285	Query	1	377	use `test`; SET ONE_SHOT TIME_ZONE='UTC'
+master-bin.000001	377	Query	1	501	use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001	501	Query	1	579	use `test`; delete from t1
+master-bin.000001	579	Query	1	703	use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
 set time_zone='MET';
 insert into t2 (select t from t1);
 select * from t1;

--- 1.15/mysql-test/r/mysqlbinlog.result	2005-02-23 19:44:19 +01:00
+++ 1.16/mysql-test/r/mysqlbinlog.result	2005-03-21 19:24:54 +01:00
@@ -144,11 +144,6 @@
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
-use test;
-SET TIMESTAMP=1108844556;
-BEGIN;
-SET TIMESTAMP=1108844555;
-insert t1 values (1);
 ROLLBACK;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 drop table t1, t2;

--- 1.20/mysql-test/r/rpl_until.result	2005-03-14 15:07:16 +01:00
+++ 1.21/mysql-test/r/rpl_until.result	2005-03-21 19:24:55 +01:00
@@ -14,15 +14,15 @@
 drop table t2;
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001	218	Query	1	319	use `test`; insert into t1 values (1),(2),(3),(4)
-master-bin.000001	319	Query	1	396	use `test`; drop table t1
-master-bin.000001	396	Query	1	518	use `test`; create table t2(n int not null auto_increment primary key)
-master-bin.000001	518	Query	1	611	use `test`; insert into t2 values (1),(2)
-master-bin.000001	611	Query	1	704	use `test`; insert into t2 values (3),(4)
-master-bin.000001	704	Query	1	781	use `test`; drop table t2
-start slave until master_log_file='master-bin.000001', master_log_pos=304;
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001	222	Query	1	323	use `test`; insert into t1 values (1),(2),(3),(4)
+master-bin.000001	323	Query	1	400	use `test`; drop table t1
+master-bin.000001	400	Query	1	522	use `test`; create table t2(n int not null auto_increment primary key)
+master-bin.000001	522	Query	1	615	use `test`; insert into t2 values (1),(2)
+master-bin.000001	615	Query	1	708	use `test`; insert into t2 values (3),(4)
+master-bin.000001	708	Query	1	785	use `test`; drop table t2
+start slave until master_log_file='master-bin.000001', master_log_pos=308;
 select * from t1;
 n
 1
@@ -31,8 +31,8 @@
 4
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	781	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	319	#	Master	master-bin.000001	304	No						#
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	785	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	323	#	Master	master-bin.000001	308	No						#
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=295;
 select * from t1;
 n
 1
@@ -41,7 +41,7 @@
 4
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	781	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	319	#	Master	master-no-such-bin.000001	291	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	785	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	323	#	Master	master-no-such-bin.000001	295	No						#
 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=710;
 select * from t2;
 n
@@ -49,24 +49,24 @@
 2
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	781	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	611	#	Relay	slave-relay-bin.000004	710	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	785	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	615	#	Relay	slave-relay-bin.000004	710	No						#
 start slave;
 stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=710;
+start slave until master_log_file='master-bin.000001', master_log_pos=714;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	781	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	781	#	Master	master-bin.000001	710	No						#
-start slave until master_log_file='master-bin', master_log_pos=561;
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	785	slave-relay-bin.000004	#	master-bin.000001	Yes	No							0		0	785	#	Master	master-bin.000001	714	No						#
+start slave until master_log_file='master-bin', master_log_pos=565;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+start slave until master_log_file='master-bin.000001', master_log_pos=565, relay_log_pos=16;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until relay_log_file='slave-relay-bin.000002';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=565;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=710;
+start slave until master_log_file='master-bin.000001', master_log_pos=714;
 Warnings:
 Note	1254	Slave is already running

--- 1.14/mysql-test/r/rpl_user_variables.result	2005-03-14 15:07:16 +01:00
+++ 1.15/mysql-test/r/rpl_user_variables.result	2005-03-21 19:24:55 +01:00
@@ -76,35 +76,35 @@
 NULL
 NULL
 NULL
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	96	Query	1	187	use `test`; create table t1(n char(30))
-slave-bin.000001	187	User var	2	230	@`i1`=12345678901234
-slave-bin.000001	230	User var	2	273	@`i2`=-12345678901234
-slave-bin.000001	273	User var	2	316	@`i3`=0
-slave-bin.000001	316	User var	2	359	@`i4`=-1
-slave-bin.000001	359	Query	1	471	use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
-slave-bin.000001	471	User var	2	510	@`r1`=12.5
-slave-bin.000001	510	User var	2	549	@`r2`=-12.5
-slave-bin.000001	549	Query	1	647	use `test`; insert into t1 values (@r1), (@r2)
-slave-bin.000001	647	User var	2	696	@`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
-slave-bin.000001	696	User var	2	731	@`s2`=_latin1 "" COLLATE latin1_swedish_ci
-slave-bin.000001	731	User var	2	773	@`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001	773	User var	2	815	@`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
-slave-bin.000001	815	User var	2	857	@`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001	857	Query	1	976	use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
-slave-bin.000001	976	User var	2	1002	@`n1`=NULL
-slave-bin.000001	1002	Query	1	1093	use `test`; insert into t1 values (@n1)
-slave-bin.000001	1093	User var	2	1119	@`n2`=NULL
-slave-bin.000001	1119	Query	1	1210	use `test`; insert into t1 values (@n2)
-slave-bin.000001	1210	Query	1	1327	use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
-slave-bin.000001	1327	User var	2	1369	@`a`=2
-slave-bin.000001	1369	Query	1	1470	use `test`; insert into t1 values (@a+(@b:=@a+1))
-slave-bin.000001	1470	User var	2	1507	@`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
-slave-bin.000001	1507	Query	1	1640	use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
-slave-bin.000001	1640	User var	2	1682	@`a`=5
-slave-bin.000001	1682	Query	1	1777	use `test`; insert into t1 values (@a),(@a)
-slave-bin.000001	1777	User var	2	1802	@`a`=NULL
-slave-bin.000001	1802	Query	1	1904	use `test`; insert into t1 values (@a),(@a),(@a*5)
+slave-bin.000001	100	Query	1	191	use `test`; create table t1(n char(30))
+slave-bin.000001	191	User var	2	234	@`i1`=12345678901234
+slave-bin.000001	234	User var	2	277	@`i2`=-12345678901234
+slave-bin.000001	277	User var	2	320	@`i3`=0
+slave-bin.000001	320	User var	2	363	@`i4`=-1
+slave-bin.000001	363	Query	1	475	use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
+slave-bin.000001	475	User var	2	514	@`r1`=12.5
+slave-bin.000001	514	User var	2	553	@`r2`=-12.5
+slave-bin.000001	553	Query	1	651	use `test`; insert into t1 values (@r1), (@r2)
+slave-bin.000001	651	User var	2	700	@`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
+slave-bin.000001	700	User var	2	735	@`s2`=_latin1 "" COLLATE latin1_swedish_ci
+slave-bin.000001	735	User var	2	777	@`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001	777	User var	2	819	@`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
+slave-bin.000001	819	User var	2	861	@`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001	861	Query	1	980	use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
+slave-bin.000001	980	User var	2	1006	@`n1`=NULL
+slave-bin.000001	1006	Query	1	1097	use `test`; insert into t1 values (@n1)
+slave-bin.000001	1097	User var	2	1123	@`n2`=NULL
+slave-bin.000001	1123	Query	1	1214	use `test`; insert into t1 values (@n2)
+slave-bin.000001	1214	Query	1	1331	use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
+slave-bin.000001	1331	User var	2	1373	@`a`=2
+slave-bin.000001	1373	Query	1	1474	use `test`; insert into t1 values (@a+(@b:=@a+1))
+slave-bin.000001	1474	User var	2	1511	@`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
+slave-bin.000001	1511	Query	1	1644	use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
+slave-bin.000001	1644	User var	2	1686	@`a`=5
+slave-bin.000001	1686	Query	1	1781	use `test`; insert into t1 values (@a),(@a)
+slave-bin.000001	1781	User var	2	1806	@`a`=NULL
+slave-bin.000001	1806	Query	1	1908	use `test`; insert into t1 values (@a),(@a),(@a*5)
 drop table t1;
 stop slave;

--- 1.20/mysql-test/r/mix_innodb_myisam_binlog.result	2005-03-14 15:07:15 +01:00
+++ 1.21/mysql-test/r/mix_innodb_myisam_binlog.result	2005-03-21 19:24:54 +01:00
@@ -6,12 +6,12 @@
 insert into t1 values(1);
 insert into t2 select * from t1;
 commit;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(1)
-master-bin.000001	253	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	348	Xid	1	#	COMMIT /* xid=7 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(1)
+master-bin.000001	257	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	352	Xid	1	#	COMMIT /* xid=7 */
 delete from t1;
 delete from t2;
 reset master;
@@ -21,12 +21,12 @@
 rollback;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(2)
-master-bin.000001	253	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	348	Query	1	#	use `test`; ROLLBACK
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(2)
+master-bin.000001	257	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	352	Query	1	#	use `test`; ROLLBACK
 delete from t1;
 delete from t2;
 reset master;
@@ -39,15 +39,15 @@
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 commit;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(3)
-master-bin.000001	253	Query	1	#	use `test`; savepoint my_savepoint
-master-bin.000001	339	Query	1	#	use `test`; insert into t1 values(4)
-master-bin.000001	427	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	522	Query	1	#	use `test`; rollback to savepoint my_savepoint
-master-bin.000001	620	Xid	1	#	COMMIT /* xid=24 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(3)
+master-bin.000001	257	Query	1	#	use `test`; savepoint my_savepoint
+master-bin.000001	343	Query	1	#	use `test`; insert into t1 values(4)
+master-bin.000001	431	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	526	Query	1	#	use `test`; rollback to savepoint my_savepoint
+master-bin.000001	624	Xid	1	#	COMMIT /* xid=24 */
 delete from t1;
 delete from t2;
 reset master;
@@ -65,16 +65,16 @@
 a
 5
 7
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(5)
-master-bin.000001	253	Query	1	#	use `test`; savepoint my_savepoint
-master-bin.000001	339	Query	1	#	use `test`; insert into t1 values(6)
-master-bin.000001	427	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	522	Query	1	#	use `test`; rollback to savepoint my_savepoint
-master-bin.000001	620	Query	1	#	use `test`; insert into t1 values(7)
-master-bin.000001	708	Xid	1	#	COMMIT /* xid=36 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(5)
+master-bin.000001	257	Query	1	#	use `test`; savepoint my_savepoint
+master-bin.000001	343	Query	1	#	use `test`; insert into t1 values(6)
+master-bin.000001	431	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	526	Query	1	#	use `test`; rollback to savepoint my_savepoint
+master-bin.000001	624	Query	1	#	use `test`; insert into t1 values(7)
+master-bin.000001	712	Xid	1	#	COMMIT /* xid=36 */
 delete from t1;
 delete from t2;
 reset master;
@@ -87,43 +87,43 @@
 select get_lock("a",10);
 get_lock("a",10)
 1
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(8)
-master-bin.000001	253	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	348	Query	1	#	use `test`; ROLLBACK
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(8)
+master-bin.000001	257	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	352	Query	1	#	use `test`; ROLLBACK
 delete from t1;
 delete from t2;
 reset master;
 insert into t1 values(9);
 insert into t2 select * from t1;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; insert into t1 values(9)
-master-bin.000001	184	Xid	1	#	COMMIT /* xid=59 */
-master-bin.000001	211	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	100	Query	1	#	use `test`; insert into t1 values(9)
+master-bin.000001	188	Xid	1	#	COMMIT /* xid=59 */
+master-bin.000001	215	Query	1	#	use `test`; insert into t2 select * from t1
 delete from t1;
 delete from t2;
 reset master;
 insert into t1 values(10);
 begin;
 insert into t2 select * from t1;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; insert into t1 values(10)
-master-bin.000001	185	Xid	1	#	COMMIT /* xid=65 */
-master-bin.000001	212	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	100	Query	1	#	use `test`; insert into t1 values(10)
+master-bin.000001	189	Xid	1	#	COMMIT /* xid=65 */
+master-bin.000001	216	Query	1	#	use `test`; insert into t2 select * from t1
 insert into t1 values(11);
 commit;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; insert into t1 values(10)
-master-bin.000001	185	Xid	1	#	COMMIT /* xid=65 */
-master-bin.000001	212	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	307	Query	1	#	use `test`; BEGIN
-master-bin.000001	376	Query	1	#	use `test`; insert into t1 values(11)
-master-bin.000001	465	Xid	1	#	COMMIT /* xid=67 */
+master-bin.000001	100	Query	1	#	use `test`; insert into t1 values(10)
+master-bin.000001	189	Xid	1	#	COMMIT /* xid=65 */
+master-bin.000001	216	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	311	Query	1	#	use `test`; BEGIN
+master-bin.000001	380	Query	1	#	use `test`; insert into t1 values(11)
+master-bin.000001	469	Xid	1	#	COMMIT /* xid=67 */
 alter table t2 engine=INNODB;
 delete from t1;
 delete from t2;
@@ -132,12 +132,12 @@
 insert into t1 values(12);
 insert into t2 select * from t1;
 commit;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(12)
-master-bin.000001	254	Query	1	#	use `test`; insert into t2 select * from t1
-master-bin.000001	349	Xid	1	#	COMMIT /* xid=77 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(12)
+master-bin.000001	258	Query	1	#	use `test`; insert into t2 select * from t1
+master-bin.000001	353	Xid	1	#	COMMIT /* xid=77 */
 delete from t1;
 delete from t2;
 reset master;
@@ -145,7 +145,7 @@
 insert into t1 values(13);
 insert into t2 select * from t1;
 rollback;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 delete from t1;
 delete from t2;
@@ -157,11 +157,11 @@
 insert into t2 select * from t1;
 rollback to savepoint my_savepoint;
 commit;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(14)
-master-bin.000001	254	Xid	1	#	COMMIT /* xid=93 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(14)
+master-bin.000001	258	Xid	1	#	COMMIT /* xid=93 */
 delete from t1;
 delete from t2;
 reset master;
@@ -177,12 +177,12 @@
 a
 16
 18
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	#	use `test`; BEGIN
-master-bin.000001	165	Query	1	#	use `test`; insert into t1 values(16)
-master-bin.000001	254	Query	1	#	use `test`; insert into t1 values(18)
-master-bin.000001	343	Xid	1	#	COMMIT /* xid=104 */
+master-bin.000001	100	Query	1	#	use `test`; BEGIN
+master-bin.000001	169	Query	1	#	use `test`; insert into t1 values(16)
+master-bin.000001	258	Query	1	#	use `test`; insert into t1 values(18)
+master-bin.000001	347	Xid	1	#	COMMIT /* xid=104 */
 delete from t1;
 delete from t2;
 alter table t2 type=MyISAM;

--- 1.16/mysql-test/r/rpl_change_master.result	2005-03-14 15:07:15 +01:00
+++ 1.17/mysql-test/r/rpl_change_master.result	2005-03-21 19:24:54 +01:00
@@ -13,11 +13,11 @@
 stop slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	358	#	#	master-bin.000001	No	No							0		0	182	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	362	#	#	master-bin.000001	No	No							0		0	186	#	None		0	No						#
 change master to master_user='root';
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	182	#	#	master-bin.000001	No	No							0		0	182	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	186	#	#	master-bin.000001	No	No							0		0	186	#	None		0	No						#
 start slave;
 select * from t1;
 n

--- 1.18/mysql-test/r/rpl_charset.result	2005-03-14 15:07:15 +01:00
+++ 1.19/mysql-test/r/rpl_charset.result	2005-03-21 19:24:54 +01:00
@@ -103,7 +103,7 @@
 1	cp850_general_ci
 drop database mysqltest2;
 drop database mysqltest3;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	drop database if exists mysqltest2
 master-bin.000001	#	Query	1	#	drop database if exists mysqltest3

--- 1.2/mysql-test/r/rpl_deadlock.result	2005-03-02 17:52:26 +01:00
+++ 1.3/mysql-test/r/rpl_deadlock.result	2005-03-21 19:24:54 +01:00
@@ -39,9 +39,9 @@
 22
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19116	#	#	master-bin.000001	Yes	Yes							0		0	19116	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19120	#	#	master-bin.000001	Yes	Yes							0		0	19120	#	None		0	No						#
 stop slave;
-change master to master_log_pos=534;
+change master to master_log_pos=538;
 begin;
 select * from t2 for update;
 a
@@ -57,10 +57,10 @@
 22
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19116	#	#	master-bin.000001	Yes	Yes							0		0	19116	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19120	#	#	master-bin.000001	Yes	Yes							0		0	19120	#	None		0	No						#
 set global max_relay_log_size=0;
 stop slave;
-change master to master_log_pos=534;
+change master to master_log_pos=538;
 begin;
 select * from t2 for update;
 a
@@ -77,5 +77,5 @@
 22
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19116	#	#	master-bin.000001	Yes	Yes							0		0	19116	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	19120	#	#	master-bin.000001	Yes	Yes							0		0	19120	#	None		0	No						#
 drop table t1,t2;

--- 1.19/mysql-test/r/rpl_error_ignored_table.result	2005-03-14 15:07:15 +01:00
+++ 1.20/mysql-test/r/rpl_error_ignored_table.result	2005-03-21 19:24:54 +01:00
@@ -9,7 +9,7 @@
 ERROR 23000: Duplicate entry '1' for key 1
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	288	#	#	master-bin.000001	Yes	Yes				test.t3,test.t1,test.t2			0		0	288	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	292	#	#	master-bin.000001	Yes	Yes				test.t3,test.t1,test.t2			0		0	292	#	None		0	No						#
 show tables like 't1';
 Tables_in_test (t1)
 drop table t1;
@@ -26,14 +26,14 @@
 0
 kill @id;
 drop table t2,t3;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	195	use `test`; create table t1 (a int primary key)
-master-bin.000001	195	Query	1	288	use `test`; insert into t1 values (1),(1)
-master-bin.000001	288	Query	1	365	use `test`; drop table t1
-master-bin.000001	365	Query	1	464	use `test`; create table t2 (a int primary key)
-master-bin.000001	464	Query	1	552	use `test`; insert into t2 values(1)
-master-bin.000001	552	Query	1	640	use `test`; create table t3 (id int)
-master-bin.000001	640	Query	1	742	use `test`; insert into t3 values(connection_id())
-master-bin.000001	742	Query	1	862	use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
-master-bin.000001	862	Query	1	942	use `test`; drop table t2,t3
+master-bin.000001	100	Query	1	199	use `test`; create table t1 (a int primary key)
+master-bin.000001	199	Query	1	292	use `test`; insert into t1 values (1),(1)
+master-bin.000001	292	Query	1	369	use `test`; drop table t1
+master-bin.000001	369	Query	1	468	use `test`; create table t2 (a int primary key)
+master-bin.000001	468	Query	1	556	use `test`; insert into t2 values(1)
+master-bin.000001	556	Query	1	644	use `test`; create table t3 (id int)
+master-bin.000001	644	Query	1	746	use `test`; insert into t3 values(connection_id())
+master-bin.000001	746	Query	1	866	use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
+master-bin.000001	866	Query	1	946	use `test`; drop table t2,t3

--- 1.11/mysql-test/r/rpl_flush_tables.result	2005-03-14 15:07:15 +01:00
+++ 1.12/mysql-test/r/rpl_flush_tables.result	2005-03-21 19:24:54 +01:00
@@ -14,27 +14,27 @@
 flush no_write_to_binlog tables;
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	183	use `test`; create table t1 (a int)
-master-bin.000001	183	Query	1	273	use `test`; insert into t1 values (10)
-master-bin.000001	273	Query	1	360	use `test`; create table t2 (a int)
-master-bin.000001	360	Query	1	470	use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001	470	Query	1	557	use `test`; create table t4 (a int)
-master-bin.000001	557	Query	1	652	use `test`; insert into t4 select * from t3
-master-bin.000001	652	Query	1	747	use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001	4	Format_desc	1	100	Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	187	use `test`; create table t1 (a int)
+master-bin.000001	187	Query	1	277	use `test`; insert into t1 values (10)
+master-bin.000001	277	Query	1	364	use `test`; create table t2 (a int)
+master-bin.000001	364	Query	1	474	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	474	Query	1	561	use `test`; create table t4 (a int)
+master-bin.000001	561	Query	1	656	use `test`; insert into t4 select * from t3
+master-bin.000001	656	Query	1	751	use `test`; rename table t1 to t5, t2 to t1
 select * from t3;
 a
 flush tables;
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	183	use `test`; create table t1 (a int)
-master-bin.000001	183	Query	1	273	use `test`; insert into t1 values (10)
-master-bin.000001	273	Query	1	360	use `test`; create table t2 (a int)
-master-bin.000001	360	Query	1	470	use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001	470	Query	1	557	use `test`; create table t4 (a int)
-master-bin.000001	557	Query	1	652	use `test`; insert into t4 select * from t3
-master-bin.000001	652	Query	1	747	use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001	747	Query	1	823	use `test`; flush tables
+master-bin.000001	4	Format_desc	1	100	Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	187	use `test`; create table t1 (a int)
+master-bin.000001	187	Query	1	277	use `test`; insert into t1 values (10)
+master-bin.000001	277	Query	1	364	use `test`; create table t2 (a int)
+master-bin.000001	364	Query	1	474	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	474	Query	1	561	use `test`; create table t4 (a int)
+master-bin.000001	561	Query	1	656	use `test`; insert into t4 select * from t3
+master-bin.000001	656	Query	1	751	use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001	751	Query	1	827	use `test`; flush tables
 select * from t3;
 a

--- 1.13/mysql-test/r/rpl_loaddata_rule_m.result	2005-03-14 15:07:15 +01:00
+++ 1.14/mysql-test/r/rpl_loaddata_rule_m.result	2005-03-21 19:24:54 +01:00
@@ -10,8 +10,8 @@
 create table t1(a int, b int, unique(b));
 use mysqltest;
 load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	198	drop database if exists mysqltest
-master-bin.000001	198	Query	1	292	create database mysqltest
+master-bin.000001	100	Query	1	202	drop database if exists mysqltest
+master-bin.000001	202	Query	1	296	create database mysqltest
 drop database mysqltest;

--- 1.7/mysql-test/r/rpl_loaddata_rule_s.result	2005-03-14 15:07:15 +01:00
+++ 1.8/mysql-test/r/rpl_loaddata_rule_s.result	2005-03-21 19:24:54 +01:00
@@ -10,5 +10,5 @@
 select count(*) from t1;
 count(*)
 2
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info

--- 1.19/mysql-test/r/rpl_max_relay_size.result	2005-03-14 15:07:15 +01:00
+++ 1.20/mysql-test/r/rpl_max_relay_size.result	2005-03-21 19:24:55 +01:00
@@ -16,7 +16,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73752	#	#	master-bin.000001	Yes	Yes							0		0	73752	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73756	#	#	master-bin.000001	Yes	Yes							0		0	73756	#	None		0	No						#
 stop slave;
 reset slave;
 set global max_relay_log_size=(5*4096);
@@ -26,7 +26,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73752	#	#	master-bin.000001	Yes	Yes							0		0	73752	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73756	#	#	master-bin.000001	Yes	Yes							0		0	73756	#	None		0	No						#
 stop slave;
 reset slave;
 set global max_relay_log_size=0;
@@ -36,7 +36,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73752	#	#	master-bin.000001	Yes	Yes							0		0	73752	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73756	#	#	master-bin.000001	Yes	Yes							0		0	73756	#	None		0	No						#
 stop slave;
 reset slave;
 flush logs;
@@ -49,13 +49,13 @@
 create table t1 (a int);
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73839	#	#	master-bin.000001	Yes	Yes							0		0	73839	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73843	#	#	master-bin.000001	Yes	Yes							0		0	73843	#	None		0	No						#
 flush logs;
 drop table t1;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73916	#	#	master-bin.000001	Yes	Yes							0		0	73916	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73920	#	#	master-bin.000001	Yes	Yes							0		0	73920	#	None		0	No						#
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000002	96		
+master-bin.000002	100		

--- 1.3/mysql-test/r/rpl_multi_query.result	2005-02-18 14:53:16 +01:00
+++ 1.4/mysql-test/r/rpl_multi_query.result	2005-03-21 19:24:55 +01:00
@@ -19,7 +19,7 @@
 3
 4
 5
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	drop database if exists mysqltest
 master-bin.000001	#	Query	1	#	create database mysqltest

--- 1.16/mysql-test/r/rpl_relayrotate.result	2005-03-14 15:07:16 +01:00
+++ 1.17/mysql-test/r/rpl_relayrotate.result	2005-03-21 19:24:55 +01:00
@@ -18,5 +18,5 @@
 8000
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	743186	#	#	master-bin.000001	Yes	Yes							0		0	743186	#	None		0	No						#
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	743190	#	#	master-bin.000001	Yes	Yes							0		0	743190	#	None		0	No						#
 drop table t1;

--- 1.13/mysql-test/r/rpl_reset_slave.result	2005-03-14 15:07:16 +01:00
+++ 1.14/mysql-test/r/rpl_reset_slave.result	2005-03-21 19:24:55 +01:00
@@ -6,12 +6,12 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	96	#	#	master-bin.000001	Yes	Yes							0		0	96	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	100	#	#	master-bin.000001	Yes	Yes							0		0	100	#	None		0	No						#
 stop slave;
 change master to master_user='test';
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	test	MASTER_PORT	1	master-bin.000001	96	#	#	master-bin.000001	No	No							0		0	96	#	None		0	No						#
+#	127.0.0.1	test	MASTER_PORT	1	master-bin.000001	100	#	#	master-bin.000001	No	No							0		0	100	#	None		0	No						#
 reset slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
@@ -19,7 +19,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	96	#	#	master-bin.000001	Yes	Yes							0		0	96	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	100	#	#	master-bin.000001	Yes	Yes							0		0	100	#	None		0	No						#
 stop slave;
 reset slave;
 start slave;

--- 1.7/mysql-test/r/rpl_server_id1.result	2005-03-14 15:07:16 +01:00
+++ 1.8/mysql-test/r/rpl_server_id1.result	2005-03-21 19:24:55 +01:00
@@ -10,7 +10,7 @@
 change master to master_port=SLAVE_PORT;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	96	None		0	No						NULL
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	100	None		0	No						NULL
 start slave;
 insert into t1 values (1);
 show status like "slave_running";

--- 1.8/mysql-test/r/rpl_server_id2.result	2005-03-14 15:07:16 +01:00
+++ 1.9/mysql-test/r/rpl_server_id2.result	2005-03-21 19:24:55 +01:00
@@ -10,7 +10,7 @@
 change master to master_port=SLAVE_PORT;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	96	None		0	No						NULL
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	100	None		0	No						NULL
 start slave;
 insert into t1 values (1);
 select * from t1;

--- 1.2/mysql-test/t/rpl_deadlock.test	2005-03-02 17:52:26 +01:00
+++ 1.3/mysql-test/t/rpl_deadlock.test	2005-03-21 19:24:55 +01:00
@@ -68,7 +68,7 @@
 # 2) Test lock wait timeout
 
 stop slave;
-change master to master_log_pos=534; # the BEGIN log event
+change master to master_log_pos=538; # the BEGIN log event
 begin;
 select * from t2 for update; # hold lock
 start slave;
@@ -89,7 +89,7 @@
 
 # This is really copy-paste of 2) of above
 stop slave;
-change master to master_log_pos=534;
+change master to master_log_pos=538;
 begin;
 select * from t2 for update;
 start slave;

--- 1.4/mysql-test/t/rpl_multi_query.test	2005-02-18 14:53:16 +01:00
+++ 1.5/mysql-test/t/rpl_multi_query.test	2005-03-21 19:24:55 +01:00
@@ -24,6 +24,6 @@
 select * from mysqltest.t1;
 connection master;
 --replace_column 2 # 5 #
-show binlog events from 96;
+show binlog events from 100;
 drop database mysqltest;
 sync_slave_with_master;

--- 1.1/mysql-test/r/rpl_row_basic.result	2005-03-10 20:10:08 +01:00
+++ 1.2/mysql-test/r/rpl_row_basic.result	2005-03-21 19:24:55 +01:00
@@ -15,7 +15,7 @@
 C1	C2
 INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
 INSERT INTO t1 VALUES ('A','C'), ('X', 'Z'), ('A', 'A');
-SHOW BINLOG EVENTS FROM 208;
+SHOW BINLOG EVENTS FROM 216;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 <binlog>	<pos>	Table_map	<server_id>	<end_log_pos>	
 <binlog>	<pos>	Write_rows	<server_id>	<end_log_pos>	
@@ -38,7 +38,7 @@
 X	Z
 A	A
 DELETE FROM t1 WHERE C1 = C2;
-SHOW BINLOG EVENTS FROM 364;
+SHOW BINLOG EVENTS FROM 372;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 <binlog>	<pos>	Table_map	<server_id>	<end_log_pos>	
 <binlog>	<pos>	Delete_rows	<server_id>	<end_log_pos>	
@@ -55,7 +55,7 @@
 A	C
 X	Z
 UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
-SHOW BINLOG EVENTS FROM 437;
+SHOW BINLOG EVENTS FROM 445;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 <binlog>	<pos>	Table_map	<server_id>	<end_log_pos>	
 <binlog>	<pos>	Update_rows	<server_id>	<end_log_pos>	

--- 1.1/mysql-test/t/rpl_row_basic.test	2005-03-10 20:10:09 +01:00
+++ 1.2/mysql-test/t/rpl_row_basic.test	2005-03-21 19:24:55 +01:00
@@ -16,7 +16,7 @@
 INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
 INSERT INTO t1 VALUES ('A','C'), ('X', 'Z'), ('A', 'A');
 --replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
-SHOW BINLOG EVENTS FROM 208;
+SHOW BINLOG EVENTS FROM 216;
 SELECT * FROM t1;
 sync_slave_with_master;
 SELECT * FROM t1;
@@ -27,7 +27,7 @@
 connection master;
 DELETE FROM t1 WHERE C1 = C2;
 --replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
-SHOW BINLOG EVENTS FROM 364;
+SHOW BINLOG EVENTS FROM 372;
 SELECT * FROM t1;
 sync_slave_with_master;
 SELECT * FROM t1;
@@ -40,7 +40,7 @@
 connection master;
 UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
 --replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
-SHOW BINLOG EVENTS FROM 437;
+SHOW BINLOG EVENTS FROM 445;
 SELECT * FROM t1;
 sync_slave_with_master;
 SELECT * FROM t1;

--- 1.1/mysql-test/t/rpl_row_trans.test	2005-03-10 20:10:09 +01:00
+++ 1.2/mysql-test/t/rpl_row_trans.test	2005-03-21 19:24:55 +01:00
@@ -33,7 +33,7 @@
 
 SELECT * FROM t4;
 SELECT * FROM t5;
---replace_column 1 <binlog> 4 <server_id> 5 <end_pos>
+--replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_pos>
 SHOW BINLOG EVENTS;
 sync_slave_with_master;
 SELECT * FROM t4;

--- 1.3/sql/injector.cc	2005-03-17 14:21:24 +01:00
+++ 1.5/sql/rpl_injector.cc	2005-03-21 19:24:56 +01:00
@@ -1,51 +1,82 @@
 // -*- Mode: C++; c-indentation-style: gnu -*-
 
-#include "injector.h"
-#include "mysql_priv.h"
+// This include cannot be here since there is no include guard on
+// 'mysql_priv.h'.
+#include "mysql_priv.h" 
+#include "rpl_injector.h"
+
+// Helper function to open and get the table given a table name and a database
+// name. 
+
+static TABLE* get_table(THD* thd, 
+			injector::transaction::table const& tbl)
+{
+  TABLE_LIST tlist;
+  memset(&tlist, 0, sizeof(tlist));
+  tlist.db = const_cast<char*>(tbl.db_name());
+  tlist.table_name = tlist.alias = const_cast<char*>(tbl.table_name());
+  return open_table(thd, &tlist, thd->mem_root, 0);
+}
+
 
 ////////////////////////////////////////////////////////////////
 // injector::transaction - member definitions
 ////////////////////////////////////////////////////////////////
 
 inline injector::transaction::	// inline since it's called below
-transaction()
+transaction(MYSQL_LOG* log, THD* thd)
+  : m_thd(thd)
 {
-  // !!! Nothing yet !!!
+  // Default initialization of m_start_pos. We need to fill it in using the
+  // code below.
+
+  LOG_INFO log_info;
+  log->get_current_log(&log_info);
+  // !!!
+  m_start_pos.m_file_name = my_strdup(log_info.log_file_name, MYF(0));
+  m_start_pos.m_file_pos = log_info.pos;
 }
 
 int injector::transaction::
 commit()
 {
-   DBUG_PRINT("info", ("Committing transaction"));
-   return 0;
+   DBUG_ENTER("injector::transaction::commit()");
+   DBUG_RETURN(0);
 }
 
 
 int injector::transaction::
 write_row (server_id_type sid, table tbl, 
-	   bitvector const& cols, 
-	   record_type record)
+	   bitvector const& cols, record_type record)
 {
    DBUG_ENTER("injector::transaction::write_row(...)");
+   TABLE* table = get_table(m_thd, tbl);
+   table->file->row_writer()->set_server_id(sid);
+   table->file->row_writer()->write_row(cols, record);
    DBUG_RETURN(0);
 }
 
 
 int injector::transaction::
 delete_row(server_id_type sid, table tbl,
-	   bitvector const& cols, 
-	   record_type record)
+	   bitvector const& cols, record_type record)
 {
    DBUG_ENTER("injector::transaction::delete_row(...)");
+   TABLE* table = get_table(m_thd, tbl);
+   table->file->row_writer()->set_server_id(sid);
+   table->file->row_writer()->delete_row(cols, record);
    DBUG_RETURN(0);
 }
 
 
 int injector::transaction::
-update_row(server_id_type sid, table tbl, bitvector const& cols, 
-	   record_type before, record_type after)
+update_row(server_id_type sid, table tbl, 
+	   bitvector const& cols, record_type before, record_type after)
 {
    DBUG_ENTER("injector::transaction::update_row(...)");
+   TABLE* table = get_table(m_thd, tbl);
+   table->file->row_writer()->set_server_id(sid);
+   table->file->row_writer()->update_row(cols, before, after);
    DBUG_RETURN(0);
 }
 
@@ -53,8 +84,7 @@
 injector::transaction::binlog_pos injector::transaction::
 start_pos() const
 {
-   binlog_pos pos = { "dobedobedo", 0 };
-   return pos;			
+   return m_start_pos;			
 }
 
 
@@ -62,7 +92,8 @@
 // injector - member definitions
 ////////////////////////////////////////////////////////////////
 
-inline injector::		// inline since it's called below
+// This constructor is inline since it's called below
+inline injector::
 injector()
 {
     
@@ -72,16 +103,17 @@
 instance()
 {
   static injector s_injector;
-  return &s_injector;		// There is only one instance
+  return &s_injector;		// "There can be only one [instance]"
 }
 
 
 
 injector::transaction injector::
-new_trans()
+new_trans(THD* thd)
 {
-   DBUG_PRINT("info", ("Creating new transaction"));
-   return transaction();
+   DBUG_ENTER("injector::new_trans()");
+   
+   DBUG_RETURN(transaction(&mysql_bin_log, thd));
 }
 
 

--- 1.3/sql/injector.h	2005-03-17 14:21:24 +01:00
+++ 1.5/sql/rpl_injector.h	2005-03-21 19:24:56 +01:00
@@ -25,6 +25,7 @@
 
 // Forward declarations
 class handler;
+class MYSQL_LOG;
 
 /*
   The injector class is used to notify the MySQL server of new rows that have
@@ -64,24 +65,46 @@
       /*
 	Table reference.
 
-        The class contains constructors to handle several forms of references
-        to tables.  The constructors can implicitly be used to construct
-        references from, e.g., strings containing table names.
+	RESPONSIBILITY
+
+	  The class contains constructors to handle several forms of
+          references to tables.  The constructors can implicitly be used to
+          construct references from, e.g., strings containing table names.
+
+	COLLABORATION
+
+	  injector::transaction
+	    Provide a flexible interface to the representation of tables.
+
       */
-      class table {
+      class table 
+      {
       public:
-	table(char const* name) : m_name(name) { }
-	table(table const& t) : m_name(t.m_name) { }
+	table(char const* db_name, char const* table_name) 
+	  : m_db_name(db_name), m_table_name(table_name)
+	{ 
+	}
+
+	char const* db_name() const { return m_db_name; }
+	char const* table_name() const { return m_table_name; }
+
       private:
-	char const* m_name;
+	char const* m_db_name;
+	char const* m_table_name;
       };
 
       /*
 	Binlog position as a structure
       */
-      struct binlog_pos {
-	char const* file;
-	my_off_t pos;
+      class binlog_pos {
+	friend class transaction;
+      public:
+	char const* file_name() const { return m_file_name; }
+	my_off_t file_pos() const { return m_file_pos; }
+
+      private:
+	char const* m_file_name;
+	my_off_t m_file_pos;
       };
 
       transaction(transaction const&);
@@ -131,11 +154,15 @@
       binlog_pos start_pos() const;
 
     private:
-      transaction();
+	// Only the injector may construct these object
+      transaction(MYSQL_LOG*, THD*);
 
       void swap(transaction& o) {
 	// Nothing to do yet: the class has no members !!!
       }
+
+      binlog_pos m_start_pos;
+      THD* m_thd;
     };
 
     /* 
@@ -143,7 +170,7 @@
        This member function will prepare for a sequence of *_row calls by,
        for example, reserving resources and locking files. 
      */
-    transaction new_trans();
+    transaction new_trans(THD*);
 
 private:
     explicit injector();

--- 1.26/mysql-test/r/insert_select.result	2005-03-14 15:07:15 +01:00
+++ 1.27/mysql-test/r/insert_select.result	2005-03-21 19:24:54 +01:00
@@ -74,8 +74,8 @@
 ERROR 23000: Duplicate entry '2' for key 1
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	191	use `test`; insert into t1 select * from t2
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	195	use `test`; insert into t1 select * from t2
 select * from t1;
 a
 1
@@ -88,7 +88,7 @@
 ERROR 23000: Duplicate entry '1' for key 1
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
 drop table t1;
 create table t1 (a int not null);
 create table t2 (a int not null);

--- 1.22/mysql-test/r/rpl_flush_log_loop.result	2005-03-14 15:07:15 +01:00
+++ 1.23/mysql-test/r/rpl_flush_log_loop.result	2005-03-21 19:24:54 +01:00
@@ -14,4 +14,4 @@
 flush logs;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	SLAVE_PORT	60	slave-bin.000001	207	#	#	slave-bin.000001	Yes	Yes							0		0	207	#	None		0	No						#
+#	127.0.0.1	root	SLAVE_PORT	60	slave-bin.000001	211	#	#	slave-bin.000001	Yes	Yes							0		0	211	#	None		0	No						#

--- 1.27/mysql-test/r/rpl_loaddata.result	2005-03-14 15:07:15 +01:00
+++ 1.28/mysql-test/r/rpl_loaddata.result	2005-03-21 19:24:54 +01:00
@@ -22,7 +22,7 @@
 2003-03-22	2416	a	bbbbb
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-slave-bin.000001	1097		
+slave-bin.000001	1101		
 drop table t1;
 drop table t2;
 drop table t3;
@@ -33,7 +33,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1560	#	#	master-bin.000001	Yes	Yes							0		0	1560	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1564	#	#	master-bin.000001	Yes	Yes							0		0	1564	#	None		0	No						#
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
@@ -43,7 +43,7 @@
 change master to master_user='root';
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1668	#	#	master-bin.000001	No	No							0		0	1668	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1672	#	#	master-bin.000001	No	No							0		0	1672	#	None		0	No						#
 set global sql_slave_skip_counter=1;
 start slave;
 set sql_log_bin=0;
@@ -64,5 +64,5 @@
 ERROR 23000: Duplicate entry '2003-03-22' for key 1
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	537		
+master-bin.000001	541		
 drop table t2;

--- 1.86/sql/slave.h	2005-03-14 15:07:16 +01:00
+++ 1.87/sql/slave.h	2005-03-21 19:24:55 +01:00
@@ -21,10 +21,15 @@
 
 #include "mysql.h"
 #include "my_list.h"
+#include "rpl_tblmap.h"
+
 #define SLAVE_NET_TIMEOUT  3600
 #define MAX_SLAVE_ERRMSG   1024
 #define MAX_SLAVE_ERROR    2000
 
+// Forward declarations
+class table_mapping;
+
 /*****************************************************************************
 
   MySQL Replication
@@ -338,16 +343,8 @@
 	    group_relay_log_pos);
   }
 
-  /*
-    
-  */
-  struct table_entry { ulong table_id; TABLE* table; } *table_array;
-  ulong table_count, table_reserve;
-  ulong  find_pos(ulong table_id) const;
-  TABLE* get_table(ulong table_id);
-  int    set_table(ulong table_id, TABLE* table);
-  int    remove_table(ulong table_id);
-  void   clear_tables();
+  table_mapping m_table_map;
+
   /*
     Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
     the thread save 3 get_charset() per Query_log_event if the charset is not

--- 1.28/mysql-test/r/rpl_replicate_do.result	2005-03-14 15:07:16 +01:00
+++ 1.29/mysql-test/r/rpl_replicate_do.result	2005-03-21 19:24:55 +01:00
@@ -28,4 +28,4 @@
 drop table if exists t1,t2,t11;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1618	#	#	master-bin.000001	Yes	Yes			test.t1				0		0	1618	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1622	#	#	master-bin.000001	Yes	Yes			test.t1				0		0	1622	#	None		0	No						#

--- 1.42/mysql-test/r/rpl_log_pos.result	2005-03-14 15:07:15 +01:00
+++ 1.43/mysql-test/r/rpl_log_pos.result	2005-03-21 19:24:55 +01:00
@@ -6,37 +6,37 @@
 start slave;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	96		
+master-bin.000001	100		
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	96	#	#	master-bin.000001	Yes	Yes							0		0	96	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	100	#	#	master-bin.000001	Yes	Yes							0		0	100	#	None		0	No						#
 stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
 start slave;
 stop slave;
-change master to master_log_pos=73;
+change master to master_log_pos=74;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73	#	#	master-bin.000001	No	No							0		0	73	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	No							0		0	74	#	None		0	No						#
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	73	#	#	master-bin.000001	No	Yes							0		0	73	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	74	#	#	master-bin.000001	No	Yes							0		0	74	#	None		0	No						#
 stop slave;
-change master to master_log_pos=173;
+change master to master_log_pos=177;
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	173	#	#	master-bin.000001	No	Yes							0		0	173	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	177	#	#	master-bin.000001	No	Yes							0		0	177	#	None		0	No						#
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	96		
+master-bin.000001	100		
 create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
 insert into t1 values (1),(2),(3);
 stop slave;
-change master to master_log_pos=96;
+change master to master_log_pos=100;
 start slave;
 select * from t1;
 n

--- 1.34/mysql-test/r/rpl000015.result	2005-03-14 15:07:15 +01:00
+++ 1.35/mysql-test/r/rpl000015.result	2005-03-21 19:24:54 +01:00
@@ -1,7 +1,7 @@
 reset master;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	96		
+master-bin.000001	100		
 reset slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
@@ -17,7 +17,7 @@
 start slave;
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	7	master-bin.000001	96	#	#	master-bin.000001	Yes	Yes							0		0	96	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	7	master-bin.000001	100	#	#	master-bin.000001	Yes	Yes							0		0	100	#	None		0	No						#
 drop table if exists t1;
 create table t1 (n int);
 insert into t1 values (10),(45),(90);

--- 1.66/mysql-test/r/rpl_rotate_logs.result	2005-03-14 15:07:16 +01:00
+++ 1.67/mysql-test/r/rpl_rotate_logs.result	2005-03-21 19:24:55 +01:00
@@ -16,7 +16,7 @@
 insert into t1 values('Could not break slave'),('Tried hard');
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	60	master-bin.000001	550	#	#	master-bin.000001	Yes	Yes							0		0	550	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	60	master-bin.000001	554	#	#	master-bin.000001	Yes	Yes							0		0	554	#	None		0	No						#
 select * from t1;
 s
 Could not break slave
@@ -57,7 +57,7 @@
 insert into t2 values (65);
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	60	master-bin.000003	498	#	#	master-bin.000003	Yes	Yes							0		0	498	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	60	master-bin.000003	502	#	#	master-bin.000003	Yes	Yes							0		0	502	#	None		0	No						#
 select * from t2;
 m
 34
@@ -79,13 +79,13 @@
 master-bin.000005
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000005	2051		
+master-bin.000005	2148		
 select * from t4;
 a
 testing temporary tables part 2
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	60	master-bin.000005	2051	#	#	master-bin.000005	Yes	Yes							0		0	2051	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	60	master-bin.000005	2148	#	#	master-bin.000005	Yes	Yes							0		0	2148	#	None		0	No						#
 lock tables t3 read;
 select count(*) from t3 where n >= 4;
 count(*)

--- 1.56/mysql-test/r/rpl_log.result	2005-03-14 15:07:15 +01:00
+++ 1.57/mysql-test/r/rpl_log.result	2005-03-21 19:24:54 +01:00
@@ -19,25 +19,25 @@
 drop table t1;
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001	218	Intvar	1	246	INSERT_ID=1
-master-bin.000001	246	Query	1	338	use `test`; insert into t1 values (NULL)
-master-bin.000001	338	Query	1	415	use `test`; drop table t1
-master-bin.000001	415	Query	1	519	use `test`; create table t1 (word char(20) not null)
-master-bin.000001	519	Create_file	1	1189	db=test;table=t1;file_id=1;block_len=581
-master-bin.000001	1189	Exec_load	1	1212	;file_id=1
-master-bin.000001	1212	Query	1	1289	use `test`; drop table t1
-show binlog events from 96 limit 1;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-show binlog events from 96 limit 2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001	218	Intvar	1	246	INSERT_ID=1
-show binlog events from 96 limit 2,1;
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001	222	Intvar	1	250	INSERT_ID=1
+master-bin.000001	250	Query	1	342	use `test`; insert into t1 values (NULL)
+master-bin.000001	342	Query	1	419	use `test`; drop table t1
+master-bin.000001	419	Query	1	523	use `test`; create table t1 (word char(20) not null)
+master-bin.000001	523	Create_file	1	1193	db=test;table=t1;file_id=1;block_len=581
+master-bin.000001	1193	Exec_load	1	1216	;file_id=1
+master-bin.000001	1216	Query	1	1293	use `test`; drop table t1
+show binlog events from 100 limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+show binlog events from 100 limit 2;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001	222	Intvar	1	250	INSERT_ID=1
+show binlog events from 100 limit 2,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	246	Query	1	338	use `test`; insert into t1 values (NULL)
+master-bin.000001	250	Query	1	342	use `test`; insert into t1 values (NULL)
 flush logs;
 create table t5 (a int);
 drop table t5;
@@ -49,24 +49,24 @@
 drop table t1;
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001	218	Intvar	1	246	INSERT_ID=1
-master-bin.000001	246	Query	1	338	use `test`; insert into t1 values (NULL)
-master-bin.000001	338	Query	1	415	use `test`; drop table t1
-master-bin.000001	415	Query	1	519	use `test`; create table t1 (word char(20) not null)
-master-bin.000001	519	Create_file	1	1189	db=test;table=t1;file_id=1;block_len=581
-master-bin.000001	1189	Exec_load	1	1212	;file_id=1
-master-bin.000001	1212	Query	1	1289	use `test`; drop table t1
-master-bin.000001	1289	Rotate	1	1333	master-bin.000002;pos=4
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001	222	Intvar	1	250	INSERT_ID=1
+master-bin.000001	250	Query	1	342	use `test`; insert into t1 values (NULL)
+master-bin.000001	342	Query	1	419	use `test`; drop table t1
+master-bin.000001	419	Query	1	523	use `test`; create table t1 (word char(20) not null)
+master-bin.000001	523	Create_file	1	1193	db=test;table=t1;file_id=1;block_len=581
+master-bin.000001	1193	Exec_load	1	1216	;file_id=1
+master-bin.000001	1216	Query	1	1293	use `test`; drop table t1
+master-bin.000001	1293	Rotate	1	1337	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002';
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000002	96	Query	1	183	use `test`; create table t5 (a int)
-master-bin.000002	183	Query	1	260	use `test`; drop table t5
-master-bin.000002	260	Query	1	347	use `test`; create table t1 (n int)
-master-bin.000002	347	Query	1	436	use `test`; insert into t1 values (1)
-master-bin.000002	436	Query	1	513	use `test`; drop table t1
+master-bin.000002	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000002	100	Query	1	187	use `test`; create table t5 (a int)
+master-bin.000002	187	Query	1	264	use `test`; drop table t5
+master-bin.000002	264	Query	1	351	use `test`; create table t1 (n int)
+master-bin.000002	351	Query	1	440	use `test`; insert into t1 values (1)
+master-bin.000002	440	Query	1	517	use `test`; drop table t1
 show binary logs;
 Log_name
 master-bin.000001
@@ -78,26 +78,26 @@
 slave-bin.000002
 show binlog events in 'slave-bin.000001' from 4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	4	Format_desc	2	96	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	96	Query	1	218	use `test`; create table t1(n int not null auto_increment primary key)
-slave-bin.000001	218	Intvar	1	246	INSERT_ID=1
-slave-bin.000001	246	Query	1	338	use `test`; insert into t1 values (NULL)
-slave-bin.000001	338	Query	1	415	use `test`; drop table t1
-slave-bin.000001	415	Query	1	519	use `test`; create table t1 (word char(20) not null)
-slave-bin.000001	519	Create_file	1	1198	db=test;table=t1;file_id=1;block_len=581
-slave-bin.000001	1198	Exec_load	1	1221	;file_id=1
-slave-bin.000001	1221	Query	1	1298	use `test`; drop table t1
-slave-bin.000001	1298	Query	1	1385	use `test`; create table t5 (a int)
-slave-bin.000001	1385	Query	1	1462	use `test`; drop table t5
-slave-bin.000001	1462	Rotate	2	1505	slave-bin.000002;pos=4
+slave-bin.000001	4	Format_desc	2	100	Server ver: VERSION, Binlog ver: 4
+slave-bin.000001	100	Query	1	222	use `test`; create table t1(n int not null auto_increment primary key)
+slave-bin.000001	222	Intvar	1	250	INSERT_ID=1
+slave-bin.000001	250	Query	1	342	use `test`; insert into t1 values (NULL)
+slave-bin.000001	342	Query	1	419	use `test`; drop table t1
+slave-bin.000001	419	Query	1	523	use `test`; create table t1 (word char(20) not null)
+slave-bin.000001	523	Create_file	1	1202	db=test;table=t1;file_id=1;block_len=581
+slave-bin.000001	1202	Exec_load	1	1225	;file_id=1
+slave-bin.000001	1225	Query	1	1302	use `test`; drop table t1
+slave-bin.000001	1302	Query	1	1389	use `test`; create table t5 (a int)
+slave-bin.000001	1389	Query	1	1466	use `test`; drop table t5
+slave-bin.000001	1466	Rotate	2	1509	slave-bin.000002;pos=4
 show binlog events in 'slave-bin.000002' from 4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	4	Format_desc	2	96	Server ver: VERSION, Binlog ver: 4
-slave-bin.000002	96	Query	1	183	use `test`; create table t1 (n int)
-slave-bin.000002	183	Query	1	272	use `test`; insert into t1 values (1)
-slave-bin.000002	272	Query	1	349	use `test`; drop table t1
+slave-bin.000002	4	Format_desc	2	100	Server ver: VERSION, Binlog ver: 4
+slave-bin.000002	100	Query	1	187	use `test`; create table t1 (n int)
+slave-bin.000002	187	Query	1	276	use `test`; insert into t1 values (1)
+slave-bin.000002	276	Query	1	353	use `test`; drop table t1
 show slave status;
 Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	513	#	#	master-bin.000002	Yes	Yes							0		0	513	#	None		0	No						#
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000002	517	#	#	master-bin.000002	Yes	Yes							0		0	517	#	None		0	No						#
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log

--- 1.28/mysql-test/r/user_var.result	2005-03-14 15:07:16 +01:00
+++ 1.29/mysql-test/r/user_var.result	2005-03-21 19:24:55 +01:00
@@ -176,13 +176,13 @@
 set @var1= "';aaa";
 SET @var2=char(ascii('a'));
 insert into t1 values (@var1),(@var2);
-show binlog events from 96;
+show binlog events from 100;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	96	User var	1	137	@`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
-master-bin.000001	137	Query	1	230	use `test`; INSERT INTO t1 VALUES(@`a b`)
-master-bin.000001	230	User var	1	272	@`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001	272	User var	1	310	@`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
-master-bin.000001	310	Query	1	411	use `test`; insert into t1 values (@var1),(@var2)
+master-bin.000001	100	User var	1	141	@`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001	141	Query	1	234	use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001	234	User var	1	276	@`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001	276	User var	1	314	@`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
+master-bin.000001	314	Query	1	415	use `test`; insert into t1 values (@var1),(@var2)
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 ROLLBACK;

--- 1.3/mysql-test/t/binlog.test	2005-02-23 20:35:46 +01:00
+++ 1.4/mysql-test/t/binlog.test	2005-03-21 19:24:55 +01:00
@@ -19,7 +19,7 @@
 commit;
 # first COMMIT must be Query_log_event, second - Xid_log_event
 --replace_result "xid=18" "xid=11"
-show binlog events from 96;
+show binlog events from 100;
 drop table t1,t2;
 
 #
@@ -40,6 +40,6 @@
 commit;
 drop table t1;
 --replace_result "xid=29" "xid=18"
-show binlog events in 'master-bin.000001' from 96;
-show binlog events in 'master-bin.000002' from 96;
+show binlog events in 'master-bin.000001' from 100;
+show binlog events in 'master-bin.000002' from 100;
 

--- 1.17/mysql-test/r/rpl_temporary.result	2005-03-14 15:07:16 +01:00
+++ 1.18/mysql-test/r/rpl_temporary.result	2005-03-21 19:24:55 +01:00
@@ -38,19 +38,19 @@
 7
 show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	96	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	96	Query	1	186	use `test`; drop table if exists t1,t2
-master-bin.000001	186	Query	1	272	use `test`; create table t1(f int)
-master-bin.000001	272	Query	1	358	use `test`; create table t2(f int)
-master-bin.000001	358	Query	1	484	use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
-master-bin.000001	484	Query	1	580	use `test`; create temporary table t3(f int)
-master-bin.000001	580	Query	1	685	use `test`; insert into t3 select * from t1 where f<6
-master-bin.000001	685	Query	1	781	use `test`; create temporary table t3(f int)
-master-bin.000001	781	Query	1	883	use `test`; insert into t2 select count(*) from t3
-master-bin.000001	883	Query	1	989	use `test`; insert into t3 select * from t1 where f>=4
-master-bin.000001	989	Query	1	1076	use `test`; drop temporary table t3
-master-bin.000001	1076	Query	1	1178	use `test`; insert into t2 select count(*) from t3
-master-bin.000001	1178	Query	1	1265	use `test`; drop temporary table t3
+master-bin.000001	4	Format_desc	1	100	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	100	Query	1	190	use `test`; drop table if exists t1,t2
+master-bin.000001	190	Query	1	276	use `test`; create table t1(f int)
+master-bin.000001	276	Query	1	362	use `test`; create table t2(f int)
+master-bin.000001	362	Query	1	488	use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
+master-bin.000001	488	Query	1	584	use `test`; create temporary table t3(f int)
+master-bin.000001	584	Query	1	689	use `test`; insert into t3 select * from t1 where f<6
+master-bin.000001	689	Query	1	785	use `test`; create temporary table t3(f int)
+master-bin.000001	785	Query	1	887	use `test`; insert into t2 select count(*) from t3
+master-bin.000001	887	Query	1	993	use `test`; insert into t3 select * from t1 where f>=4
+master-bin.000001	993	Query	1	1080	use `test`; drop temporary table t3
+master-bin.000001	1080	Query	1	1182	use `test`; insert into t2 select count(*) from t3
+master-bin.000001	1182	Query	1	1269	use `test`; drop temporary table t3
 drop table t1, t2;
 use test;
 SET TIMESTAMP=1040323920;
Thread
bk commit into 5.1 tree (mats:1.1796)Mats Kindahl21 Mar