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://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1774 05/03/10 20:10:16 mats@stripped +63 -0
WL#1012: Row-level binary logging
Submitting an (incomplete) patch of what is available this far
for row-level logging so that it is possible to start reviewing.
Please observe that this is not the final version and that there
are functionality missing. The patch passes the basic tests, but
not the transactional tests in rpl_row_trans.
mysql-test/t/rpl_row_trans.test
1.1 05/03/10 20:10:09 mats@stripped +40 -0
mysql-test/t/rpl_row_trans-slave.opt
1.1 05/03/10 20:10:09 mats@stripped +1 -0
mysql-test/t/rpl_row_trans-master.opt
1.1 05/03/10 20:10:09 mats@stripped +2 -0
mysql-test/t/rpl_row_basic.test
1.1 05/03/10 20:10:09 mats@stripped +104 -0
mysql-test/t/rpl_row_trans.test
1.0 05/03/10 20:10:09 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_trans.test
mysql-test/t/rpl_row_trans-slave.opt
1.0 05/03/10 20:10:09 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_trans-slave.opt
mysql-test/t/rpl_row_trans-master.opt
1.0 05/03/10 20:10:09 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_trans-master.opt
mysql-test/t/rpl_row_basic.test
1.0 05/03/10 20:10:09 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_basic.test
mysql-test/t/rpl_row_basic-slave.opt
1.1 05/03/10 20:10:08 mats@stripped +1 -0
mysql-test/t/rpl_row_basic-master.opt
1.1 05/03/10 20:10:08 mats@stripped +2 -0
mysql-test/r/rpl_row_trans.result
1.1 05/03/10 20:10:08 mats@stripped +58 -0
mysql-test/r/rpl_row_basic.result
1.1 05/03/10 20:10:08 mats@stripped +210 -0
sql/sql_update.cc
1.141 05/03/10 20:10:08 mats@stripped +12 -8
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_udf.cc
1.41 05/03/10 20:10:08 mats@stripped +2 -2
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_table.cc
1.212 05/03/10 20:10:08 mats@stripped +1 -1
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_show.cc
1.205 05/03/10 20:10:08 mats@stripped +15 -15
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_select.cc
1.278 05/03/10 20:10:08 mats@stripped +14 -14
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_insert.cc
1.137 05/03/10 20:10:08 mats@stripped +12 -7
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_delete.cc
1.138 05/03/10 20:10:08 mats@stripped +10 -4
Using new handler member function names for {write,delete,update}_row
calls.
sql/sql_class.h
1.212 05/03/10 20:10:08 mats@stripped +5 -0
Field to keep pending events available.
mysql-test/t/rpl_row_basic-slave.opt
1.0 05/03/10 20:10:08 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_basic-slave.opt
mysql-test/t/rpl_row_basic-master.opt
1.0 05/03/10 20:10:08 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/t/rpl_row_basic-master.opt
mysql-test/r/rpl_row_trans.result
1.0 05/03/10 20:10:08 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/r/rpl_row_trans.result
mysql-test/r/rpl_row_basic.result
1.0 05/03/10 20:10:08 mats@stripped +0 -0
BitKeeper file /home/bk/w1012-mysql-5.1/mysql-test/r/rpl_row_basic.result
sql/sql_class.cc
1.162 05/03/10 20:10:07 mats@stripped +1 -0
Field to keep pending events available.
sql/sql_acl.cc
1.131 05/03/10 20:10:07 mats@stripped +21 -21
Using new handler member function names for {write,delete,update}_row
calls.
sql/sp.cc
1.66 05/03/10 20:10:07 mats@stripped +4 -4
Using new handler member function names for {write,delete,update}_row
calls.
sql/slave.h
1.83 05/03/10 20:10:07 mats@stripped +11 -0
Adding code for keeping track of table mappings in slave thread.
sql/slave.cc
1.233 05/03/10 20:10:07 mats@stripped +82 -2
Adding code for keeping track of table mappings in slave thread.
sql/mysqld.cc
1.436 05/03/10 20:10:07 mats@stripped +39 -0
Handling new options for controlling on row-level logging.
sql/mysql_priv.h
1.248 05/03/10 20:10:07 mats@stripped +2 -0
Handling new options for controlling on row-level logging.
sql/log_event.h
1.101 05/03/10 20:10:07 mats@stripped +435 -1
Added new row-level events.
sql/log_event.cc
1.153 05/03/10 20:10:07 mats@stripped +945 -3
Added new row-level events.
sql/log.cc
1.137 05/03/10 20:10:07 mats@stripped +24 -7
Adding code to control logging of events to support row-level events.
sql/item_sum.cc
1.117 05/03/10 20:10:07 mats@stripped +2 -2
Using new handler member function names for {write,delete,update}_row
calls.
sql/handler.h
1.122 05/03/10 20:10:07 mats@stripped +262 -6
Added code to intercept all {write,delete,update}_row calls to handler
and write row-level events to the binary log.
sql/handler.cc
1.134 05/03/10 20:10:07 mats@stripped +319 -0
Added code to intercept all {write,delete,update}_row calls to handler
and write row-level events to the binary log.
mysql-test/t/user_var.test
1.19 05/03/10 20:10:07 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/t/rpl_log.test
1.24 05/03/10 20:10:07 mats@stripped +3 -3
Changed test since binlog positions changed.
mysql-test/t/rpl_loaddata_rule_s.test
1.5 05/03/10 20:10:07 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/t/rpl_loaddata_rule_m.test
1.7 05/03/10 20:10:07 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/t/rpl_error_ignored_table.test
1.12 05/03/10 20:10:07 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/t/rpl_charset.test
1.11 05/03/10 20:10:07 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/t/mysqlbinlog2.test
1.3 05/03/10 20:10:06 mats@stripped +8 -8
Changed test since binlog positions changed.
mysql-test/t/mysqlbinlog.test
1.13 05/03/10 20:10:06 mats@stripped +2 -2
Changed test since binlog positions changed.
mysql-test/t/mix_innodb_myisam_binlog.test
1.11 05/03/10 20:10:06 mats@stripped +12 -12
Changed test since binlog positions changed.
mysql-test/t/ctype_ucs.test
1.23 05/03/10 20:10:06 mats@stripped +1 -1
Changed test since binlog positions changed.
mysql-test/r/user_var.result
1.24 05/03/10 20:10:06 mats@stripped +6 -6
Changed result file since binlog positions changed.
mysql-test/r/rpl_until.result
1.17 05/03/10 20:10:06 mats@stripped +12 -12
Changed result file since binlog positions changed.
mysql-test/r/rpl_timezone.result
1.5 05/03/10 20:10:06 mats@stripped +7 -7
Changed result file since binlog positions changed.
mysql-test/r/rpl_temporary.result
1.14 05/03/10 20:10:06 mats@stripped +13 -13
Changed result file since binlog positions changed.
mysql-test/r/rpl_server_id2.result
1.7 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_server_id1.result
1.6 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_rotate_logs.result
1.59 05/03/10 20:10:06 mats@stripped +4 -4
Changed result file since binlog positions changed.
mysql-test/r/rpl_reset_slave.result
1.12 05/03/10 20:10:06 mats@stripped +3 -3
Changed result file since binlog positions changed.
mysql-test/r/rpl_replicate_do.result
1.25 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_relayrotate.result
1.11 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_max_relay_size.result
1.16 05/03/10 20:10:06 mats@stripped +6 -6
Changed result file since binlog positions changed.
mysql-test/r/rpl_log.result
1.53 05/03/10 20:10:06 mats@stripped +51 -51
Changed result file since binlog positions changed.
mysql-test/r/rpl_loaddata_rule_s.result
1.6 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_loaddata_rule_m.result
1.10 05/03/10 20:10:06 mats@stripped +3 -3
Changed result file since binlog positions changed.
mysql-test/r/rpl_loaddata.result
1.24 05/03/10 20:10:06 mats@stripped +4 -4
Changed result file since binlog positions changed.
mysql-test/r/rpl_flush_tables.result
1.8 05/03/10 20:10:06 mats@stripped +17 -17
Changed result file since binlog positions changed.
mysql-test/r/rpl_flush_log_loop.result
1.19 05/03/10 20:10:06 mats@stripped +1 -1
Changed result file since binlog positions changed.
mysql-test/r/rpl_error_ignored_table.result
1.16 05/03/10 20:10:06 mats@stripped +11 -11
Changed result file since binlog positions changed.
mysql-test/r/rpl_change_master.result
1.12 05/03/10 20:10:06 mats@stripped +2 -2
Changed result file since binlog positions changed.
mysql-test/r/rpl000015.result
1.33 05/03/10 20:10:06 mats@stripped +2 -2
Changed result file since binlog positions changed.
mysql-test/r/mix_innodb_myisam_binlog.result
1.13 05/03/10 20:10:06 mats@stripped +59 -59
Changed result file since binlog positions changed.
mysql-test/r/insert_select.result
1.23 05/03/10 20:10:06 mats@stripped +3 -3
Changed result file since binlog positions changed.
mysql-test/r/drop_temp_table.result
1.11 05/03/10 20:10:06 mats@stripped +5 -5
Changed result file since binlog positions changed.
mysql-test/r/ctype_ucs.result
1.25 05/03/10 20:10:06 mats@stripped +3 -3
Changed result file since binlog positions changed.
# 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.133/sql/handler.cc 2005-01-07 15:38:31 +01:00
+++ 1.134/sql/handler.cc 2005-03-10 20:10:07 +01:00
@@ -2104,3 +2104,322 @@
}
return &known_extensions;
}
+
+/**************************************************************************
+ Pending_rows_events member functions
+**************************************************************************/
+
+int Pending_rows_events::
+set(THD* thd, Rows_log_event* ev)
+{
+ DBUG_ENTER("Pending_rows_events::set(THD*, Rows_log_event*)");
+ thd->transaction.m_pending_rows_event = ev;
+ DBUG_RETURN(0); // Ok
+}
+
+Rows_log_event* Pending_rows_events::
+get(THD* thd) const
+{
+ DBUG_ENTER("Pending_rows_events::get(THD*)");
+ Rows_log_event* ev = thd->transaction.m_pending_rows_event;
+ DBUG_RETURN(ev);
+}
+
+/**************************************************************************
+ Row_rw_base member functions
+**************************************************************************/
+
+size_t Row_rw_base::
+max_row_length(const byte * const record) const
+{
+ DBUG_ENTER("Row_rw_base::max_row_length");
+ DBUG_PRINT("enter", ("record = 0x%0x", record));
+
+ size_t length = m_table->s->reclength + 2 * m_table->s->fields;
+ uint* const beg = m_table->s->blob_field;
+ uint* const end = beg + m_table->s->blob_fields;
+
+ for (uint *ptr = beg ; ptr != end ; ++ptr)
+ {
+ Field_blob* const blob = (Field_blob*) m_table->field[*ptr];
+ length += blob->get_length(record + blob->offset()) + 2;
+ }
+
+ DBUG_RETURN(length);
+}
+
+size_t Row_rw_base::
+pack_row(byte *row_data, size_t max_size, const byte *record) const
+{
+ DBUG_ENTER("Row_rw_base::pack_row");
+ DBUG_PRINT("enter", ("row_data = %p, max_size = %lu, record = %p",
+ row_data, max_size, record));
+
+ byte *ptr = row_data;
+
+ bzero(row_data, max_size);
+
+ memcpy(row_data, record, m_table->s->null_bytes);
+ ptr += m_table->s->null_bytes;
+
+ for ( Field **field = m_table->field ; *field ; ++field)
+ {
+ ptrdiff_t const offset = (*field)->offset();
+ ptr = (*field)->pack(ptr, record + offset);
+ DBUG_PRINT("info", ("Packing length %d field '%s' from %p to %p + %d",
+ (*field)->field_length, (*field)->field_name,
+ ptr, record, offset));
+ }
+
+ // ptrdiff_t is signed, size_t is unsigned. Check that the conversion
+ // will work correctly.
+ DBUG_ASSERT(ptr - row_data >= 0);
+ size_t const size = (size_t) (ptr - row_data);
+ DBUG_PRINT("return", ("size = %lu", size));
+ DBUG_RETURN(size);
+}
+
+/**************************************************************************
+ 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)
+{
+ DBUG_ENTER("Row_writer::write_row");
+ DBUG_PRINT("enter", ("record = 0x%0x", record));
+
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ THD* const thd = current_thd;
+
+ /*
+ Pack records into format for transfer. We are allocating more
+ memory than needed, but that doesn't matter.
+ */
+ size_t const max_len = max_row_length(record);
+ byte* const row_data = my_malloc(max_len, MYF(MY_WME));
+ size_t const len = pack_row(row_data, max_len, record);
+
+ Rows_log_event* const
+ ev = prepare_pending<Write_rows_log_event>(thd, len);
+
+ if (ev == NULL)
+ DBUG_RETURN(1);
+
+ 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)
+{
+ DBUG_ENTER("Row_writer::update_row");
+ DBUG_PRINT("enter", ("before: 0x%0x; after: 0x%0x",
+ before_record, after_record));
+
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ THD* const thd = current_thd;
+
+ size_t const before_maxlen = max_row_length(before_record);
+ size_t const after_maxlen = max_row_length(after_record);
+
+ byte *before_row, *after_row;
+ byte* const memory = my_multi_malloc(MYF(MY_WME),
+ &before_row, before_maxlen,
+ &after_row, after_maxlen,
+ NULL);
+
+ size_t const before_size = pack_row(before_row, before_maxlen, before_record);
+ 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);
+
+ if (ev == NULL)
+ DBUG_RETURN(1);
+
+ ev->add_row_data(before_row, before_size);
+ ev->add_row_data(after_row, after_size);
+
+ // add_row_data copies row_data to internal buffer
+ my_free(memory, MYF(MY_WME));
+
+
+ DBUG_RETURN(0);
+}
+
+int Row_writer::
+delete_row(byte const *record)
+{
+ DBUG_ENTER("Row_writer::delete_row");
+ DBUG_PRINT("enter", ("record = 0x%0x", record));
+
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ THD* const thd = current_thd;
+
+ /*
+ Pack records into format for transfer. We are allocating more
+ memory than needed, but that doesn't matter.
+ */
+ size_t const max_len = max_row_length(record);
+ byte* const row_data = my_malloc(max_len, MYF(MY_WME));
+ size_t const len = pack_row(row_data, max_len, record);
+
+ Rows_log_event* const
+ ev = prepare_pending<Delete_rows_log_event>(thd, len);
+
+ if (ev == NULL)
+ DBUG_RETURN(1);
+
+ ev->add_row_data(row_data, len);
+
+ // add_row_data copies row_data
+ my_free(row_data, MYF(MY_WME));
+
+ DBUG_RETURN(0);
+}
+
+int Row_writer::
+write_table_map()
+{
+ DBUG_ENTER("Row_writer::write_table_map()");
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ 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))
+ DBUG_RETURN(1);
+ DBUG_RETURN(0);
+}
+
+
+int Row_writer::
+flush_pending_event(bool stmt_end)
+{
+ DBUG_ENTER("Row_writer::flush_pending_event(bool)");
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ THD* const thd = current_thd;
+ /*
+ Mark the event as the last event of a statement if the stmt_end flag is
+ set.
+ */
+ if (stmt_end) {
+ if (Rows_log_event* pending = m_pending.get(thd)) {
+ 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);
+ DBUG_RETURN(error);
+}
--- 1.121/sql/handler.h 2005-01-07 15:38:58 +01:00
+++ 1.122/sql/handler.h 2005-03-10 20:10:07 +01:00
@@ -293,6 +293,161 @@
} HANDLER_BUFFER;
+class Rows_log_event;
+
+/*****************************************************************************
+
+ Row event reader/writer base class.
+
+ The row event reader/writer base class contain support utilities to
+ help the row reader and row writer to perform its tasks.
+
+ The responsibilities are:
+ - Provide packing and unpacking utilities for subclasses.
+
+*****************************************************************************/
+
+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 !!! */)
+ {
+ }
+
+ virtual ~Row_rw_base() { }
+
+protected:
+ size_t max_row_length(const byte *data) const;
+ size_t pack_row(byte *row_data, size_t max_len, const byte *data) const;
+
+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);
+};
+
+
+/*****************************************************************************
+
+ Row event writer class.
+
+ The row event writer serves as a facade to the real row-level
+ events. It takes care of writing row log events at the apropriate
+ times, creating new row-level events when needed and writes them to
+ the binary log when required.
+
+ RESPONSIBILITIES
+
+ - Keeping a mapping from tables to table ids.
+ - Packing rows for transmission to the slave.
+ - Creating events and store the received rows in the event.
+ - Keeping track of the size of the event and ensure that the events
+ are within correct bounds.
+ - Sending events to the binary log.
+
+ COLLABORATION
+
+ Write_rows_log_event
+ Delete_rows_log_event
+ Update_rows_log_event
+
+ ****************************************************************************/
+
+class handler;
+
+class Row_writer : public Row_rw_base
+{
+public:
+ Row_writer(THD *thd, TABLE *table, bool has_trans)
+ : Row_rw_base(thd, table), m_has_trans(has_trans)
+ {
+ }
+
+ ~Row_writer() {}
+
+ /* Get table id for a table */
+ table_id get_table_id(TABLE* tbl) const;
+
+ int write_row(const byte *buf);
+ int update_row(const byte *old_data, const byte *new_data);
+ int delete_row(const byte *buf);
+
+ int stmt_begin() {
+ return write_table_map();
+ }
+
+ int stmt_end() {
+ return flush_pending_event(true);
+ }
+
+private:
+ 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;
+ 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
{
protected:
@@ -351,6 +506,52 @@
bool auto_increment_column_changed;
bool implicit_emptied; /* Can be !=0 only if HEAP */
+#if 0
+ /*
+ A sentry class to perform prefix and suffix operations.
+
+ Mimicing the nested sentry from IOStreams, we here introduce a
+ sentry class for the handler. Prior to doing any ha_*_row
+ operations, you should create an instance of the sentry class
+ (perferably an auto instance). This will perform prefix operations
+ for the ha_*_row operations. Upon destruction of the sentry, the
+ suffix operations will be executed, which include flushing any
+ pending events.
+
+ After construction of the sentry object, you should check that the
+ prefix operation succeeded by using the good() member function
+ below.
+
+ The sentry class is a friend of the handler class, i.e., it has
+ access to private members of the class. This is not strictly by
+ the standard, but works well for almost all compilers.
+ */
+ friend class sentry;
+ class sentry {
+ public:
+ sentry(THD* thd, handler* ha)
+ : m_thd(thd), m_ha(ha)
+ {
+ DBUG_ENTER("handler::sentry::sentry(THD*, handler*)");
+ DBUG_VOID_RETURN;
+ }
+
+ ~sentry()
+ {
+ DBUG_ENTER("handler::sentry::~sentry()");
+ m_ha->m_row_writer.flush_and_set_event(m_thd, 0);
+ DBUG_VOID_RETURN;
+ }
+
+ // For now, the sentry prefix operations cannot fail
+ bool good() const { return true; }
+ int state() const { return 0; }
+
+ private:
+ THD* m_thd;
+ handler* m_ha;
+ };
+#endif
handler(TABLE *table_arg) :table(table_arg),
ref(0), data_file_length(0), max_data_file_length(0), index_file_length(0),
@@ -359,7 +560,8 @@
create_time(0), check_time(0), update_time(0),
key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), block_size(0),
- raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0)
+ raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0),
+ m_row_writer(current_thd, table_arg, has_transactions())
{}
virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ }
int ha_open(const char *name, int mode, int test_if_locked);
@@ -423,11 +625,52 @@
uint get_index(void) const { return active_index; }
virtual int open(const char *name, int mode, uint test_if_locked)=0;
virtual int close(void)=0;
- virtual int write_row(byte * buf) { return HA_ERR_WRONG_COMMAND; }
- virtual int update_row(const byte * old_data, byte * new_data)
- { return HA_ERR_WRONG_COMMAND; }
- virtual int delete_row(const byte * buf)
- { return HA_ERR_WRONG_COMMAND; }
+
+ 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_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(); }
+
virtual int index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{ return HA_ERR_WRONG_COMMAND; }
@@ -604,6 +847,19 @@
{
return memcmp(ref1, ref2, ref_length);
}
+private:
+ /*
+ Row-level primitives for storage engines.
+ These should be overridden by the storage engine class. To call
+ these methods, use the corresponding 'ha_*' method above.
+ */
+ virtual int write_row(byte * buf) { return HA_ERR_WRONG_COMMAND; }
+ virtual int update_row(const byte * old_data, byte * new_data)
+ { return HA_ERR_WRONG_COMMAND; }
+ virtual int delete_row(const byte * buf)
+ { return HA_ERR_WRONG_COMMAND; }
+
+ Row_writer m_row_writer;
};
/* Some extern variables used with handlers */
--- 1.116/sql/item_sum.cc 2005-01-15 11:28:32 +01:00
+++ 1.117/sql/item_sum.cc 2005-03-10 20:10:07 +01:00
@@ -1258,7 +1258,7 @@
restore_record(table,default_values) in setup()
*/
memcpy(buf + item->rec_offset, key, item->tree->size_of_element);
- if ((error = item->table->file->write_row(buf)))
+ if ((error = item->table->file->ha_write_row(buf)))
{
if (error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE)
@@ -1510,7 +1510,7 @@
tree->custom_arg))
return 1;
}
- else if ((error=table->file->write_row(table->record[0])))
+ else if ((error=table->file->ha_write_row(table->record[0])))
{
if (error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE)
--- 1.136/sql/log.cc 2005-01-07 13:51:33 +01:00
+++ 1.137/sql/log.cc 2005-03-10 20:10:07 +01:00
@@ -1289,8 +1289,14 @@
bool called_handler_commit=0;
bool error=0;
bool should_rotate = 0;
- DBUG_ENTER("MYSQL_LOG::write(event)");
+ DBUG_ENTER("MYSQL_LOG::write(Log_event*)");
+ /*
+ Let the event decide if it want to go to the binlog.
+ */
+ if (!event_info->write_to_binlog())
+ DBUG_RETURN(0); // Silently succeed
+
pthread_mutex_lock(&LOCK_log);
/*
@@ -1305,12 +1311,23 @@
#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)
- - or if the event asks for it (cache_stmt == true).
+ Write to the binlog cache if any of the following conditions are true:
+
+ - The event asks for it (cache_stmt == true).
+
+ - The event can be cached (can_be_cached() == true) and the cache is not
+ already empty (meaning we're in a transaction). [can_be_cached() is
+ currently not used since it seems not to work as I expected. /Matz]
+
+ 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).
+
+ Events that cannot be cached are typically row-level events for a
+ non-transactional table. In contrast with statement-level events, these
+ can (and should) be written directly to the log file and not stored in
+ the cache.
*/
if (opt_using_transactions &&
(event_info->get_cache_stmt() ||
--- 1.152/sql/log_event.cc 2005-01-16 21:07:22 +01:00
+++ 1.153/sql/log_event.cc 2005-03-10 20:10:07 +01:00
@@ -271,6 +271,10 @@
case RAND_EVENT: return "RAND";
case USER_VAR_EVENT: return "User var";
case FORMAT_DESCRIPTION_EVENT: return "Format_desc";
+ case TABLE_MAP_EVENT: return "Table_map";
+ case WRITE_ROWS_EVENT: return "Write_rows";
+ case UPDATE_ROWS_EVENT: return "Update_rows";
+ case DELETE_ROWS_EVENT: return "Delete_rows";
default: return "Unknown"; /* impossible */
}
}
@@ -517,6 +521,9 @@
/* Store number of bytes that will be written by this event */
data_written= event_data_length + sizeof(header);
+ DBUG_PRINT("info", ("event length is %d (header) + %d (data) = %d bytes",
+ sizeof(header), event_data_length, data_written));
+
/*
log_pos != 0 if this is relay-log event. In this case we should not
change the position
@@ -672,6 +679,7 @@
const Format_description_log_event *description_event)
#endif
{
+ DBUG_ENTER("Log_event::read_log_event(IO_CACHE*,...)");
DBUG_ASSERT(description_event);
char head[LOG_EVENT_MINIMAL_HEADER_LEN];
/*
@@ -696,7 +704,7 @@
next my_b_read() fails (below), it will be an error as we were able to
read the first bytes.
*/
- return 0;
+ DBUG_RETURN(0);
}
uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
@@ -704,6 +712,10 @@
const char *error= 0;
Log_event *res= 0;
+ DBUG_PRINT("info", ("event length is %d bytes", data_len));
+ DBUG_PRINT("info", ("max_allowed_packet=%d, header_size=%d",
+ max_allowed_packet, header_size));
+
if (data_len > max_allowed_packet)
{
error = "Event too big";
@@ -751,7 +763,7 @@
*/
file->error= -1;
}
- return res;
+ DBUG_RETURN(res);
}
@@ -826,8 +838,22 @@
case FORMAT_DESCRIPTION_EVENT:
ev = new Format_description_log_event(buf, event_len, description_event);
break;
+#ifdef HAVE_REPLICATION
+ case WRITE_ROWS_EVENT:
+ ev = new Write_rows_log_event(buf, event_len, description_event);
+ break;
+ case UPDATE_ROWS_EVENT:
+ ev = new Update_rows_log_event(buf, event_len, description_event);
+ break;
+ case DELETE_ROWS_EVENT:
+ ev = new Delete_rows_log_event(buf, event_len, description_event);
+ break;
+ case TABLE_MAP_EVENT:
+ ev = new Table_map_log_event(buf, event_len, description_event);
+ break;
+#endif
default:
- DBUG_PRINT("error",("Unknown evernt code: %d",(int) buf[EVENT_TYPE_OFFSET]));
+ DBUG_PRINT("error",("Unknown event code: %d",(int) buf[EVENT_TYPE_OFFSET]));
ev= NULL;
break;
}
@@ -1801,6 +1827,10 @@
post_header_len[RAND_EVENT-1]= 0;
post_header_len[USER_VAR_EVENT-1]= 0;
post_header_len[FORMAT_DESCRIPTION_EVENT-1]= FORMAT_DESCRIPTION_HEADER_LEN;
+ post_header_len[TABLE_MAP_EVENT-1] = TABLE_MAP_HEADER_LEN;
+ post_header_len[WRITE_ROWS_EVENT-1] = ROWS_HEADER_LEN;
+ post_header_len[UPDATE_ROWS_EVENT-1] = ROWS_HEADER_LEN;
+ post_header_len[DELETE_ROWS_EVENT-1] = ROWS_HEADER_LEN;
}
break;
@@ -4203,3 +4233,915 @@
}
return buf;
}
+
+
+
+/**************************************************************************
+ Rows_log_event member functions
+**************************************************************************/
+
+#ifndef MYSQL_CLIENT
+Rows_log_event::
+Rows_log_event(THD* thd_arg, TABLE* tbl_arg, table_id tid, 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_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
+
+Rows_log_event::
+Rows_log_event(const char* buf, uint event_len, Log_event_type event_type,
+ const Format_description_log_event *description_event)
+ : Log_event(buf, description_event),
+ m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
+{
+ DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
+ uint8 const common_header_len = description_event->common_header_len;
+ uint8 const post_header_len = description_event->post_header_len[event_type-1];
+
+ DBUG_PRINT("enter",("event_len=%ld, common_header_len=%d, "
+ "post_header_len=%d",
+ event_len, common_header_len,
+ post_header_len));
+
+ char const* const post_begin = buf + common_header_len;
+ m_table_id = uint4korr(post_begin + RW_MAPID_OFFSET);
+ DBUG_PRINT("info",("m_table_id=%d", m_table_id));
+
+ m_rows_flags = uint2korr(post_begin + RW_FLAGS_OFFSET);
+ DBUG_PRINT("info",("m_rows_flags=%d", m_rows_flags));
+
+ 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));
+
+ const char* const ptr_rows_data = var_begin + (m_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]));
+
+ m_rows_end = m_rows_buf + data_size;
+ m_rows_cur = m_rows_end;
+ memcpy(m_rows_buf, ptr_rows_data, data_size);
+ DBUG_PRINT("info",("m_rows_buf=%p, m_rows_cur=%p, m_rows_end=%p",
+ m_rows_buf, m_rows_cur, m_rows_end));
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+Rows_log_event::
+~Rows_log_event()
+{
+ my_free(m_rows_buf, MYF(MY_WME));
+ m_rows_buf = m_rows_cur = m_rows_end = NULL;
+}
+
+void Rows_log_event::
+do_add_row_data(byte *const row_data, size_t const length)
+{
+ DBUG_ENTER("Rows_log_event::do_add_row_data(byte* data, size_t length)");
+ DBUG_PRINT("enter", ("row_data = %p, length = %lu", row_data, length));
+ DBUG_ASSERT(m_rows_buf <= m_rows_cur);
+ DBUG_ASSERT(m_rows_buf < m_rows_end);
+ DBUG_ASSERT(m_rows_cur <= m_rows_end);
+
+ // The cast will work since m_rows_cur <= m_rows_end
+ if ((size_t) (m_rows_end - m_rows_cur) < length) {
+ ptrdiff_t const old_alloc = m_rows_end - m_rows_buf;
+ ptrdiff_t const new_alloc = old_alloc + 1024;
+ ptrdiff_t const cur_size = m_rows_cur - m_rows_buf;
+
+ byte* const new_buf = my_realloc(m_rows_buf, new_alloc, MYF(MY_WME));
+
+ // If the memory moved, we need to move the pointers
+ if (new_buf != m_rows_buf) {
+ m_rows_buf = new_buf;
+ m_rows_end = m_rows_buf + new_alloc;
+ m_rows_cur = m_rows_buf + cur_size;
+ }
+ }
+
+ memcpy(m_rows_cur, row_data, length);
+ m_rows_cur += length;
+ DBUG_PRINT("info", ("rows event body is now %lu bytes",
+ m_rows_cur - m_rows_buf));
+ DBUG_VOID_RETURN;
+}
+
+#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)
+{
+ DBUG_ENTER("unpack_row(char* record, char const* row, TABLE* table)");
+ DBUG_PRINT("enter", ("record = %p, row = %p, table = %p (%s)",
+ record, row, table, table->s->table_name));
+ DBUG_PRINT("info", ("table->null_bytes = %d, table->fields = %d",
+ table->s->null_bytes, table->s->fields));
+ DBUG_ASSERT(record && row);
+ 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)) {
+ 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,
+ table->field[i]->field_name,
+ ptr, record, offset));
+ ptr = table->field[i]->unpack(record + offset, ptr);
+ }
+ }
+ DBUG_RETURN(ptr);
+}
+
+/*
+ Tag fields as new fields based on the supplied sequence of bits. The bits
+ are supplied as an array of bytes, where the first byte is the first 8
+ fields. The number of bits used is given by the 'bits' parameter and is
+ really only used as a security. The fields are tagged by setting the
+ '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)
+{
+ 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;
+ }
+ }
+}
+
+
+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);
+ THD* const thd = current_thd;
+ char const* row_start = m_rows_buf;
+
+ do_before_row_operations(table);
+ 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);
+ 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;
+ }
+ do_after_row_operations(table);
+
+ if (m_rows_flags & STMT_END_F) {
+ // This is the end of a statement, so close (and unlock) the tables we
+ // opened when processing the Table_map_log_event starting the statement.
+
+ // !!! 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();
+ close_thread_tables(thd);
+ }
+
+ DBUG_RETURN(error || Log_event::exec_event(rli));
+}
+#endif
+
+bool Rows_log_event::
+write_data_header(IO_CACHE* file)
+{
+ byte buf[ROWS_HEADER_LEN]; // No need to init the buffer
+ DBUG_ENTER("Rows_log_event::write_data_header(IO_CACHE*)");
+ DBUG_PRINT("info", ("writing MAPID %d (4 bytes)", m_table_id));
+ int4store(buf + RW_MAPID_OFFSET, m_table_id);
+ DBUG_PRINT("info", ("writing FLAGS %d (2 bytes)", m_table_id));
+ int2store(buf + RW_FLAGS_OFFSET, m_rows_flags);
+ bool result = my_b_safe_write(file, buf, ROWS_HEADER_LEN);
+ DBUG_RETURN(result);
+}
+
+bool Rows_log_event::
+write_data_body(IO_CACHE* file)
+{
+ DBUG_ENTER("Rows_log_event::write_data_body(IO_CACHE*)");
+ byte const wbuf[] = { m_width };
+ DBUG_PRINT("info", ("writing %d bytes",
+ sizeof(wbuf) + (m_width + 7) / 8
+ + (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)
+ || my_b_safe_write(file, m_rows_buf, m_rows_cur - m_rows_buf));
+}
+
+#ifdef MYSQL_CLIENT
+void Rows_log_event::
+print(FILE* file, bool short_form,
+ LAST_EVENT_INFO* last_event_info)
+{
+ if (!short_form)
+ {
+ print_header(file);
+ fprintf(file, "\n# %s\tthread_id=%lu\n", get_type_str(), m_thread_id);
+ }
+}
+#endif
+
+/**************************************************************************
+ Table_map_log_event member functions
+**************************************************************************/
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+#ifndef MYSQL_CLIENT
+Table_map_log_event::
+Table_map_log_event(THD* thd, TABLE* tbl, table_id tid, bool using_trans)
+ : Log_event(thd, 0, using_trans),
+ m_table(tbl),
+ m_dbnam(thd->db),
+ m_dblen(m_dbnam ? strlen(m_dbnam) : 0),
+ m_tblnam(tbl->s->table_name), // Do I need to take a copy???
+ m_tbllen(strlen(m_tblnam)),
+ m_colcnt(tbl->s->fields), m_coltype(0),
+ m_memory(0),
+ m_table_id(tid)
+{
+ DBUG_ENTER("Table_map_log_event::Table_map_log_event(THD*,...)");
+
+ m_data_size = TABLE_MAP_HEADER_LEN;
+ m_data_size += m_dblen + 2; // Include length and terminating \0
+ m_data_size += m_tbllen + 2; // Include length and terminating \0
+ m_data_size += 1 + m_colcnt; // COLCNT and column types
+
+ if ((m_memory = my_multi_malloc(MYF(0),
+ &m_coltype, m_colcnt,
+ NULL)))
+ {
+ for (unsigned int i = 0 ; i < m_table->s->fields ; ++i)
+ m_coltype[i] = m_table->field[i]->type();
+ }
+
+ DBUG_VOID_RETURN;
+}
+#endif
+
+/*
+ Constructor used by slave to read the event from the binary log.
+ */
+Table_map_log_event::
+Table_map_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event)
+#ifdef MYSQL_CLIENT
+ : Log_event(buf, description_event)
+#else
+ : Log_event(buf, description_event), m_table(NULL), m_memory(NULL)
+#endif
+
+{
+ DBUG_ENTER("Table_map_log_event::Table_map_log_event(const char*,uint,...)");
+
+ uint8 common_header_len= description_event->common_header_len;
+ uint8 post_header_len= description_event->post_header_len[TABLE_MAP_EVENT-1];
+ DBUG_PRINT("info",("event_len=%ld, common_header_len=%d, post_header_len=%d",
+ event_len, common_header_len, post_header_len));
+
+ /* Read the post-header */
+ const char* const post_start = buf + common_header_len;
+
+ m_table_id = uint4korr(post_start + TM_MAPID_OFFSET);
+
+ /* Read the variable part of the event */
+ const char* const vpart = post_start + TABLE_MAP_HEADER_LEN;
+
+ /* Extract the length of the various parts from the buffer */
+ byte const* const ptr_dblen = vpart + 0;
+ m_dblen = *(unsigned char*) ptr_dblen;
+
+ // Length of database name + counter + terminating null
+ byte const* const ptr_tbllen = ptr_dblen + m_dblen + 2;
+ m_tbllen = *(unsigned char*) ptr_tbllen;
+
+ // Length of table name + counter + terminating null
+ byte const* const ptr_colcnt = ptr_tbllen + m_tbllen + 2;
+ m_colcnt = *(unsigned char*) ptr_colcnt;
+
+ DBUG_PRINT("info",("m_dblen = %d offset %d", m_dblen, ptr_dblen-vpart));
+ DBUG_PRINT("info",("m_tbllen = %d offset %d", m_tbllen, ptr_tbllen-vpart));
+ 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);
+
+ if (m_memory) {
+ /* Copy the different parts into their memory */
+ strncpy(const_cast<char*>(m_dbnam), ptr_dblen + 1, m_dblen + 1);
+ strncpy(const_cast<char*>(m_tblnam), ptr_tbllen + 1, m_tbllen + 1);
+ memcpy(m_coltype, ptr_colcnt + 1, m_colcnt);
+
+ DBUG_PRINT("info", ("m_dblen = %d; m_dbnam = \"%s\"",
+ m_dblen, m_dbnam));
+ DBUG_PRINT("info", ("m_tbllen = %d; m_tblnam = \"%s\"",
+ m_tbllen, m_tblnam));
+ DBUG_PRINT("info", ("m_colcnt = %d", m_colcnt));
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+Table_map_log_event::
+~Table_map_log_event()
+{
+ my_free(m_memory, MYF(0));
+}
+
+#ifndef MYSQL_CLIENT
+int Table_map_log_event::
+exec_event(st_relay_log_info* rli)
+{
+ DBUG_ENTER("Table_map_log_event::exec_event(st_relay_log_info*)");
+
+ // Open and lock the table
+ THD* const thd = current_thd;
+ TABLE_LIST table_list;
+ bzero(&table_list, 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);
+ DBUG_RETURN(error || Log_event::exec_event(rli));
+}
+#endif
+
+#ifndef MYSQL_CLIENT
+bool Table_map_log_event::
+write_data_header(IO_CACHE* file)
+{
+ DBUG_ENTER("Table_map_log_event::write_data_header(IO_CACHE*)");
+
+ byte buf[TABLE_MAP_HEADER_LEN];
+ int4store(buf + TM_MAPID_OFFSET, m_table_id);
+
+ DBUG_RETURN(my_b_safe_write(file, buf, TABLE_MAP_HEADER_LEN));
+}
+
+bool Table_map_log_event::
+write_data_body(IO_CACHE* file)
+{
+ DBUG_ENTER("Table_map_log_event::write_data_body(IO_CACHE*)");
+ // To ensure that we can use VLE in the future.
+ DBUG_ASSERT(m_dblen < 128);
+ DBUG_ASSERT(m_tbllen < 128);
+ DBUG_ASSERT(m_colcnt < 128);
+
+ DBUG_PRINT("info", ("m_dblen = %d; m_dbnam = %s",
+ m_dblen, m_dbnam));
+ DBUG_PRINT("info", ("m_tbllen = %d; m_tblnam = %s",
+ m_tbllen, m_tblnam));
+
+ byte const dbuf[] = { m_dblen };
+ byte const tbuf[] = { m_tbllen };
+ byte const cbuf[] = { m_colcnt };
+
+ DBUG_RETURN( my_b_safe_write(file, dbuf, sizeof(dbuf))
+ || my_b_safe_write(file, m_dbnam, m_dblen+1)
+ || my_b_safe_write(file, tbuf, sizeof(tbuf))
+ || my_b_safe_write(file, m_tblnam, m_tbllen+1)
+ || my_b_safe_write(file, cbuf, sizeof(cbuf))
+ || my_b_safe_write(file, m_coltype, m_colcnt));
+}
+#else
+/*
+ Dummy functions to satisfy linking dependencies
+*/
+bool Table_map_log_event::
+write_data_header(IO_CACHE* file)
+{
+ DBUG_ASSERT(0); // Shouldn't come here!
+ return 1;
+}
+
+bool Table_map_log_event::
+write_data_body(IO_CACHE* file)
+{
+ DBUG_ASSERT(0); // Shouldn't come here!
+ return 1;
+}
+#endif
+
+#ifdef MYSQL_CLIENT
+void Table_map_log_event::
+print(FILE* file, bool short_form,
+ LAST_EVENT_INFO* last_event_info)
+{
+ if (!short_form)
+ {
+ print_header(file);
+ fprintf(file, "\n# %s\tthread_id=%lu\n", "Table_map_log_event", m_thread_id);
+ }
+}
+#endif
+
+/**************************************************************************
+ Write_rows_log_event member functions
+**************************************************************************/
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+#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)
+{
+}
+#endif
+
+/*
+ Constructor used by slave to read the event from the binary log.
+ */
+Write_rows_log_event::
+Write_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event)
+: Rows_log_event(buf, event_len, WRITE_ROWS_EVENT, description_event)
+{
+ DBUG_ENTER("Write_rows_log_event::Write_rows_log_event(char*,...)");
+ DBUG_VOID_RETURN;
+}
+
+#ifndef MYSQL_CLIENT
+int Write_rows_log_event::
+do_before_row_operations(TABLE* table)
+{
+ return 0;
+}
+
+void Write_rows_log_event::
+do_after_row_operations(TABLE* table)
+{
+}
+
+char const* Write_rows_log_event::
+do_prepare_row(TABLE* table, char const* row_start)
+{
+ DBUG_ENTER("Write_rows_log_event::do_prepare_row(TABLE*,...)");
+ char const* ptr = row_start;
+ ptr = unpack_row(table, table->record[0], ptr, m_cols, m_width);
+ DBUG_RETURN(ptr);
+}
+
+int Write_rows_log_event::
+do_exec_row(TABLE* table, st_relay_log_info* rli)
+{
+ DBUG_ENTER("Write_rows_log_event::do_exec_row(TABLE*,...)");
+ int error = table->file->ha_write_row(table->record[0]);
+ DBUG_RETURN(error);
+}
+#endif
+
+#ifdef MYSQL_CLIENT
+void Write_rows_log_event::
+print(FILE* file, bool short_form,
+ LAST_EVENT_INFO* last_event_info)
+{
+ if (!short_form) {
+ print_header(file);
+ fprintf(file, "\nINSERT INTO %s VALUES ", "`NYI`");
+ }
+}
+#endif
+
+/**************************************************************************
+ Delete_rows_log_event member functions
+**************************************************************************/
+
+#ifndef MYSQL_CLIENT
+static int record_compare(TABLE* table, byte const *a, byte const *b)
+{
+ for (size_t i = 0 ; i < table->s->fields ; ++i)
+ {
+ int const off = table->field[i]->offset();
+ DBUG_PRINT("info", ("Comparing %02x ('%c') with %02x ('%c')",
+ a[off], a[off], b[off], b[off]));
+ int const res = table->field[i]->cmp_binary(a + off, b + off);
+ if (res != 0)
+ return res;
+ }
+ return 0;
+}
+#endif
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+#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::
+~Delete_rows_log_event()
+{
+}
+#endif
+
+/*
+ Constructor used by slave to read the event from the binary log.
+ */
+Delete_rows_log_event::
+Delete_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event)
+#ifdef MYSQL_CLIENT
+ : 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)
+#endif
+{
+ DBUG_ENTER("Delete_rows_log_event::Delete_rows_log_event(char*,...)");
+ DBUG_VOID_RETURN;
+}
+
+
+#ifndef MYSQL_CLIENT
+int Delete_rows_log_event::
+do_before_row_operations(TABLE* table)
+{
+ 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));
+ m_memory =
+ my_multi_malloc(MYF(0),
+ &m_search_record, table->s->reclength,
+ // Just to get a sensible value when there are no keys
+ &m_key, table->s->keys > 0 ? table->key_info->key_length : 1,
+ NULL);
+ if (!m_memory)
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ if (table->s->keys > 0)
+ {
+ // We have a key: search the table using the index
+ if (!table->file->inited)
+ table->file->ha_index_init(0);
+ }
+ else
+ {
+ // We doesn't have a key: search the table using rnd_next()
+ table->file->ha_rnd_init(1);
+ }
+
+ DBUG_RETURN(0);
+}
+
+void Delete_rows_log_event::
+do_after_row_operations(TABLE* table)
+{
+ DBUG_ENTER("Delete_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;
+
+ DBUG_VOID_RETURN;
+}
+
+char const* Delete_rows_log_event::
+do_prepare_row(TABLE* table, char const* row_start)
+{
+ DBUG_ENTER("Delete_rows_log_event::do_prepare_row(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);
+
+ if (table->s->keys > 0)
+ {
+ // We have a key, let's use the primary key if there is one.
+ // Otherwise, we use the first key (index) we find for the table.
+ uint const pk = table->s->primary_key;
+ KEY *const key_info = table->key_info + (pk != MAX_KEY ? pk : 0);
+
+ key_copy(m_key, table->record[0], key_info, 0);
+ }
+
+ DBUG_RETURN(ptr);
+}
+
+int Delete_rows_log_event::
+do_exec_row(TABLE* table, st_relay_log_info* rli)
+{
+ DBUG_ENTER("Delete_rows_log_event::do_exec_row(TABLE*,...)");
+
+ if (table->s->keys > 0) {
+ if (int error = table->file->index_read(m_search_record, m_key,
+ table->key_info->key_length,
+ HA_READ_KEY_EXACT))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+
+ while (record_compare(table, table->record[0], m_search_record) != 0)
+ {
+ if (int error = table->file->index_next(m_search_record))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+ }
+ }
+ else
+ {
+ if (int const error = table->file->rnd_next(m_search_record))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+
+ // Save the position
+ table->file->position(m_search_record);
+ byte* const last_rowid = table->file->ref;
+
+ // Continue until we find the right record or have made a full loop
+ while (record_compare(table, table->record[0], m_search_record) != 0)
+ {
+ if (int const error = table->file->rnd_next(m_search_record))
+ {
+ switch (error) {
+ case HA_ERR_END_OF_FILE:
+ table->file->ha_rnd_init(1);
+ continue;
+ case HA_ERR_RECORD_DELETED:
+ continue;
+ default:
+ DBUG_PRINT("return", ("error = %d", error));
+ 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
+ }
+ }
+
+ // Now we should have the right row to delete
+
+ int const error = table->file->ha_delete_row(m_search_record);
+
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+}
+#endif
+
+/**************************************************************************
+ Update_rows_log_event member functions
+**************************************************************************/
+
+/*
+ Constructor used to build an event for writing to the binary log.
+ */
+#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)
+{
+}
+#endif
+
+/*
+ Constructor used by slave to read the event from the binary log.
+ */
+Update_rows_log_event::
+Update_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event)
+#ifdef MYSQL_CLIENT
+ : 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)
+#endif
+{
+ DBUG_ENTER("Update_rows_log_event::Update_rows_log_event(char*,...)");
+ DBUG_VOID_RETURN;
+}
+
+#ifndef MYSQL_CLIENT
+int Update_rows_log_event::
+do_before_row_operations(TABLE* table)
+{
+ DBUG_ENTER("Update_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));
+
+ m_memory
+ = my_multi_malloc(MYF(0),
+ &m_search_record, table->s->reclength,
+ // Just to get a sensible value when there are no keys
+ &m_key, table->s->keys > 0 ? table->key_info->key_length : 1,
+ NULL);
+ if (!m_memory)
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ if (table->s->keys > 0)
+ {
+ // We have a key: search the table using the index
+ if (!table->file->inited)
+ table->file->ha_index_init(0);
+ }
+ else
+ {
+ // We doesn't have a key: search the table using rnd_next()
+ table->file->ha_rnd_init(1);
+ }
+
+ DBUG_RETURN(0);
+}
+
+void Update_rows_log_event::
+do_after_row_operations(TABLE* table)
+{
+ 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;
+
+ DBUG_VOID_RETURN;
+}
+
+char const* Update_rows_log_event::
+do_prepare_row(TABLE* table, char const* row_start)
+{
+ DBUG_ENTER("Update_rows_log_event::do_prepare_row(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);
+ 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);
+
+ if (table->s->keys > 0)
+ {
+ // We have a key, let's use the primary key if there is one.
+ // Otherwise, we use the first key (index) we find for the table.
+ uint const pk = table->s->primary_key;
+ KEY *const key_info = table->key_info + (pk != MAX_KEY ? pk : 0);
+
+ key_copy(m_key, table->record[0], key_info, 0);
+ }
+
+ DBUG_RETURN(ptr);
+}
+
+int Update_rows_log_event::
+do_exec_row(TABLE* table, st_relay_log_info* rli)
+{
+ DBUG_ENTER("Update_rows_log_event::do_exec_row(TABLE*,...)");
+ if (table->s->keys > 0) {
+ if (int error = table->file
+ ->index_read(m_search_record, m_key,
+ table->key_info->key_length,
+ HA_READ_KEY_EXACT))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+
+ while (record_compare(table, table->record[0], m_search_record) != 0)
+ {
+ if (int error = table->file->index_next(m_search_record))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+ }
+ }
+ else
+ {
+ if (int const error = table->file->rnd_next(m_search_record))
+ {
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+ }
+
+ // Save the position
+ table->file->position(m_search_record);
+ byte* const last_rowid = table->file->ref;
+
+ // Continue until we find the right record or have made a full loop
+ while (record_compare(table, table->record[0], m_search_record) != 0)
+ {
+ if (int const error = table->file->rnd_next(m_search_record))
+ {
+ switch (error) {
+ case HA_ERR_END_OF_FILE:
+ table->file->ha_rnd_init(1);
+ continue;
+ case HA_ERR_RECORD_DELETED:
+ continue;
+ default:
+ DBUG_PRINT("return", ("error = %d", error));
+ 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
+ }
+ }
+
+ // Now we should have the right row to delete
+ int const error = table->file->ha_update_row(table->record[0],
+ table->record[1]);
+
+ DBUG_PRINT("return", ("error = %d", error));
+ DBUG_RETURN(error);
+}
+#endif
+
--- 1.100/sql/log_event.h 2005-01-03 21:14:11 +01:00
+++ 1.101/sql/log_event.h 2005-03-10 20:10:07 +01:00
@@ -26,6 +26,11 @@
#pragma interface /* gcc class implementation */
#endif
+#ifndef MYSQL_CLIENT
+extern my_bool opt_binlog_row_level;
+extern ulong opt_binlog_row_event_max_size;
+#endif
+
#define LOG_READ_EOF -1
#define LOG_READ_BOGUS -2
#define LOG_READ_IO -3
@@ -194,6 +199,8 @@
#define EXEC_LOAD_HEADER_LEN 4
#define DELETE_FILE_HEADER_LEN 4
#define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES)
+#define ROWS_HEADER_LEN 6
+#define TABLE_MAP_HEADER_LEN 4
/*
Event header offsets;
@@ -283,6 +290,13 @@
/* DF = "Delete File" */
#define DF_FILE_ID_OFFSET 0
+/* TM = "Table Map" */
+#define TM_MAPID_OFFSET 0
+
+/* RW = "RoWs" */
+#define RW_MAPID_OFFSET 0
+#define RW_FLAGS_OFFSET 4
+
/* 4 bytes which all binlogs should begin with */
#define BINLOG_MAGIC "\xfe\x62\x69\x6e"
@@ -360,6 +374,10 @@
NEW_LOAD_EVENT,
RAND_EVENT, USER_VAR_EVENT,
FORMAT_DESCRIPTION_EVENT,
+ TABLE_MAP_EVENT,
+ WRITE_ROWS_EVENT,
+ UPDATE_ROWS_EVENT,
+ DELETE_ROWS_EVENT,
ENUM_END_EVENT /* end marker */
};
@@ -557,6 +575,7 @@
temp_buf = 0;
}
}
+
virtual int get_data_size() { return 0;}
/*
Get event length for simple events. For complicated events the length
@@ -568,6 +587,53 @@
*description_event);
/* returns the human readable name of the event's type */
const char* get_type_str();
+
+ /*
+ Predicate to check if this event should be written to the binary
+ log. This function is called by MYSQL_LOG to decide if this event
+ should be written to the binary log at all.
+
+ Return 'true' if the event should be written to the binary log,
+ 'false' if it should not be written to the binary log.
+ */
+ bool write_to_binlog() const {
+ return do_write_to_binlog();
+ }
+
+ /*
+ Predicate to check if this statement can be cached at all or should go
+ directly into the binary log.
+
+ Observe that even if an event can be cached, it might not go to the cache
+ for other reasons. This predicate is mainly used to get row-level events
+ 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.
+ */
+ bool can_be_cached() const {
+ return do_can_be_cached();
+ }
+
+private:
+ /*
+ Primitive for testing if the event should be written to the binary log.
+ The subclasses should override this if they do not want to be written to
+ the binary log. By default, everything goes to the binary log.
+
+ Return 'true' if the event should be written to the binary log, 'false'
+ otherwise.
+ */
+ virtual bool do_write_to_binlog() const {
+ return true;
+ }
+
+ /*
+ Primitive for testing if the event can be cached at all.
+ */
+ virtual bool do_can_be_cached() const {
+ return true;
+ }
};
/*
@@ -1282,7 +1348,7 @@
Delete_file_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event);
- ~Delete_file_log_event() {}
+ ~Delete_file_log_event() {};
Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
bool is_valid() const { return file_id != 0; }
@@ -1342,5 +1408,373 @@
bool is_valid() const { return 1; }
};
#endif
+
+/*****************************************************************************
+
+ Table map log event class
+
+ Create a mapping from an id to a table name and a set of columns.
+
+ ****************************************************************************/
+
+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);
+#endif
+ Table_map_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event);
+
+ ~Table_map_log_event();
+
+ virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
+ virtual bool is_valid() const { return 1; }
+
+ virtual int get_data_size() { return m_data_size; }
+
+ virtual bool write_data_header(IO_CACHE* file);
+ virtual bool write_data_body(IO_CACHE* file);
+
+#ifndef MYSQL_CLIENT
+ virtual int exec_event(struct st_relay_log_info* rli);
+#endif
+
+#ifdef MYSQL_CLIENT
+ virtual void print(FILE* file, bool short_form = 0,
+ LAST_EVENT_INFO* last_event_info= 0);
+#endif
+
+private:
+#ifndef MYSQL_CLIENT
+ TABLE *m_table;
+#endif
+ char const *m_dbnam;
+ size_t m_dblen;
+ char const *m_tblnam;
+ size_t m_tbllen;
+ size_t m_colcnt;
+ byte *m_coltype;
+
+ gptr m_memory;
+ table_id m_table_id;
+
+ size_t m_data_size;
+ ulong m_thread_id;
+
+private:
+#ifndef MYSQL_CLIENT
+ virtual bool do_write_to_binlog() const {
+ return opt_binlog_row_level;
+ }
+#endif
+};
+
+
+/*****************************************************************************
+
+ Row level log event class.
+
+ Common base class for all row-level log events.
+
+ RESPONSABILITIES
+ Encode the common parts of all events containing rows, which are:
+ - Write data header and data body to an IO_CACHE.
+ - Provide an interface for adding an individual row to the event.
+
+
+ COLLABORATION
+
+ ****************************************************************************/
+
+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
+ };
+
+ virtual ~Rows_log_event();
+
+ void set_flags(enum_flags flags) {
+ m_rows_flags |= flags;
+ }
+
+ void clear_flags(enum_flags flags) {
+ m_rows_flags &= ~flags;
+ }
+
+#ifndef MYSQL_CLIENT
+ virtual int exec_event(struct st_relay_log_info* rli);
+#endif
+
+#ifdef MYSQL_CLIENT
+ virtual void print(FILE* file, bool short_form = 0,
+ LAST_EVENT_INFO* last_event_info= 0);
+#endif
+
+ void add_row_data(byte *data, size_t length) {
+ do_add_row_data(data,length);
+ }
+
+ // Member functions to implement superclass interface
+ virtual int get_data_size() {
+ return
+ ROWS_HEADER_LEN + 1 + (m_width + 7) / 8
+ + (m_rows_cur - m_rows_buf);
+ }
+
+ virtual bool write_data_header(IO_CACHE* file);
+ virtual bool write_data_body(IO_CACHE* file);
+
+protected:
+ // 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);
+#endif
+ Rows_log_event(const char* row_data, uint event_len,
+ Log_event_type event_type,
+ const Format_description_log_event *description_event);
+
+ virtual void do_add_row_data(byte* data, size_t length);
+
+ char const *m_dbnam; // Database name
+ size_t m_dblen; // Length of database name in bytes
+
+#ifndef MYSQL_CLIENT
+ TABLE* m_table; // The table the rows belong to
+#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_thread_id; // Thread ID
+
+ byte* m_rows_buf; // The rows in packed format
+ byte* m_rows_cur; // One-after the end of the data
+ byte* m_rows_end; // One-after the end of the allocated space
+
+ uint16 m_rows_flags; // Flags for row-level events
+
+private:
+#ifndef MYSQL_CLIENT
+ virtual bool do_write_to_binlog() const {
+ return opt_binlog_row_level;
+ }
+
+ virtual bool do_can_be_cached() const {
+ return opt_binlog_row_level && m_table->file->has_transactions();
+ }
+
+ /*
+ Primitive to prepare for a sequence of row executions.
+
+ DESCRIPTION
+
+ Before doing a sequence of do_prepare_row() and do_exec_row() calls,
+ this member function should be called to prepare for the entire
+ sequence. Typically, this member function will allocate space for any
+ buffers that are needed for the two member functions mentioned above.
+
+ RETURN VALUE
+
+ The member function will return 0 if all went ok, or a non-zero error
+ code otherwise.
+ */
+ virtual int do_before_row_operations(TABLE* table) = 0;
+
+ /*
+ Primitive to clean up after a sequence of row executions.
+
+ DESCRIPTION
+
+ After doing a sequence of do_prepare_row() and do_exec_row(), this
+ member function should be called to clean up and release any allocated
+ buffers. This member function cannot fail, so make sure to recover after
+ any potential problems that might occur.
+ */
+ virtual void do_after_row_operations(TABLE* table) = 0;
+
+ /*
+ Primitive to prepare for handling one row in a row-level event.
+
+ DESCRIPTION
+
+ The member function prepares for execution of operations needed for one
+ row in a row-level event by reading up data from the buffer containing
+ the row. No specific interpretation of the data is normally done here,
+ since SQL thread specific data is not available: that data is made
+ available for the do_exec function.
+
+ RETURN VALUE
+ A pointer to the start of the next row, or NULL if the preparation
+ 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;
+
+ /*
+ Primitive to do the actual execution necessary for a row.
+
+ DESCRIPTION
+ The member function will do the actual execution needed to handle a row,
+ and potentially change the state of the SQL thread specific data
+ supplied in the 'rli' parameter.
+
+ RETURN VALUE
+ 0 if execution succeeded, 1 if execution failed.
+
+ */
+ virtual int do_exec_row(TABLE* table, st_relay_log_info* rli) = 0;
+#endif
+};
+
+
+/*****************************************************************************
+
+ Write row log event class
+
+ Log row insertions and updates. The event contain several
+ insert/update rows for a table. Note that each event contains only
+ rows for one table.
+
+ ****************************************************************************/
+class Write_rows_log_event : public Rows_log_event
+{
+public:
+ enum {
+ TYPE_CODE = WRITE_ROWS_EVENT // Support interface to prepare_pending
+ };
+
+#ifndef MYSQL_CLIENT
+ Write_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+#endif
+ Write_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event);
+
+private:
+ virtual Log_event_type get_type_code() { return WRITE_ROWS_EVENT; }
+ virtual bool is_valid() const { return 1; }
+
+#ifdef MYSQL_CLIENT
+ void print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info);
+#endif
+
+#ifndef MYSQL_CLIENT
+ gptr m_memory;
+ 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 int do_exec_row(TABLE* table, st_relay_log_info* rli);
+#endif
+};
+
+
+/*****************************************************************************
+
+ Update rows log event class
+
+ Log row updates with a before image. The event contain several
+ update rows for a table. Note that each event contains only rows for
+ one table.
+
+ Also note that the row data consists of pairs of row data: one row
+ for the old data and one row for the new data.
+
+ ****************************************************************************/
+class Update_rows_log_event : public Rows_log_event
+{
+public:
+ enum {
+ TYPE_CODE = UPDATE_ROWS_EVENT // Support interface to prepare_pending
+ };
+
+#ifndef MYSQL_CLIENT
+ Update_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+#endif
+ Update_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event);
+
+private:
+ virtual Log_event_type get_type_code() { return UPDATE_ROWS_EVENT; }
+ virtual bool is_valid() const { return 1; }
+
+#ifndef MYSQL_CLIENT
+ gptr m_memory;
+ byte* m_search_record;
+ byte* m_key;
+
+ 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 int do_exec_row(TABLE* table, st_relay_log_info* rli);
+#endif
+};
+
+/*****************************************************************************
+
+ Delete rows log event class.
+
+ Log row deletions. The event contain several delete rows for a
+ table. Note that each event contains only rows for one table.
+
+ RESPONSABILITIES
+
+ - Act as a container for rows that has been deleted on the master
+ and should be deleted on the slave.
+
+ COLLABORATION
+
+ Row_writer
+ Create the event and add rows to the event.
+ Row_reader
+ Extract the rows from the event.
+
+ ****************************************************************************/
+class Delete_rows_log_event : public Rows_log_event
+{
+public:
+ enum {
+ TYPE_CODE = DELETE_ROWS_EVENT // Support interface to prepare_pending
+ };
+
+#ifndef MYSQL_CLIENT
+ Delete_rows_log_event(THD*, TABLE*, table_id, bool using_trans);
+ virtual ~Delete_rows_log_event();
+#endif
+ Delete_rows_log_event(const char* buf, uint event_len,
+ const Format_description_log_event *description_event);
+
+private:
+ virtual Log_event_type get_type_code() { return DELETE_ROWS_EVENT; }
+ virtual bool is_valid() const { return 1; }
+
+#ifndef MYSQL_CLIENT
+ gptr m_memory;
+ byte* m_search_record;
+ byte* m_key;
+
+ 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 int do_exec_row(TABLE* table, st_relay_log_info* rli);
+#endif
+};
+
#endif /* _log_event_h */
--- 1.247/sql/mysql_priv.h 2005-01-15 13:09:38 +01:00
+++ 1.248/sql/mysql_priv.h 2005-03-10 20:10:07 +01:00
@@ -1007,6 +1007,8 @@
extern ulong query_buff_size, thread_stack,thread_stack_min;
extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit;
extern ulong max_binlog_size, max_relay_log_size;
+extern my_bool opt_binlog_row_level;
+extern ulong opt_binlog_row_event_max_size;
extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong back_log;
extern ulong specialflag, current_pid;
--- 1.435/sql/mysqld.cc 2005-02-07 11:17:25 +01:00
+++ 1.436/sql/mysqld.cc 2005-03-10 20:10:07 +01:00
@@ -310,6 +310,9 @@
volatile bool mqh_used = 0;
my_bool sp_automatic_privileges= 1;
+my_bool opt_binlog_row_level = FALSE; // Statement-level is default
+unsigned long opt_binlog_rows_event_max_size = 1024;
+
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
uint delay_key_write_options, protocol_version;
uint lower_case_table_names;
@@ -4141,6 +4144,7 @@
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
+ OPT_BINLOG_FORMAT, OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
OPT_WANT_CORE, OPT_CONCURRENT_INSERT,
OPT_MEMLOCK, OPT_MYISAM_RECOVER,
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID,
@@ -4335,12 +4339,27 @@
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
(gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"binlog-format", OPT_BINLOG_FORMAT,
+ "Tell the master the form of logging to use: "
+ "either 'row' for row-level logging or "
+ "'statement' for statement-level logging.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
"Tells the master that updates to the given database should not be logged tothe binary log.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
+ "The maximum size of a row-level event in bytes. "
+ "The value have to be an even multiple of 256.",
+ (gptr*) &opt_binlog_rows_event_max_size,
+ (gptr*) &opt_binlog_rows_event_max_size, 0,
+ GET_ULONG, REQUIRED_ARG,
+ /* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX,
+ /* sub_size */ 0, /* block_size */ 256,
+ /* app_type */ 0
+ },
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-set-server", 'C', "Set the default character set.",
@@ -6187,6 +6206,26 @@
binlog_ignore_db.push_back(db);
break;
}
+ case OPT_BINLOG_FORMAT:
+ if (strcmp(argument,"row") == 0)
+ {
+ opt_binlog_row_level = TRUE;
+ }
+ else if (strcmp(argument, "statement") == 0)
+ {
+ opt_binlog_row_level = FALSE;
+ }
+ else
+ {
+ fprintf(stderr,
+ "Unknown binary log format: '%s' "
+ "(Should be 'row' or 'statement')\n",
+ argument);
+ exit(1);
+ }
+
+ break;
+
case (int)OPT_BINLOG_DO_DB:
{
i_string *db = new i_string(argument);
--- 1.232/sql/slave.cc 2005-01-18 14:41:20 +01:00
+++ 1.233/sql/slave.cc 2005-03-10 20:10:07 +01:00
@@ -2519,12 +2519,13 @@
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)
+ until_log_pos(0), table_array(0), table_count(0), table_reserve(16)
{
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));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
@@ -2540,6 +2541,8 @@
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);
@@ -3076,6 +3079,82 @@
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;
+}
static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
{
@@ -3187,6 +3266,7 @@
ev->when = time(NULL);
ev->thd = thd;
exec_res = ev->exec_event(rli);
+ DBUG_PRINT("info", ("exec_event result = %d", exec_res));
DBUG_ASSERT(rli->sql_thd==thd);
/*
Format_description_log_event should not be deleted because it will be
--- 1.130/sql/sql_acl.cc 2005-01-13 10:13:01 +01:00
+++ 1.131/sql/sql_acl.cc 2005-03-10 20:10:07 +01:00
@@ -1506,7 +1506,7 @@
}
store_record(table,record[1]);
table->field[2]->store(new_password, new_password_len, system_charset_info);
- if ((error=table->file->update_row(table->record[1],table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
goto end; /* purecov: deadcode */
@@ -1720,14 +1720,14 @@
*/
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (cmp_record(table,record[1]) &&
- (error=table->file->update_row(table->record[1],table->record[0])))
+ (error=table->file->ha_update_row(table->record[1],table->record[0])))
{ // This should never happen
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
error= -1; /* purecov: deadcode */
goto end; /* purecov: deadcode */
}
}
- else if ((error=table->file->write_row(table->record[0]))) // insert
+ else if ((error=table->file->ha_write_row(table->record[0]))) // insert
{ // This should never happen
if (error && error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE) /* purecov: inspected */
@@ -1837,16 +1837,16 @@
if (rights)
{
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
- if ((error=table->file->update_row(table->record[1],table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],table->record[0])))
goto table_error; /* purecov: deadcode */
}
else /* must have been a revoke of all privileges */
{
- if ((error = table->file->delete_row(table->record[1])))
+ if ((error = table->file->ha_delete_row(table->record[1])))
goto table_error; /* purecov: deadcode */
}
}
- else if (rights && (error=table->file->write_row(table->record[0])))
+ else if (rights && (error=table->file->ha_write_row(table->record[0])))
{
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
goto table_error; /* purecov: deadcode */
@@ -2218,9 +2218,9 @@
if (old_row_exists)
{
if (privileges)
- error=table->file->update_row(table->record[1],table->record[0]);
+ error=table->file->ha_update_row(table->record[1],table->record[0]);
else
- error=table->file->delete_row(table->record[1]);
+ error=table->file->ha_delete_row(table->record[1]);
if (error)
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
@@ -2235,7 +2235,7 @@
}
else // new grant
{
- if ((error=table->file->write_row(table->record[0])))
+ if ((error=table->file->ha_write_row(table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
result= -1; /* purecov: inspected */
@@ -2287,8 +2287,8 @@
if (privileges)
{
int tmp_error;
- if ((tmp_error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((tmp_error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
{ /* purecov: deadcode */
table->file->print_error(tmp_error,MYF(0)); /* purecov: deadcode */
result= -1; /* purecov: deadcode */
@@ -2300,7 +2300,7 @@
else
{
int tmp_error;
- if ((tmp_error = table->file->delete_row(table->record[1])))
+ if ((tmp_error = table->file->ha_delete_row(table->record[1])))
{ /* purecov: deadcode */
table->file->print_error(tmp_error,MYF(0)); /* purecov: deadcode */
result= -1; /* purecov: deadcode */
@@ -2407,15 +2407,15 @@
{
if (store_table_rights || store_col_rights)
{
- if ((error=table->file->update_row(table->record[1],table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],table->record[0])))
goto table_error; /* purecov: deadcode */
}
- else if ((error = table->file->delete_row(table->record[1])))
+ else if ((error = table->file->ha_delete_row(table->record[1])))
goto table_error; /* purecov: deadcode */
}
else
{
- error=table->file->write_row(table->record[0]);
+ error=table->file->ha_write_row(table->record[0]);
if (error && error != HA_ERR_FOUND_DUPP_KEY)
goto table_error; /* purecov: deadcode */
}
@@ -2519,15 +2519,15 @@
{
if (store_proc_rights)
{
- if ((error=table->file->update_row(table->record[1],table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],table->record[0])))
goto table_error;
}
- else if ((error= table->file->delete_row(table->record[1])))
+ else if ((error= table->file->ha_delete_row(table->record[1])))
goto table_error;
}
else
{
- error=table->file->write_row(table->record[0]);
+ error=table->file->ha_write_row(table->record[0]);
if (error && error != HA_ERR_FOUND_DUPP_KEY)
goto table_error;
}
@@ -4276,13 +4276,13 @@
system_charset_info);
user_field->store(user_to->user.str, user_to->user.length,
system_charset_info);
- if ((error= table->file->update_row(table->record[1], table->record[0])))
+ if ((error= table->file->ha_update_row(table->record[1], table->record[0])))
table->file->print_error(error, MYF(0));
}
else
{
/* delete */
- if ((error=table->file->delete_row(table->record[0])))
+ if ((error=table->file->ha_delete_row(table->record[0])))
table->file->print_error(error, MYF(0));
}
@@ -5282,7 +5282,7 @@
table->field[i++]->store(column, col_length, cs);
table->field[i++]->store(priv, priv_length, cs);
table->field[i]->store(is_grantable, strlen(is_grantable), cs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
--- 1.161/sql/sql_class.cc 2005-01-06 11:59:59 +01:00
+++ 1.162/sql/sql_class.cc 2005-03-10 20:10:07 +01:00
@@ -206,6 +206,7 @@
system_thread= cleanup_done= abort_on_warning= 0;
peer_port= 0; // For SHOW PROCESSLIST
transaction.changed_tables = 0;
+ transaction.m_pending_rows_event = 0;
#ifdef __WIN__
real_id = 0;
#endif
--- 1.211/sql/sql_class.h 2005-01-16 15:46:14 +01:00
+++ 1.212/sql/sql_class.h 2005-03-10 20:10:08 +01:00
@@ -911,6 +911,11 @@
#endif
bool on;
/*
+ Pending event for row-level logging.
+ */
+ Rows_log_event* m_pending_rows_event;
+
+ /*
Tables changed in transaction (that must be invalidated in query cache).
List contain only transactional tables, that not invalidated in query
cache (instead of full list of changed in transaction tables).
--- 1.137/sql/sql_delete.cc 2005-01-06 11:59:59 +01:00
+++ 1.138/sql/sql_delete.cc 2005-03-10 20:10:08 +01:00
@@ -70,6 +70,8 @@
select_lex->no_error= thd->lex->ignore;
+ table->file->ha_stmt_begin();
+
/*
Test if the user wants to delete all rows and deletion doesn't have
any side-effects (because of triggers), so we can use optimized
@@ -181,7 +183,7 @@
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE);
- if (!(error=table->file->delete_row(table->record[0])))
+ if (!(error=table->file->ha_delete_row(table->record[0])))
{
deleted++;
if (!--limit && using_limit)
@@ -221,6 +223,7 @@
(void) table->file->extra(HA_EXTRA_NORMAL);
cleanup:
+
/*
Invalidate the table in the query cache if something changed. This must
be before binlog writing and ha_autocommit_...
@@ -233,6 +236,9 @@
delete select;
transactional_table= table->file->has_transactions();
log_delayed= (transactional_table || table->s->tmp_table);
+
+ table->file->ha_stmt_end();
+
/*
We write to the binary log even if we deleted no row, because maybe the
user is using this command to ensure that a table is clean on master *and
@@ -243,7 +249,7 @@
*/
if ((deleted || (error < 0)) && (error <= 0 || !transactional_table))
{
- if (mysql_bin_log.is_open())
+ if (!opt_binlog_row_level && mysql_bin_log.is_open())
{
if (error <= 0)
thd->clear_error();
@@ -507,7 +513,7 @@
{
/* If this is the table we are scanning */
table->status|= STATUS_DELETED;
- if (!(error=table->file->delete_row(table->record[0])))
+ if (!(error=table->file->ha_delete_row(table->record[0])))
deleted++;
else if (!table_being_deleted->next_local ||
table_being_deleted->table->file->has_transactions())
@@ -611,7 +617,7 @@
info.ignore_not_found_rows= 1;
while (!(local_error=info.read_record(&info)) && !thd->killed)
{
- if ((local_error=table->file->delete_row(table->record[0])))
+ if ((local_error=table->file->ha_delete_row(table->record[0])))
{
table->file->print_error(local_error,MYF(0));
break;
--- 1.136/sql/sql_insert.cc 2005-01-10 20:54:43 +01:00
+++ 1.137/sql/sql_insert.cc 2005-03-10 20:10:08 +01:00
@@ -311,6 +311,8 @@
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
+ table->file->ha_stmt_begin();
+
if (fields.elements && check_that_all_fields_are_given_values(thd, table))
{
/* thd->net.report_error is now set, which will abort the next loop */
@@ -402,6 +404,8 @@
table->triggers->process_triggers(thd, TRG_EVENT_INSERT, TRG_ACTION_AFTER);
}
+ table->file->ha_stmt_end();
+
/*
Now all rows are inserted. Time to update logs and sends response to
user
@@ -446,7 +450,7 @@
if ((info.copied || info.deleted || info.updated) &&
(error <= 0 || !transactional_table))
{
- if (mysql_bin_log.is_open())
+ if (!opt_binlog_row_level && mysql_bin_log.is_open())
{
if (error <= 0)
thd->clear_error();
@@ -738,10 +742,11 @@
DBUG_ENTER("write_record");
info->records++;
+
if (info->handle_duplicates == DUP_REPLACE ||
info->handle_duplicates == DUP_UPDATE)
{
- while ((error=table->file->write_row(table->record[0])))
+ while ((error=table->file->ha_write_row(table->record[0])))
{
uint key_nr;
if (error != HA_WRITE_SKIP)
@@ -815,7 +820,7 @@
if (res == VIEW_CHECK_ERROR)
goto err;
- if ((error=table->file->update_row(table->record[1],table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],table->record[0])))
goto err;
info->updated++;
break;
@@ -835,13 +840,13 @@
(table->timestamp_field_type == TIMESTAMP_NO_AUTO_SET ||
table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH))
{
- if ((error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
goto err;
info->deleted++;
break; /* Update logfile and count */
}
- else if ((error=table->file->delete_row(table->record[1])))
+ else if ((error=table->file->ha_delete_row(table->record[1])))
goto err;
info->deleted++;
if (!table->file->has_transactions())
@@ -850,7 +855,7 @@
}
info->copied++;
}
- else if ((error=table->file->write_row(table->record[0])))
+ else if ((error=table->file->ha_write_row(table->record[0])))
{
if (!info->ignore ||
(error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE))
--- 1.277/sql/sql_select.cc 2005-01-18 02:59:32 +01:00
+++ 1.278/sql/sql_select.cc 2005-03-10 20:10:08 +01:00
@@ -8535,11 +8535,11 @@
/* copy all old rows */
while (!table->file->rnd_next(new_table.record[1]))
{
- if ((write_err=new_table.file->write_row(new_table.record[1])))
+ if ((write_err=new_table.file->ha_write_row(new_table.record[1])))
goto err;
}
/* copy row that filled HEAP table */
- if ((write_err=new_table.file->write_row(table->record[0])))
+ if ((write_err=new_table.file->ha_write_row(table->record[0])))
{
if (write_err != HA_ERR_FOUND_DUPP_KEY &&
write_err != HA_ERR_FOUND_DUPP_UNIQUE || !ignore_last_dupp_key_error)
@@ -9804,7 +9804,7 @@
if (!join->having || join->having->val_int())
{
join->found_records++;
- if ((error=table->file->write_row(table->record[0])))
+ if ((error=table->file->ha_write_row(table->record[0])))
{
if (error == HA_ERR_FOUND_DUPP_KEY ||
error == HA_ERR_FOUND_DUPP_UNIQUE)
@@ -9866,8 +9866,8 @@
{ /* Update old record */
restore_record(table,record[1]);
update_tmptable_sum_func(join->sum_funcs,table);
- if ((error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-1); /* purecov: inspected */
@@ -9890,7 +9890,7 @@
}
init_tmptable_sum_functions(join->sum_funcs);
copy_funcs(join->tmp_table_param.items_to_copy);
- if ((error=table->file->write_row(table->record[0])))
+ if ((error=table->file->ha_write_row(table->record[0])))
{
if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param,
error, 0))
@@ -9926,7 +9926,7 @@
copy_fields(&join->tmp_table_param); // Groups are copied twice.
copy_funcs(join->tmp_table_param.items_to_copy);
- if (!(error=table->file->write_row(table->record[0])))
+ if (!(error=table->file->ha_write_row(table->record[0])))
join->send_records++; // New group
else
{
@@ -9942,8 +9942,8 @@
}
restore_record(table,record[1]);
update_tmptable_sum_func(join->sum_funcs,table);
- if ((error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
DBUG_RETURN(-1); /* purecov: inspected */
@@ -9985,7 +9985,7 @@
copy_sum_funcs(join->sum_funcs);
if (!join->having || join->having->val_int())
{
- if ((error=table->file->write_row(table->record[0])))
+ if ((error=table->file->ha_write_row(table->record[0])))
{
if (create_myisam_from_heap(join->thd, table,
&join->tmp_table_param,
@@ -10825,7 +10825,7 @@
}
if (having && !having->val_int())
{
- if ((error=file->delete_row(record)))
+ if ((error=file->ha_delete_row(record)))
goto err;
error=file->rnd_next(record);
continue;
@@ -10852,7 +10852,7 @@
}
if (compare_record(table, first_field) == 0)
{
- if ((error=file->delete_row(record)))
+ if ((error=file->ha_delete_row(record)))
goto err;
}
else if (!found)
@@ -10937,7 +10937,7 @@
}
if (having && !having->val_int())
{
- if ((error=file->delete_row(record)))
+ if ((error=file->ha_delete_row(record)))
goto err;
continue;
}
@@ -10953,7 +10953,7 @@
if (hash_search(&hash,key_pos-key_length,key_length))
{
/* Duplicated found ; Remove the row */
- if ((error=file->delete_row(record)))
+ if ((error=file->ha_delete_row(record)))
goto err;
}
else
--- 1.204/sql/sql_show.cc 2005-01-18 17:47:33 +01:00
+++ 1.205/sql/sql_show.cc 2005-03-10 20:10:08 +01:00
@@ -1525,7 +1525,7 @@
table->field[0]->store(name_buffer, strlen(name_buffer),
system_charset_info);
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -1899,7 +1899,7 @@
}
}
}
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
else
{
@@ -1937,7 +1937,7 @@
restore_record(table, s->default_values);
table->field[1]->store(db_name, strlen(db_name), system_charset_info);
table->field[2]->store(cs_name, strlen(cs_name), system_charset_info);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
@@ -2153,7 +2153,7 @@
}
}
}
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
DBUG_RETURN(0);
}
@@ -2329,7 +2329,7 @@
#endif
table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
table->field[18]->store(field->comment.str, field->comment.length, cs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
DBUG_RETURN(0);
@@ -2358,7 +2358,7 @@
strlen(tmp_cs->comment ? tmp_cs->comment : ""),
scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
return 0;
@@ -2397,7 +2397,7 @@
tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
table->field[5]->store((longlong) tmp_cl->strxfrm_multiply);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -2427,7 +2427,7 @@
restore_record(table, s->default_values);
table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
return 0;
@@ -2500,7 +2500,7 @@
tmp_string.length(0);
get_field(thd->mem_root, proc_table->field[11], &tmp_string);
table->field[19]->store(tmp_string.ptr(), tmp_string.length(), cs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -2620,7 +2620,7 @@
else
table->field[14]->store("", 0, cs);
table->field[14]->set_notnull();
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -2659,7 +2659,7 @@
table->field[5]->store("YES", 3, cs);
else
table->field[5]->store("NO", 2, cs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
else
@@ -2684,7 +2684,7 @@
table->field[3]->store(db, strlen(db), cs);
table->field[4]->store(tname, strlen(tname), cs);
table->field[5]->store(con_type, con_len, cs);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
@@ -2795,7 +2795,7 @@
key_part->field->field_name,
strlen(key_part->field->field_name),
(longlong) f_idx);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -2821,7 +2821,7 @@
(longlong) f_idx);
table->field[8]->store((longlong) f_idx);
table->field[8]->set_notnull();
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
}
}
@@ -2846,7 +2846,7 @@
table->field[1]->store(open_list->table, strlen(open_list->table), cs);
table->field[2]->store((longlong) open_list->in_use);
table->field[3]->store((longlong) open_list->locked);
- table->file->write_row(table->record[0]);
+ table->file->ha_write_row(table->record[0]);
}
DBUG_RETURN(0);
}
--- 1.211/sql/sql_table.cc 2005-01-15 11:37:14 +01:00
+++ 1.212/sql/sql_table.cc 2005-03-10 20:10:08 +01:00
@@ -3686,7 +3686,7 @@
{
copy_ptr->do_copy(copy_ptr);
}
- if ((error=to->file->write_row((byte*) to->record[0])))
+ if ((error=to->file->ha_write_row((byte*) to->record[0])))
{
if ((!ignore &&
handle_duplicates != DUP_REPLACE) ||
--- 1.40/sql/sql_udf.cc 2005-01-06 12:00:03 +01:00
+++ 1.41/sql/sql_udf.cc 2005-03-10 20:10:08 +01:00
@@ -440,7 +440,7 @@
table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl), system_charset_info);
if (table->s->fields >= 4) // If not old func format
table->field[3]->store((longlong) u_d->type);
- error = table->file->write_row(table->record[0]);
+ error = table->file->ha_write_row(table->record[0]);
close_thread_tables(thd);
if (error)
@@ -496,7 +496,7 @@
HA_READ_KEY_EXACT))
{
int error;
- if ((error = table->file->delete_row(table->record[0])))
+ if ((error = table->file->ha_delete_row(table->record[0])))
table->file->print_error(error, MYF(0));
}
close_thread_tables(thd);
--- 1.140/sql/sql_update.cc 2005-01-12 02:38:48 +01:00
+++ 1.141/sql/sql_update.cc 2005-03-10 20:10:08 +01:00
@@ -397,6 +397,8 @@
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
+ table->file->ha_stmt_begin();
+
while (!(error=info.read_record(&info)) && !thd->killed)
{
if (!(select && select->skip_record()))
@@ -424,8 +426,8 @@
break;
}
}
- if (!(error=table->file->update_row((byte*) table->record[1],
- (byte*) table->record[0])))
+ if (!(error=table->file->ha_update_row((byte*) table->record[1],
+ (byte*) table->record[0])))
{
updated++;
thd->no_trans_update= !transactional_table;
@@ -460,6 +462,8 @@
thd->proc_info="end";
VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY));
+ table->file->ha_stmt_end();
+
/*
Invalidate the table in the query cache if something changed.
This must be before binlog writing and ha_autocommit_...
@@ -472,7 +476,7 @@
log_delayed= (transactional_table || table->s->tmp_table);
if ((updated || (error < 0)) && (error <= 0 || !transactional_table))
{
- if (mysql_bin_log.is_open())
+ if (!opt_binlog_row_level && mysql_bin_log.is_open())
{
if (error <= 0)
thd->clear_error();
@@ -1193,8 +1197,8 @@
*/
main_table->file->extra(HA_EXTRA_PREPARE_FOR_UPDATE);
}
- if ((error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
{
updated--;
if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
@@ -1218,7 +1222,7 @@
memcpy((char*) tmp_table->field[0]->ptr,
(char*) table->file->ref, table->file->ref_length);
/* Write row, ignoring duplicated updates to a row */
- if ((error= tmp_table->file->write_row(tmp_table->record[0])) &&
+ if ((error= tmp_table->file->ha_write_row(tmp_table->record[0])) &&
(error != HA_ERR_FOUND_DUPP_KEY &&
error != HA_ERR_FOUND_DUPP_UNIQUE))
{
@@ -1328,8 +1332,8 @@
if (compare_record(table, thd->query_id))
{
- if ((local_error=table->file->update_row(table->record[1],
- table->record[0])))
+ if ((local_error=table->file->ha_update_row(table->record[1],
+ table->record[0])))
{
if (!ignore || local_error != HA_ERR_FOUND_DUPP_KEY)
goto err;
--- 1.24/mysql-test/r/ctype_ucs.result 2005-01-16 21:07:22 +01:00
+++ 1.25/mysql-test/r/ctype_ucs.result 2005-03-10 20:10:06 +01:00
@@ -523,10 +523,10 @@
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 User var 1 135 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001 135 Query 1 218 use `test`; insert into t2 values (@v)
+master-bin.000001 99 User var 1 139 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 139 Query 1 222 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`;
use test;
--- 1.22/mysql-test/t/ctype_ucs.test 2005-01-15 13:37:04 +01:00
+++ 1.23/mysql-test/t/ctype_ucs.test 2005-03-10 20:10:06 +01:00
@@ -338,7 +338,7 @@
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
-show binlog events from 95;
+show binlog events from 99;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
--- 1.4/mysql-test/r/rpl_timezone.result 2004-10-20 03:04:25 +02:00
+++ 1.5/mysql-test/r/rpl_timezone.result 2005-03-10 20:10:06 +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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp)
-master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32))
-master-bin.000001 266 Query 1 351 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
-master-bin.000001 351 Query 1 468 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
-master-bin.000001 468 Query 1 539 use `test`; delete from t1
-master-bin.000001 539 Query 1 656 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 185 use `test`; create table t1 (t timestamp)
+master-bin.000001 185 Query 1 270 use `test`; create table t2 (t char(32))
+master-bin.000001 270 Query 1 355 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
+master-bin.000001 355 Query 1 472 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001 472 Query 1 543 use `test`; delete from t1
+master-bin.000001 543 Query 1 660 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
--- 1.16/mysql-test/r/rpl_until.result 2004-07-06 13:34:02 +02:00
+++ 1.17/mysql-test/r/rpl_until.result 2005-03-10 20:10:06 +01:00
@@ -14,14 +14,14 @@
drop table t2;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Query 1 304 use `test`; insert into t1 values (1),(2),(3),(4)
-master-bin.000001 304 Query 1 374 use `test`; drop table t1
-master-bin.000001 374 Query 1 489 use `test`; create table t2(n int not null auto_increment primary key)
-master-bin.000001 489 Query 1 575 use `test`; insert into t2 values (1),(2)
-master-bin.000001 575 Query 1 661 use `test`; insert into t2 values (3),(4)
-master-bin.000001 661 Query 1 731 use `test`; drop table t2
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 214 Query 1 308 use `test`; insert into t1 values (1),(2),(3),(4)
+master-bin.000001 308 Query 1 378 use `test`; drop table t1
+master-bin.000001 378 Query 1 493 use `test`; create table t2(n int not null auto_increment primary key)
+master-bin.000001 493 Query 1 579 use `test`; insert into t2 values (1),(2)
+master-bin.000001 579 Query 1 665 use `test`; insert into t2 values (3),(4)
+master-bin.000001 665 Query 1 735 use `test`; drop table t2
start slave until master_log_file='master-bin.000001', master_log_pos=304;
select * from t1;
n
@@ -31,7 +31,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 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-bin.000001 304 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 308 # Master master-bin.000001 304 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -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 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-no-such-bin.000001 291 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 308 # Master master-no-such-bin.000001 291 No #
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=710;
select * from t2;
n
@@ -49,13 +49,13 @@
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 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 575 # Relay slave-relay-bin.000004 710 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 579 # Relay slave-relay-bin.000004 710 No #
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=710;
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 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 731 # Master master-bin.000001 710 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 735 # Master master-bin.000001 710 No #
start slave until master_log_file='master-bin', master_log_pos=561;
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;
--- 1.12/mysql-test/t/mysqlbinlog.test 2004-07-06 13:34:09 +02:00
+++ 1.13/mysql-test/t/mysqlbinlog.test 2005-03-10 20:10:06 +01:00
@@ -61,7 +61,7 @@
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=118 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=122 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -93,7 +93,7 @@
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=118 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=122 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# clean up
drop table t1, t2;
--- 1.10/mysql-test/r/drop_temp_table.result 2004-12-06 16:15:48 +01:00
+++ 1.11/mysql-test/r/drop_temp_table.result 2005-03-10 20:10:06 +01:00
@@ -10,9 +10,9 @@
1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 206 create database `drop-temp+table-test`
-master-bin.000001 206 Query 1 322 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 322 Query 1 473 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
-master-bin.000001 473 Query 1 566 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 210 create database `drop-temp+table-test`
+master-bin.000001 210 Query 1 326 use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 326 Query 1 477 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
+master-bin.000001 477 Query 1 570 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
--- 1.12/mysql-test/r/mix_innodb_myisam_binlog.result 2004-11-12 20:24:12 +01:00
+++ 1.13/mysql-test/r/mix_innodb_myisam_binlog.result 2005-03-10 20:10:06 +01:00
@@ -6,12 +6,12 @@
insert into t1 values(1);
insert into t2 select * from t1;
commit;
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(1)
+master-bin.000001 242 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 330 Query 1 # use `test`; COMMIT
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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(2)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; ROLLBACK
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(2)
+master-bin.000001 242 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 330 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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(3)
-master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 317 Query 1 # use `test`; insert into t1 values(4)
-master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 577 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(3)
+master-bin.000001 242 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 321 Query 1 # use `test`; insert into t1 values(4)
+master-bin.000001 402 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 490 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 581 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -65,16 +65,16 @@
a
5
7
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(5)
-master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 317 Query 1 # use `test`; insert into t1 values(6)
-master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 577 Query 1 # use `test`; insert into t1 values(7)
-master-bin.000001 658 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(5)
+master-bin.000001 242 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 321 Query 1 # use `test`; insert into t1 values(6)
+master-bin.000001 402 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 490 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 581 Query 1 # use `test`; insert into t1 values(7)
+master-bin.000001 662 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -87,40 +87,40 @@
select get_lock("a",10);
get_lock("a",10)
1
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(8)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; ROLLBACK
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(8)
+master-bin.000001 242 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 330 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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; insert into t1 values(9)
-master-bin.000001 176 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 99 Query 1 # use `test`; insert into t1 values(9)
+master-bin.000001 180 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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 99 Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 181 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 265 Query 1 # use `test`; BEGIN
-master-bin.000001 327 Query 1 # use `test`; insert into t1 values(11)
-master-bin.000001 409 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; insert into t1 values(10)
+master-bin.000001 181 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 269 Query 1 # use `test`; BEGIN
+master-bin.000001 331 Query 1 # use `test`; insert into t1 values(11)
+master-bin.000001 413 Query 1 # use `test`; COMMIT
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
@@ -129,12 +129,12 @@
insert into t1 values(12);
insert into t2 select * from t1;
commit;
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(12)
-master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 327 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(12)
+master-bin.000001 243 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 331 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -142,7 +142,7 @@
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
@@ -154,11 +154,11 @@
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(14)
-master-bin.000001 239 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(14)
+master-bin.000001 243 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -174,12 +174,12 @@
a
16
18
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 239 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 321 Query 1 # use `test`; COMMIT
+master-bin.000001 99 Query 1 # use `test`; BEGIN
+master-bin.000001 161 Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 243 Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 325 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
--- 1.11/mysql-test/r/rpl_change_master.result 2004-04-07 15:12:36 +02:00
+++ 1.12/mysql-test/r/rpl_change_master.result 2005-03-10 20:10:06 +01:00
@@ -16,11 +16,11 @@
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_MYPORT 1 master-bin.000001 355 # # master-bin.000001 No No 0 0 274 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 359 # # master-bin.000001 No No 0 0 278 # 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 274 # # master-bin.000001 No No 0 0 274 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 278 # # master-bin.000001 No No 0 0 278 # None 0 No #
select release_lock("a");
release_lock("a")
1
--- 1.15/mysql-test/r/rpl_error_ignored_table.result 2004-10-10 12:15:09 +02:00
+++ 1.16/mysql-test/r/rpl_error_ignored_table.result 2005-03-10 20:10:06 +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 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 277 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 277 # 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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 187 use `test`; create table t1 (a int primary key)
-master-bin.000001 187 Query 1 273 use `test`; insert into t1 values (1),(1)
-master-bin.000001 273 Query 1 343 use `test`; drop table t1
-master-bin.000001 343 Query 1 435 use `test`; create table t2 (a int primary key)
-master-bin.000001 435 Query 1 516 use `test`; insert into t2 values(1)
-master-bin.000001 516 Query 1 597 use `test`; create table t3 (id int)
-master-bin.000001 597 Query 1 692 use `test`; insert into t3 values(connection_id())
-master-bin.000001 692 Query 1 805 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
-master-bin.000001 805 Query 1 878 use `test`; drop table t2,t3
+master-bin.000001 99 Query 1 191 use `test`; create table t1 (a int primary key)
+master-bin.000001 191 Query 1 277 use `test`; insert into t1 values (1),(1)
+master-bin.000001 277 Query 1 347 use `test`; drop table t1
+master-bin.000001 347 Query 1 439 use `test`; create table t2 (a int primary key)
+master-bin.000001 439 Query 1 520 use `test`; insert into t2 values(1)
+master-bin.000001 520 Query 1 601 use `test`; create table t3 (id int)
+master-bin.000001 601 Query 1 696 use `test`; insert into t3 values(connection_id())
+master-bin.000001 696 Query 1 809 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
+master-bin.000001 809 Query 1 882 use `test`; drop table t2,t3
--- 1.7/mysql-test/r/rpl_flush_tables.result 2004-04-07 15:12:37 +02:00
+++ 1.8/mysql-test/r/rpl_flush_tables.result 2005-03-10 20:10:06 +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 95 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
-master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
-master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
-master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
-master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
-master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 4 Format_desc 1 99 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 179 use `test`; create table t1 (a int)
+master-bin.000001 179 Query 1 262 use `test`; insert into t1 values (10)
+master-bin.000001 262 Query 1 342 use `test`; create table t2 (a int)
+master-bin.000001 342 Query 1 445 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 445 Query 1 525 use `test`; create table t4 (a int)
+master-bin.000001 525 Query 1 613 use `test`; insert into t4 select * from t3
+master-bin.000001 613 Query 1 701 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 95 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
-master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
-master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
-master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
-master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
-master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001 697 Query 1 766 use `test`; flush tables
+master-bin.000001 4 Format_desc 1 99 Server ver: SERVER_VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 179 use `test`; create table t1 (a int)
+master-bin.000001 179 Query 1 262 use `test`; insert into t1 values (10)
+master-bin.000001 262 Query 1 342 use `test`; create table t2 (a int)
+master-bin.000001 342 Query 1 445 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 445 Query 1 525 use `test`; create table t4 (a int)
+master-bin.000001 525 Query 1 613 use `test`; insert into t4 select * from t3
+master-bin.000001 613 Query 1 701 use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 701 Query 1 770 use `test`; flush tables
select * from t3;
a
--- 1.9/mysql-test/r/rpl_loaddata_rule_m.result 2004-12-06 16:15:48 +01:00
+++ 1.10/mysql-test/r/rpl_loaddata_rule_m.result 2005-03-10 20:10:06 +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 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 190 drop database if exists mysqltest
-master-bin.000001 190 Query 1 277 create database mysqltest
+master-bin.000001 99 Query 1 194 drop database if exists mysqltest
+master-bin.000001 194 Query 1 281 create database mysqltest
drop database mysqltest;
--- 1.5/mysql-test/r/rpl_loaddata_rule_s.result 2004-04-07 15:12:37 +02:00
+++ 1.6/mysql-test/r/rpl_loaddata_rule_s.result 2005-03-10 20:10:06 +01:00
@@ -10,5 +10,5 @@
select count(*) from t1;
count(*)
2
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
--- 1.15/mysql-test/r/rpl_max_relay_size.result 2004-04-07 15:12:37 +02:00
+++ 1.16/mysql-test/r/rpl_max_relay_size.result 2005-03-10 20:10:06 +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 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68141 # # master-bin.000001 Yes Yes 0 0 68141 # 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 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68141 # # master-bin.000001 Yes Yes 0 0 68141 # 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 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68141 # # master-bin.000001 Yes Yes 0 0 68141 # 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 68217 # # master-bin.000001 Yes Yes 0 0 68217 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68221 # # master-bin.000001 Yes Yes 0 0 68221 # 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 68287 # # master-bin.000001 Yes Yes 0 0 68287 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68291 # # master-bin.000001 Yes Yes 0 0 68291 # None 0 No #
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000002 95
+master-bin.000002 99
--- 1.10/mysql-test/r/rpl_relayrotate.result 2004-05-26 17:04:40 +02:00
+++ 1.11/mysql-test/r/rpl_relayrotate.result 2005-03-10 20:10:06 +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 687207 # # master-bin.000001 Yes Yes 0 0 687207 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 687211 # # master-bin.000001 Yes Yes 0 0 687211 # None 0 No #
drop table t1;
--- 1.11/mysql-test/r/rpl_reset_slave.result 2004-04-07 15:12:37 +02:00
+++ 1.12/mysql-test/r/rpl_reset_slave.result 2005-03-10 20:10:06 +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 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 99 # # master-bin.000001 Yes Yes 0 0 99 # 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 95 # # master-bin.000001 No No 0 0 95 # None 0 No #
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 99 # # master-bin.000001 No No 0 0 99 # 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 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 99 # # master-bin.000001 Yes Yes 0 0 99 # None 0 No #
stop slave;
reset slave;
start slave;
--- 1.5/mysql-test/r/rpl_server_id1.result 2004-07-06 13:34:00 +02:00
+++ 1.6/mysql-test/r/rpl_server_id1.result 2005-03-10 20:10:06 +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 95 None 0 No NULL
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 99 None 0 No NULL
start slave;
insert into t1 values (1);
show status like "slave_running";
--- 1.6/mysql-test/r/rpl_server_id2.result 2004-05-26 16:10:51 +02:00
+++ 1.7/mysql-test/r/rpl_server_id2.result 2005-03-10 20:10:06 +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 95 None 0 No NULL
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 99 None 0 No NULL
start slave;
insert into t1 values (1);
select * from t1;
--- 1.10/mysql-test/t/mix_innodb_myisam_binlog.test 2004-11-12 18:15:43 +01:00
+++ 1.11/mysql-test/t/mix_innodb_myisam_binlog.test 2005-03-10 20:10:06 +01:00
@@ -26,7 +26,7 @@
commit;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -39,7 +39,7 @@
rollback;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -54,7 +54,7 @@
commit;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -71,7 +71,7 @@
select a from t1 order by a; # check that savepoints work :)
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
# and when ROLLBACK is not explicit?
delete from t1;
@@ -92,7 +92,7 @@
# logging has been done, we use a user lock.
select get_lock("a",10);
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
# and when not in a transact1on?
delete from t1;
@@ -103,7 +103,7 @@
insert into t2 select * from t1;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
# Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately.
@@ -115,12 +115,12 @@
begin;
insert into t2 select * from t1;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
insert into t1 values(11);
commit;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
# Check that things work like before this BEGIN/ROLLBACK code was added,
@@ -138,7 +138,7 @@
commit;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -150,7 +150,7 @@
rollback;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -165,7 +165,7 @@
commit;
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
delete from t1;
delete from t2;
@@ -182,7 +182,7 @@
select a from t1 order by a; # check that savepoints work :)
--replace_column 5 #
-show binlog events from 95;
+show binlog events from 99;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
--- 1.2/mysql-test/t/mysqlbinlog2.test 2004-09-09 05:59:21 +02:00
+++ 1.3/mysql-test/t/mysqlbinlog2.test 2005-03-10 20:10:06 +01:00
@@ -46,11 +46,11 @@
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=605 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=605 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -75,11 +75,11 @@
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=601 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=605 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=123 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=127 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -102,11 +102,11 @@
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=605 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=605 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -129,11 +129,11 @@
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=601 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=605 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=123 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=127 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--- 1.10/mysql-test/t/rpl_charset.test 2004-12-06 16:15:48 +01:00
+++ 1.11/mysql-test/t/rpl_charset.test 2005-03-10 20:10:07 +01:00
@@ -107,7 +107,7 @@
drop database mysqltest2;
drop database mysqltest3;
--replace_column 2 # 5 #
-show binlog events from 95;
+show binlog events from 99;
sync_slave_with_master;
# Check that we can't change global.collation_server
--- 1.11/mysql-test/t/rpl_error_ignored_table.test 2004-05-26 16:10:51 +02:00
+++ 1.12/mysql-test/t/rpl_error_ignored_table.test 2005-03-10 20:10:07 +01:00
@@ -48,7 +48,7 @@
--error 0,1053;
reap;
connection master1;
-show binlog events from 95;
+show binlog events from 99;
save_master_pos;
connection slave;
# SQL slave thread should not have stopped (because table of the killed
--- 1.6/mysql-test/t/rpl_loaddata_rule_m.test 2004-04-07 15:12:39 +02:00
+++ 1.7/mysql-test/t/rpl_loaddata_rule_m.test 2005-03-10 20:10:07 +01:00
@@ -19,5 +19,5 @@
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 95; # should be nothing
+show binlog events from 99; # should be nothing
drop database mysqltest;
--- 1.4/mysql-test/t/rpl_loaddata_rule_s.test 2004-04-07 15:12:39 +02:00
+++ 1.5/mysql-test/t/rpl_loaddata_rule_s.test 2005-03-10 20:10:07 +01:00
@@ -17,4 +17,4 @@
connection slave;
sync_with_master;
select count(*) from t1; # check that LOAD was replicated
-show binlog events from 95; # should be nothing
+show binlog events from 99; # should be nothing
--- New file ---
+++ mysql-test/r/rpl_row_basic.result 05/03/10 20:10:08
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1));
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
<binlog> <pos> Format_desc <server_id> <end_log_pos> Server ver: 5.1.0-alpha-debug-log, Binlog ver: 4
<binlog> <pos> Query <server_id> <end_log_pos> use `test`; CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1))
SELECT * FROM t1;
C1 C2
SELECT * FROM t1;
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;
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>
<binlog> <pos> Table_map <server_id> <end_log_pos>
<binlog> <pos> Write_rows <server_id> <end_log_pos>
SELECT * FROM t1;
C1 C2
A B
X Y
X X
A C
X Z
A A
SELECT * FROM t1;
C1 C2
A B
X Y
X X
A C
X Z
A A
DELETE FROM t1 WHERE C1 = C2;
SHOW BINLOG EVENTS FROM 364;
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>
SELECT * FROM t1;
C1 C2
A B
X Y
A C
X Z
SELECT * FROM t1;
C1 C2
A B
X Y
A C
X Z
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SHOW BINLOG EVENTS FROM 437;
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>
SELECT * FROM t1;
C1 C2
A B
X Y
A I
X Z
SELECT * FROM t1;
C1 C2
A B
X Y
A I
X Z
CREATE TABLE t2 (c1 INT, c2 INT, PRIMARY KEY (c1));
INSERT INTO t2
VALUES (1,2), (2,4), (3,9), (4,15), (5,25),
(6,35), (7,50), (8,64), (9,81);
SELECT * FROM t2;
c1 c2
1 2
2 4
3 9
4 15
5 25
6 35
7 50
8 64
9 81
SELECT * FROM t2 WHERE c2 = c1 * c1;
c1 c2
2 4
3 9
5 25
8 64
9 81
SELECT * FROM t2;
c1 c2
1 2
2 4
3 9
4 15
5 25
6 35
7 50
8 64
9 81
SELECT * FROM t2 WHERE c2 = c1 * c1;
c1 c2
2 4
3 9
5 25
8 64
9 81
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
SELECT * FROM t2 WHERE c2 = c1 * c1;
c1 c2
1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81
SELECT * FROM t2 WHERE c2 = c1 * c1;
c1 c2
1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81
DELETE FROM t2 WHERE c1 % 4 = 0;
SELECT * FROM t2;
c1 c2
1 1
2 4
3 9
5 25
6 36
7 49
9 81
SELECT * FROM t2;
c1 c2
1 1
2 4
3 9
5 25
6 36
7 49
9 81
CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1));
SELECT * FROM t3;
C1 C2
SELECT * FROM t3;
C1 C2
INSERT INTO t3 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t3 VALUES ('A','C'), ('X', 'Z'), ('A', 'A');
SELECT * FROM t3;
C1 C2
A B
X Y
X X
A C
X Z
A A
SELECT * FROM t3;
C1 C2
A B
X Y
X X
A C
X Z
A A
DELETE FROM t3 WHERE C1 = C2;
SELECT * FROM t3;
C1 C2
A B
X Y
A C
X Z
SELECT * FROM t3;
C1 C2
A B
X Y
A C
X Z
SELECT * FROM t3;
C1 C2
A B
X Y
A C
X Z
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t3;
C1 C2
A B
X Y
A I
X Z
SELECT * FROM t3;
C1 C2
A B
X Y
A I
X Z
--- New file ---
+++ mysql-test/r/rpl_row_trans.result 05/03/10 20:10:08
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t4 (a CHAR(1), b CHAR(1)) engine=myisam;
CREATE TABLE t5 (a CHAR(1), b CHAR(1)) engine=innodb;
BEGIN;
INSERT INTO t4 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t5 VALUES ('A','B'), ('X','Y'), ('X','X');
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t4;
a b
A B
X Y
X X
SELECT * FROM t5;
a b
SHOW BINLOG EVENTS FROM 1354;
Log_name Pos Event_type Server_id End_log_pos Info
SELECT * FROM t4;
a b
A B
X Y
X X
SELECT * FROM t5;
a b
BEGIN;
INSERT INTO t5 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t4 VALUES ('A','B'), ('X','Y'), ('X','X');
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t4;
a b
A B
X Y
X X
A B
X Y
X X
SELECT * FROM t5;
a b
SHOW BINLOG EVENTS FROM 1724;
Log_name Pos Event_type Server_id End_log_pos Info
SELECT * FROM t4;
a b
A B
X Y
X X
A B
X Y
X X
SELECT * FROM t5;
a b
--- New file ---
+++ mysql-test/t/rpl_row_basic-master.opt 05/03/10 20:10:08
--binlog-format=row
--- New file ---
+++ mysql-test/t/rpl_row_basic-slave.opt 05/03/10 20:10:08
--- New file ---
+++ mysql-test/t/rpl_row_basic.test 05/03/10 20:10:09
source include/master-slave.inc
#
# Basic tests of row-level logging
#
CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1));
--replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
SHOW BINLOG EVENTS;
SELECT * FROM t1;
sync_slave_with_master;
SELECT * FROM t1;
# Testing insert
connection master;
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;
SELECT * FROM t1;
sync_slave_with_master;
SELECT * FROM t1;
# Testing delete
# Observe that are several rows having the value for the index but only one
# should be deleted.
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;
SELECT * FROM t1;
sync_slave_with_master;
SELECT * FROM t1;
#
# Testing update.
# Note that we have a condition on a column that is not part of the index for
# the table. The right row should be updated nevertheless.
#
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;
SELECT * FROM t1;
sync_slave_with_master;
SELECT * FROM t1;
#
# Testing table with primary key
#
connection master;
CREATE TABLE t2 (c1 INT, c2 INT, PRIMARY KEY (c1));
INSERT INTO t2
VALUES (1,2), (2,4), (3,9), (4,15), (5,25),
(6,35), (7,50), (8,64), (9,81);
SELECT * FROM t2;
SELECT * FROM t2 WHERE c2 = c1 * c1;
sync_slave_with_master;
SELECT * FROM t2;
SELECT * FROM t2 WHERE c2 = c1 * c1;
connection master;
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
SELECT * FROM t2 WHERE c2 = c1 * c1;
sync_slave_with_master;
SELECT * FROM t2 WHERE c2 = c1 * c1;
connection master;
DELETE FROM t2 WHERE c1 % 4 = 0;
SELECT * FROM t2;
sync_slave_with_master;
SELECT * FROM t2;
#
# Testing table without index or primary key
# We don't bother about the binlog events here: they have been verified
# earlier.
#
connection master;
CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1));
SELECT * FROM t3;
sync_slave_with_master;
SELECT * FROM t3;
connection master;
INSERT INTO t3 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t3 VALUES ('A','C'), ('X', 'Z'), ('A', 'A');
SELECT * FROM t3;
sync_slave_with_master;
SELECT * FROM t3;
connection master;
DELETE FROM t3 WHERE C1 = C2;
SELECT * FROM t3;
sync_slave_with_master;
SELECT * FROM t3;
connection master;
SELECT * FROM t3;
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SELECT * FROM t3;
sync_slave_with_master;
SELECT * FROM t3;
--- New file ---
+++ mysql-test/t/rpl_row_trans-master.opt 05/03/10 20:10:09
--binlog-format=row
--- New file ---
+++ mysql-test/t/rpl_row_trans-slave.opt 05/03/10 20:10:09
--- New file ---
+++ mysql-test/t/rpl_row_trans.test 05/03/10 20:10:09
source include/master-slave.inc
#
# Testing mixed usage of storage engines
#
#
# Testing transactions on non-transactional tables.
#
connection master;
CREATE TABLE t4 (a CHAR(1), b CHAR(1)) engine=myisam;
CREATE TABLE t5 (a CHAR(1), b CHAR(1)) engine=innodb;
BEGIN;
INSERT INTO t4 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t5 VALUES ('A','B'), ('X','Y'), ('X','X');
ROLLBACK;
SELECT * FROM t4;
SELECT * FROM t5;
--replace_column 1 <binlog> 4 <server-id> 5 <End-pos>
SHOW BINLOG EVENTS FROM 1354;
sync_slave_with_master;
SELECT * FROM t4;
SELECT * FROM t5;
# Test insertions in a transaction in opposite order: it should make no
# difference which INSERT comes first.
connection master;
BEGIN;
INSERT INTO t5 VALUES ('A','B'), ('X','Y'), ('X','X');
INSERT INTO t4 VALUES ('A','B'), ('X','Y'), ('X','X');
ROLLBACK;
SELECT * FROM t4;
SELECT * FROM t5;
--replace_column 1 <binlog> 4 <server_id> 5 <end_pos>
SHOW BINLOG EVENTS;
sync_slave_with_master;
SELECT * FROM t4;
SELECT * FROM t5;
--- 1.22/mysql-test/r/insert_select.result 2004-12-06 16:15:48 +01:00
+++ 1.23/mysql-test/r/insert_select.result 2005-03-10 20:10:06 +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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 183 use `test`; insert into t1 select * from t2
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 187 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 95 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
--- 1.18/mysql-test/r/rpl_flush_log_loop.result 2004-07-15 03:18:45 +02:00
+++ 1.19/mysql-test/r/rpl_flush_log_loop.result 2005-03-10 20:10:06 +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 199 # # slave-bin.000001 Yes Yes 0 0 199 # None 0 No #
+# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 203 # # slave-bin.000001 Yes Yes 0 0 203 # None 0 No #
--- 1.23/mysql-test/r/rpl_loaddata.result 2004-04-07 15:12:37 +02:00
+++ 1.24/mysql-test/r/rpl_loaddata.result 2005-03-10 20:10:06 +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 1068
+slave-bin.000001 1072
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 1503 # # master-bin.000001 Yes Yes 0 0 1503 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1507 # # master-bin.000001 Yes Yes 0 0 1507 # 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 1611 # # master-bin.000001 No No 0 0 1611 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1615 # # master-bin.000001 No No 0 0 1615 # 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 529
+master-bin.000001 533
drop table t2;
--- 1.65/sql/sp.cc 2005-01-06 11:59:59 +01:00
+++ 1.66/sql/sp.cc 2005-03-10 20:10:07 +01:00
@@ -405,7 +405,7 @@
system_charset_info);
ret= SP_OK;
- if (table->file->write_row(table->record[0]))
+ if (table->file->ha_write_row(table->record[0]))
ret= SP_WRITE_ROW_FAILED;
}
@@ -430,7 +430,7 @@
ret= db_find_routine_aux(thd, type, name, TL_WRITE, &table, &opened);
if (ret == SP_OK)
{
- if (table->file->delete_row(table->record[0]))
+ if (table->file->ha_delete_row(table->record[0]))
ret= SP_DELETE_ROW_FAILED;
}
@@ -466,7 +466,7 @@
table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment.str,
chistics->comment.length,
system_charset_info);
- if ((table->file->update_row(table->record[1],table->record[0])))
+ if ((table->file->ha_update_row(table->record[1],table->record[0])))
ret= SP_WRITE_ROW_FAILED;
}
if (opened)
@@ -691,7 +691,7 @@
bool deleted= FALSE;
do {
- if (! table->file->delete_row(table->record[0]))
+ if (! table->file->ha_delete_row(table->record[0]))
deleted= TRUE; /* We deleted something */
else
{
--- 1.82/sql/slave.h 2004-12-22 12:54:26 +01:00
+++ 1.83/sql/slave.h 2005-03-10 20:10:07 +01:00
@@ -334,6 +334,17 @@
return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
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();
} RELAY_LOG_INFO;
--- 1.24/mysql-test/r/rpl_replicate_do.result 2004-07-15 03:18:45 +02:00
+++ 1.25/mysql-test/r/rpl_replicate_do.result 2005-03-10 20:10:06 +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 1554 # # master-bin.000001 Yes Yes test.t1 0 0 1554 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1558 # # master-bin.000001 Yes Yes test.t1 0 0 1558 # None 0 No #
--- 1.32/mysql-test/r/rpl000015.result 2004-11-22 20:54:41 +01:00
+++ 1.33/mysql-test/r/rpl000015.result 2005-03-10 20:10:06 +01:00
@@ -1,7 +1,7 @@
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 95
+master-bin.000001 99
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 95 # # master-bin.000001 Yes Yes 0 0 95 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 99 # # master-bin.000001 Yes Yes 0 0 99 # None 0 No #
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
--- 1.58/mysql-test/r/rpl_rotate_logs.result 2004-11-22 20:54:41 +01:00
+++ 1.59/mysql-test/r/rpl_rotate_logs.result 2005-03-10 20:10:06 +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 521 # # master-bin.000001 Yes Yes 0 0 521 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 525 # # master-bin.000001 Yes Yes 0 0 525 # 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 469 # # master-bin.000003 Yes Yes 0 0 469 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 473 # # master-bin.000003 Yes Yes 0 0 473 # 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 1387
+master-bin.000005 1391
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 1387 # # master-bin.000005 Yes Yes 0 0 1387 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 1391 # # master-bin.000005 Yes Yes 0 0 1391 # None 0 No #
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
--- 1.52/mysql-test/r/rpl_log.result 2004-04-07 15:12:37 +02:00
+++ 1.53/mysql-test/r/rpl_log.result 2005-03-10 20:10:06 +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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-master-bin.000001 323 Query 1 393 use `test`; drop table t1
-master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
-master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
-master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
-show binlog events from 95 limit 1;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-show binlog events from 95 limit 2;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
-show binlog events from 95 limit 2,1;
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 214 Intvar 1 242 INSERT_ID=1
+master-bin.000001 242 Query 1 327 use `test`; insert into t1 values (NULL)
+master-bin.000001 327 Query 1 397 use `test`; drop table t1
+master-bin.000001 397 Query 1 494 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 494 Create_file 1 1164 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1164 Exec_load 1 1187 ;file_id=1
+master-bin.000001 1187 Query 1 1257 use `test`; drop table t1
+show binlog events from 99 limit 1;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+show binlog events from 99 limit 2;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 214 Intvar 1 242 INSERT_ID=1
+show binlog events from 99 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
+master-bin.000001 242 Query 1 327 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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-master-bin.000001 323 Query 1 393 use `test`; drop table t1
-master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
-master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
-master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
-master-bin.000001 1253 Rotate 1 1297 master-bin.000002;pos=4
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 214 Intvar 1 242 INSERT_ID=1
+master-bin.000001 242 Query 1 327 use `test`; insert into t1 values (NULL)
+master-bin.000001 327 Query 1 397 use `test`; drop table t1
+master-bin.000001 397 Query 1 494 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 494 Create_file 1 1164 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1164 Exec_load 1 1187 ;file_id=1
+master-bin.000001 1187 Query 1 1257 use `test`; drop table t1
+master-bin.000001 1257 Rotate 1 1301 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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000002 95 Query 1 175 use `test`; create table t5 (a int)
-master-bin.000002 175 Query 1 245 use `test`; drop table t5
-master-bin.000002 245 Query 1 325 use `test`; create table t1 (n int)
-master-bin.000002 325 Query 1 407 use `test`; insert into t1 values (1)
-master-bin.000002 407 Query 1 477 use `test`; drop table t1
+master-bin.000002 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000002 99 Query 1 179 use `test`; create table t5 (a int)
+master-bin.000002 179 Query 1 249 use `test`; drop table t5
+master-bin.000002 249 Query 1 329 use `test`; create table t1 (n int)
+master-bin.000002 329 Query 1 411 use `test`; insert into t1 values (1)
+master-bin.000002 411 Query 1 481 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 95 Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-slave-bin.000001 210 Intvar 1 238 INSERT_ID=1
-slave-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-slave-bin.000001 323 Query 1 393 use `test`; drop table t1
-slave-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-slave-bin.000001 490 Create_file 1 1169 db=test;table=t1;file_id=1;block_len=581
-slave-bin.000001 1169 Exec_load 1 1192 ;file_id=1
-slave-bin.000001 1192 Query 1 1262 use `test`; drop table t1
-slave-bin.000001 1262 Query 1 1342 use `test`; create table t5 (a int)
-slave-bin.000001 1342 Query 1 1412 use `test`; drop table t5
-slave-bin.000001 1412 Rotate 2 1455 slave-bin.000002;pos=4
+slave-bin.000001 4 Format_desc 2 99 Server ver: VERSION, Binlog ver: 4
+slave-bin.000001 99 Query 1 214 use `test`; create table t1(n int not null auto_increment primary key)
+slave-bin.000001 214 Intvar 1 242 INSERT_ID=1
+slave-bin.000001 242 Query 1 327 use `test`; insert into t1 values (NULL)
+slave-bin.000001 327 Query 1 397 use `test`; drop table t1
+slave-bin.000001 397 Query 1 494 use `test`; create table t1 (word char(20) not null)
+slave-bin.000001 494 Create_file 1 1173 db=test;table=t1;file_id=1;block_len=581
+slave-bin.000001 1173 Exec_load 1 1196 ;file_id=1
+slave-bin.000001 1196 Query 1 1266 use `test`; drop table t1
+slave-bin.000001 1266 Query 1 1346 use `test`; create table t5 (a int)
+slave-bin.000001 1346 Query 1 1416 use `test`; drop table t5
+slave-bin.000001 1416 Rotate 2 1459 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 95 Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 95 Query 1 175 use `test`; create table t1 (n int)
-slave-bin.000002 175 Query 1 257 use `test`; insert into t1 values (1)
-slave-bin.000002 257 Query 1 327 use `test`; drop table t1
+slave-bin.000002 4 Format_desc 2 99 Server ver: VERSION, Binlog ver: 4
+slave-bin.000002 99 Query 1 179 use `test`; create table t1 (n int)
+slave-bin.000002 179 Query 1 261 use `test`; insert into t1 values (1)
+slave-bin.000002 261 Query 1 331 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 477 # # master-bin.000002 Yes Yes 0 0 477 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 481 # # master-bin.000002 Yes Yes 0 0 481 # 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.23/mysql-test/r/user_var.result 2005-01-17 10:57:54 +01:00
+++ 1.24/mysql-test/r/user_var.result 2005-03-10 20:10:06 +01:00
@@ -174,13 +174,13 @@
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 95;
+show binlog events from 99;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
-master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`)
-master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 264 User var 1 302 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
-master-bin.000001 302 Query 1 396 use `test`; insert into t1 values (@var1),(@var2)
+master-bin.000001 99 User var 1 140 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 140 Query 1 226 use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001 226 User var 1 268 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001 268 User var 1 306 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
+master-bin.000001 306 Query 1 400 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`;
use test;
--- 1.23/mysql-test/t/rpl_log.test 2004-05-26 16:10:51 +02:00
+++ 1.24/mysql-test/t/rpl_log.test 2005-03-10 20:10:07 +01:00
@@ -38,9 +38,9 @@
drop table t1;
--replace_result $VERSION VERSION
show binlog events;
-show binlog events from 95 limit 1;
-show binlog events from 95 limit 2;
-show binlog events from 95 limit 2,1;
+show binlog events from 99 limit 1;
+show binlog events from 99 limit 2;
+show binlog events from 99 limit 2,1;
flush logs;
# We need an extra update before doing save_master_pos.
--- 1.18/mysql-test/t/user_var.test 2005-01-16 21:07:22 +01:00
+++ 1.19/mysql-test/t/user_var.test 2005-03-10 20:10:07 +01:00
@@ -110,7 +110,7 @@
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 95;
+show binlog events from 99;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
--- 1.13/mysql-test/r/rpl_temporary.result 2004-07-15 03:18:45 +02:00
+++ 1.14/mysql-test/r/rpl_temporary.result 2005-03-10 20:10:06 +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 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 178 use `test`; drop table if exists t1,t2
-master-bin.000001 178 Query 1 257 use `test`; create table t1(f int)
-master-bin.000001 257 Query 1 336 use `test`; create table t2(f int)
-master-bin.000001 336 Query 1 455 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
-master-bin.000001 455 Query 1 544 use `test`; create temporary table t3(f int)
-master-bin.000001 544 Query 1 642 use `test`; insert into t3 select * from t1 where f<6
-master-bin.000001 642 Query 1 731 use `test`; create temporary table t3(f int)
-master-bin.000001 731 Query 1 826 use `test`; insert into t2 select count(*) from t3
-master-bin.000001 826 Query 1 925 use `test`; insert into t3 select * from t1 where f>=4
-master-bin.000001 925 Query 1 1005 use `test`; drop temporary table t3
-master-bin.000001 1005 Query 1 1100 use `test`; insert into t2 select count(*) from t3
-master-bin.000001 1100 Query 1 1180 use `test`; drop temporary table t3
+master-bin.000001 4 Format_desc 1 99 Server ver: VERSION, Binlog ver: 4
+master-bin.000001 99 Query 1 182 use `test`; drop table if exists t1,t2
+master-bin.000001 182 Query 1 261 use `test`; create table t1(f int)
+master-bin.000001 261 Query 1 340 use `test`; create table t2(f int)
+master-bin.000001 340 Query 1 459 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
+master-bin.000001 459 Query 1 548 use `test`; create temporary table t3(f int)
+master-bin.000001 548 Query 1 646 use `test`; insert into t3 select * from t1 where f<6
+master-bin.000001 646 Query 1 735 use `test`; create temporary table t3(f int)
+master-bin.000001 735 Query 1 830 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 830 Query 1 929 use `test`; insert into t3 select * from t1 where f>=4
+master-bin.000001 929 Query 1 1009 use `test`; drop temporary table t3
+master-bin.000001 1009 Query 1 1104 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 1104 Query 1 1184 use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.1774) | Mats Kindahl | 10 Mar |