Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1834 05/04/01 13:40:23 mats@stripped +71 -0
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/sql_class.h
1.229 05/04/01 13:40:14 mats@stripped +1 -2
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/sql_class.cc
1.174 05/04/01 13:40:13 mats@stripped +0 -5
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/log_event.cc
1.171 05/04/01 13:40:13 mats@stripped +0 -29
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/log.cc
1.159 05/04/01 13:40:13 mats@stripped +0 -3
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/handler.h
1.133 05/04/01 13:40:13 mats@stripped +0 -7
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
sql/handler.cc
1.151 05/04/01 13:40:13 mats@stripped +0 -13
Merging WL#1012 changes to 5.1 tree into 5.1 clone for WL#2325.
mysql-test/t/rpl_row_basic.test
1.4 05/04/01 13:40:13 mats@stripped +0 -3
Binlog position change.
mysql-test/r/rpl_user_variables.result
1.18 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_until.result
1.24 05/04/01 13:40:13 mats@stripped +6 -13
Binlog position change.
mysql-test/r/rpl_server_id2.result
1.12 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_server_id1.result
1.11 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_rotate_logs.result
1.70 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_reset_slave.result
1.17 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_replicate_do.result
1.32 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_relayrotate.result
1.20 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_multi_query.result
1.7 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_max_relay_size.result
1.23 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_log_pos.result
1.46 05/04/01 13:40:13 mats@stripped +6 -6
Binlog position change.
mysql-test/r/rpl_log.result
1.60 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_loaddata_rule_s.result
1.11 05/04/01 13:40:13 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_loaddata_rule_m.result
1.17 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_loaddata.result
1.31 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_flush_log_loop.result
1.26 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_error_ignored_table.result
1.23 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_deadlock.result
1.6 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_charset.result
1.22 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl_change_master.result
1.20 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/rpl000015.result
1.38 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/mix_innodb_myisam_binlog.result
1.24 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
mysql-test/r/ctype_ucs.result
1.35 05/04/01 13:40:12 mats@stripped +0 -0
Binlog position change.
sql/sql_update.cc
1.152 05/04/01 13:32:33 mats@stripped +0 -0
Auto merged
sql/sql_udf.cc
1.45 05/04/01 13:32:33 mats@stripped +0 -0
Auto merged
sql/sql_table.cc
1.228 05/04/01 13:32:33 mats@stripped +0 -0
Auto merged
sql/sql_show.cc
1.225 05/04/01 13:32:33 mats@stripped +0 -0
Auto merged
sql/sql_select.cc
1.304 05/04/01 13:32:32 mats@stripped +0 -2
Auto merged
sql/sql_insert.cc
1.146 05/04/01 13:32:32 mats@stripped +0 -0
Auto merged
sql/sql_delete.cc
1.144 05/04/01 13:32:31 mats@stripped +0 -0
Auto merged
sql/sql_acl.cc
1.135 05/04/01 13:32:31 mats@stripped +0 -0
Auto merged
sql/sp.cc
1.73 05/04/01 13:32:30 mats@stripped +0 -0
Auto merged
sql/slave.cc
1.243 05/04/01 13:32:30 mats@stripped +0 -0
Auto merged
sql/rpl_injector.cc
1.7 05/04/01 13:32:30 mats@stripped +0 -21
Auto merged
sql/mysqld.cc
1.444 05/04/01 13:32:29 mats@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.281 05/04/01 13:32:29 mats@stripped +0 -0
Auto merged
sql/log_event.h
1.109 05/04/01 13:32:29 mats@stripped +0 -22
Auto merged
sql/item_sum.cc
1.133 05/04/01 13:32:28 mats@stripped +0 -1
Auto merged
sql/Makefile.am
1.106 05/04/01 13:32:27 mats@stripped +0 -0
Auto merged
mysql-test/t/user_var.test
1.25 05/04/01 13:32:27 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_user_variables.test
1.13 05/04/01 13:32:27 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_until.test
1.16 05/04/01 13:32:26 mats@stripped +0 -3
Auto merged
mysql-test/t/rpl_multi_query.test
1.7 05/04/01 13:32:26 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_log_pos.test
1.35 05/04/01 13:32:26 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_log.test
1.27 05/04/01 13:32:26 mats@stripped +0 -3
Auto merged
mysql-test/t/rpl_loaddata_rule_s.test
1.8 05/04/01 13:32:25 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_loaddata_rule_m.test
1.10 05/04/01 13:32:25 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_error_ignored_table.test
1.15 05/04/01 13:32:25 mats@stripped +0 -1
Auto merged
mysql-test/t/rpl_deadlock.test
1.5 05/04/01 13:32:25 mats@stripped +0 -2
Auto merged
mysql-test/t/rpl_charset.test
1.17 05/04/01 13:32:24 mats@stripped +0 -1
Auto merged
mysql-test/t/mysqlbinlog2.test
1.6 05/04/01 13:32:24 mats@stripped +0 -8
Auto merged
mysql-test/t/mysqlbinlog.test
1.17 05/04/01 13:32:24 mats@stripped +0 -2
Auto merged
mysql-test/t/mix_innodb_myisam_binlog.test
1.15 05/04/01 13:32:24 mats@stripped +0 -12
Auto merged
mysql-test/t/ctype_ucs.test
1.28 05/04/01 13:32:24 mats@stripped +0 -1
Auto merged
mysql-test/t/binlog.test
1.6 05/04/01 13:32:23 mats@stripped +0 -3
Auto merged
mysql-test/r/user_var.result
1.31 05/04/01 13:32:23 mats@stripped +0 -0
Auto merged
mysql-test/r/rpl_timezone.result
1.12 05/04/01 13:32:23 mats@stripped +0 -0
Auto merged
mysql-test/r/rpl_temporary.result
1.21 05/04/01 13:32:22 mats@stripped +0 -0
Auto merged
mysql-test/r/rpl_row_basic.result
1.4 05/04/01 13:32:22 mats@stripped +0 -3
Auto merged
mysql-test/r/rpl_flush_tables.result
1.15 05/04/01 13:32:20 mats@stripped +0 -0
Auto merged
mysql-test/r/mysqlbinlog.result
1.18 05/04/01 13:32:19 mats@stripped +0 -0
Auto merged
mysql-test/r/insert_select.result
1.30 05/04/01 13:32:19 mats@stripped +0 -0
Auto merged
BitKeeper/deleted/.del-rpl_tblmap.h
1.2 05/04/01 13:32:18 mats@stripped +0 -0
Delete: sql/rpl_tblmap.h
BitKeeper/deleted/.del-rpl_tblmap.cc
1.2 05/04/01 13:32:06 mats@stripped +0 -0
Delete: sql/rpl_tblmap.cc
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mats
# Host: romeo.kindahl.net
# Root: /home/bk/w2325-mysql-5.1/RESYNC
--- 1.150/sql/handler.cc 2005-03-23 11:15:20 +01:00
+++ 1.151/sql/handler.cc 2005-04-01 13:40:13 +02:00
@@ -2404,13 +2404,17 @@
table->field[i]->ptr));
}
#endif
+ DBUG_PRINT("info", ("Writing row to actual handler"));
if (int error = write_row(buf)) {
DBUG_PRINT("exit", ("error = %d", error));
DBUG_RETURN(error);
}
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- bitvector const bv(table->s->fields, true);
- m_row_writer.write_row(bv, buf);
+ DBUG_PRINT("info", ("Writing row to THD"));
+ if (table->s->tmp_table == NO_TMP_TABLE) {
+ bitvector const cols(table->s->fields, true);
+ thd->write_row(table, cols, buf);
+ }
#endif
DBUG_PRINT("exit", ("error = %d", 0));
DBUG_RETURN(0);
@@ -2438,8 +2442,10 @@
DBUG_RETURN(error);
}
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- bitvector const cols(table->s->fields, true);
- m_row_writer.update_row(cols, old_data, new_data);
+ if (table->s->tmp_table == NO_TMP_TABLE) {
+ bitvector const cols(table->s->fields, true);
+ thd->update_row(table, cols, old_data, new_data);
+ }
#endif
DBUG_PRINT("exit", ("error = %d", 0));
DBUG_RETURN(0);
@@ -2467,8 +2473,10 @@
DBUG_RETURN(error);
}
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- bitvector const cols(table->s->fields, true);
- m_row_writer.delete_row(cols, buf);
+ if (table->s->tmp_table == NO_TMP_TABLE) {
+ bitvector const cols(table->s->fields, true);
+ thd->delete_row(table, cols, buf);
+ }
#endif
DBUG_PRINT("exit", ("error = %d", 0));
DBUG_RETURN(0);
@@ -2478,7 +2486,7 @@
ha_stmt_begin()
{
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- return m_row_writer.transaction_begin();
+ return current_thd->transaction_begin();
#else
return 0;
#endif
@@ -2488,230 +2496,8 @@
ha_stmt_end()
{
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- return m_row_writer.transaction_end();
+ return current_thd->transaction_end();
#else
return 0;
#endif
}
-
-
-/**************************************************************************
- Row_rw_base member functions
-**************************************************************************/
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-Row_rw_base::
-Row_rw_base(THD *thd, TABLE *table)
- : m_thd(thd), m_table(table)
-{
-}
-
-size_t Row_rw_base::
-max_row_length(const byte * const record) const
-{
- 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);
-}
-
-#endif
-
-/**************************************************************************
- Row_writer member functions
-**************************************************************************/
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-int Row_writer::
-write_row(bitvector const& cols, byte const *record)
-{
- DBUG_ENTER("Row_writer::write_row");
- DBUG_PRINT("enter", ("cols = { size: %d, data = %p }; record = %p",
- cols.size(), cols.data(), record));
-
- if (!opt_binlog_row_level || !mysql_bin_log.is_open())
- DBUG_RETURN(0);
-
- 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 = thd->prepare_pending<Write_rows_log_event>(m_table, m_server_id, cols,
len);
-
- if (ev == NULL)
- DBUG_RETURN(1);
-
- // add_row_data copies row_data to internal buffer
- ev->add_row_data(row_data,len);
-
- my_free(row_data, MYF(MY_WME));
-
- DBUG_RETURN(0);
-}
-
-int Row_writer::
-update_row(bitvector const& cols,
- const byte *before_record, const byte *after_record)
-{
- DBUG_ENTER("Row_writer::update_row");
- DBUG_PRINT("enter", ("before: 0x%0x; after: 0x%0x",
- 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 = thd->prepare_pending<Update_rows_log_event>(m_table,
- m_server_id, cols,
- 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(bitvector const& cols, 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 = thd->prepare_pending<Delete_rows_log_event>(m_table,
- m_server_id, cols, 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;
- ulong table_id = mysql_bin_log.get_table_id(m_table);
- Table_map_log_event the_event(thd, m_table, table_id, m_has_trans);
- if (mysql_bin_log.write(&the_event))
- DBUG_RETURN(1);
- DBUG_RETURN(0);
-}
-
-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 = thd->get_pending_event()) {
- pending->set_flags(Rows_log_event::STMT_END_F);
- }
- }
-
- DBUG_PRINT("flush", ("thd = 0x%0x", thd));
- int const error = thd->flush_and_set_pending_event(0);
- DBUG_RETURN(error);
-}
-
-#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
--- 1.132/sql/handler.h 2005-03-23 11:15:20 +01:00
+++ 1.133/sql/handler.h 2005-04-01 13:40:13 +02:00
@@ -409,103 +409,6 @@
} 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:
- Row_rw_base(THD *thd, TABLE *table);
-
- 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;
-};
-
-/*****************************************************************************
-
- 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
-
- ****************************************************************************/
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
-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() {}
-
- int write_row(bitvector const& cols,
- const byte *buf);
- int delete_row(bitvector const& cols,
- const byte *buf);
- int update_row(bitvector const& cols,
- const byte *old_data, const byte *new_data);
-
- void set_server_id(uint32 sid) { m_server_id = sid; }
-
- int transaction_begin() {
- return write_table_map();
- }
-
- int transaction_end() {
- return flush_pending_event(true);
- }
-
-private:
- int flush_pending_event(bool stmt_end);
- int write_table_map();
-
- uint32 m_server_id;
- bool m_has_trans;
-};
-
-#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
class handler :public Sql_alloc
{
@@ -575,9 +478,6 @@
ref_length(sizeof(my_off_t)), block_size(0),
raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0),
pushed_cond(NULL)
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- , m_row_writer(current_thd, table_arg, has_transactions())
-#endif
{}
virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ }
int ha_open(const char *name, int mode, int test_if_locked);
@@ -874,11 +774,6 @@
*/
virtual void cond_pop() { return; };
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- // This is a temporary solution
- Row_writer* row_writer() { return &m_row_writer; }
-#endif
-
private:
/*
Row-level primitives for storage engines.
@@ -890,10 +785,6 @@
{ return HA_ERR_WRONG_COMMAND; }
virtual int delete_row(const byte * buf)
{ return HA_ERR_WRONG_COMMAND; }
-
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- Row_writer m_row_writer;
-#endif
};
/* Some extern variables used with handlers */
--- 1.158/sql/log.cc 2005-03-23 11:15:20 +01:00
+++ 1.159/sql/log.cc 2005-04-01 13:40:13 +02:00
@@ -1744,6 +1744,7 @@
if (file == &log_file) // we are writing to the real log (disk)
{
+ DBUG_PRINT("info", ("Flushing cache %p", file));
if (flush_io_cache(file) || sync_binlog(file))
goto err;
}
@@ -2310,6 +2311,7 @@
{
DBUG_ENTER("MYSQL_LOG::get_table_id(TABLE*)");
DBUG_PRINT("enter", ("table=%p", table));
+ DBUG_ASSERT(table != NULL);
// Have to create it here since it relies on my_malloc, which requires
// my_init() to have been executed prior to this.
@@ -2317,16 +2319,44 @@
m_table_map = new table_mapping;
DBUG_ASSERT(m_table_map != NULL);
+
ulong tid = m_table_map->get_table_id(table);
- if (tid == m_table_map->count()) {
+ if (tid == table_mapping::NO_TABLE) {
// We can't use the number of tables in the list since the highest table
// id might be larger than the number of elements in the list.
tid = m_next_table_id++;
+
+ // There is one reserved number that cannot be used.
+ if (tid == table_mapping::NO_TABLE)
+ tid = m_next_table_id++;
+
m_table_map->set_table(tid, table);
}
DBUG_PRINT("return", ("table_id=%d", tid));
DBUG_RETURN(tid);
}
+
+int MYSQL_LOG::
+is_table_mapped(TABLE* table) const
+{
+ DBUG_ASSERT(table != NULL);
+
+ // Have to create it here since it relies on my_malloc, which requires
+ // my_init() to have been executed prior to this.
+ if (m_table_map == NULL)
+ m_table_map = new table_mapping;
+
+ DBUG_ASSERT(m_table_map != NULL);
+ return m_table_map->get_table_id(table) != table_mapping::NO_TABLE;
+}
+
+void MYSQL_LOG::
+clear_table_mappings()
+{
+ DBUG_ASSERT(m_table_map != NULL);
+ m_table_map->clear_tables();
+}
+
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
#ifdef __NT__
--- 1.170/sql/log_event.cc 2005-03-23 11:15:20 +01:00
+++ 1.171/sql/log_event.cc 2005-04-01 13:40:13 +02:00
@@ -4723,9 +4723,8 @@
#ifndef MYSQL_CLIENT
Rows_log_event::
-Rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid,
- bitvector const& cols, bool using_trans)
- : Log_event(thd_arg, 0, using_trans),
+Rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid, bitvector const& cols)
+ : Log_event(thd_arg, 0, tbl_arg->file->has_transactions()),
m_dbnam(thd_arg->db), m_dblen(m_dbnam ? strlen(m_dbnam) : 0),
m_table(tbl_arg),
m_tblnam(tbl_arg->s->table_name),
@@ -4916,7 +4915,7 @@
}
do_after_row_operations(table);
- if (m_rows_flags & STMT_END_F) {
+ if (m_rows_flags & TRANS_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.
@@ -4982,10 +4981,10 @@
*/
#ifndef MYSQL_CLIENT
Table_map_log_event::
-Table_map_log_event(THD* thd, TABLE* tbl, ulong tid, bool using_trans)
- : Log_event(thd, 0, using_trans),
+Table_map_log_event(THD* thd, TABLE* tbl, ulong tid)
+ : Log_event(thd, 0, tbl->file->has_transactions()),
m_table(tbl),
- m_dbnam(thd->db),
+ m_dbnam(tbl->s->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)),
@@ -5000,6 +4999,9 @@
m_data_size += m_tbllen + 2; // Include length and terminating \0
m_data_size += 1 + m_colcnt; // COLCNT and column types
+ DBUG_PRINT("info", ("m_dbnam='%s', m_tblnam='%s', m_table_id=%d",
+ m_dbnam, m_tblnam, m_table_id));
+
DBUG_ASSERT(m_memory == NULL);
if ((m_memory = my_multi_malloc(MYF(0),
&m_coltype, m_colcnt,
@@ -5196,9 +5198,8 @@
#ifndef MYSQL_CLIENT
Write_rows_log_event::
Write_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid_arg,
- bitvector const& cols,
- bool using_trans)
- : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, using_trans)
+ bitvector const& cols)
+ : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols)
{
}
#endif
@@ -5244,6 +5245,7 @@
do_exec_row(TABLE* table, st_relay_log_info* rli)
{
DBUG_ENTER("Write_rows_log_event::do_exec_row(TABLE*,...)");
+ DBUG_ASSERT(table != NULL);
int error = table->file->ha_write_row(table->record[0]);
DBUG_RETURN(error);
}
@@ -5287,11 +5289,11 @@
#ifndef MYSQL_CLIENT
Delete_rows_log_event::
Delete_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid,
- bitvector const& cols, bool using_trans)
+ bitvector const& cols)
#ifndef HAVE_REPLICATION
- : Rows_log_event(thd_arg, tbl_arg, tid, cols, using_trans)
+ : Rows_log_event(thd_arg, tbl_arg, tid, cols)
#else
- : Rows_log_event(thd_arg, tbl_arg, tid, cols, using_trans),
+ : Rows_log_event(thd_arg, tbl_arg, tid, cols),
m_memory(NULL), m_key(NULL), m_search_record(NULL)
#endif
{
@@ -5393,6 +5395,7 @@
do_exec_row(TABLE* table, st_relay_log_info* rli)
{
DBUG_ENTER("Delete_rows_log_event::do_exec_row(TABLE*,...)");
+ DBUG_ASSERT(table != NULL);
if (table->s->keys > 0) {
if (int error = table->file->index_read(m_search_record, m_key,
@@ -5462,9 +5465,8 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
Update_rows_log_event::
Update_rows_log_event(THD* thd_arg, TABLE* tbl_arg, ulong tid,
- bitvector const& cols,
- bool using_trans)
-: Rows_log_event(thd_arg, tbl_arg, tid, cols, using_trans),
+ bitvector const& cols)
+: Rows_log_event(thd_arg, tbl_arg, tid, cols),
m_memory(NULL), m_key(NULL)
{
}
@@ -5565,6 +5567,7 @@
do_exec_row(TABLE* table, st_relay_log_info* rli)
{
DBUG_ENTER("Update_rows_log_event::do_exec_row(TABLE*,...)");
+ DBUG_ASSERT(table != NULL);
if (table->s->keys > 0) {
if (int error = table->file
->index_read(m_search_record, m_key,
--- 1.108/sql/log_event.h 2005-03-23 11:15:21 +01:00
+++ 1.109/sql/log_event.h 2005-04-01 13:32:29 +02:00
@@ -1619,7 +1619,7 @@
};
#ifndef MYSQL_CLIENT
- Table_map_log_event(THD *thd, TABLE* tbl, ulong tid, bool using_trans);
+ Table_map_log_event(THD *thd, TABLE* tbl, ulong tid);
#endif
Table_map_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event);
@@ -1739,7 +1739,7 @@
// this class, not create instances of this class.
#ifndef MYSQL_CLIENT
Rows_log_event(THD*, TABLE*, ulong table_id,
- bitvector const& cols, bool using_trans);
+ bitvector const& cols);
#endif
Rows_log_event(const char* row_data, uint event_len,
Log_event_type event_type,
@@ -1859,8 +1859,7 @@
};
#ifndef MYSQL_CLIENT
- Write_rows_log_event(THD*, TABLE*, ulong table_id,
- bitvector const& cols, bool using_trans);
+ Write_rows_log_event(THD*, TABLE*, ulong table_id, bitvector const& cols);
#endif
Write_rows_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event);
@@ -1905,8 +1904,7 @@
};
#ifndef MYSQL_CLIENT
- Update_rows_log_event(THD*, TABLE*, ulong table_id,
- bitvector const& cols, bool using_trans);
+ Update_rows_log_event(THD*, TABLE*, ulong table_id, bitvector const& cols);
#endif
Update_rows_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event);
@@ -1955,8 +1953,7 @@
};
#ifndef MYSQL_CLIENT
- Delete_rows_log_event(THD*, TABLE*, ulong,
- bitvector const& cols, bool using_trans);
+ Delete_rows_log_event(THD*, TABLE*, ulong, bitvector const& cols);
virtual ~Delete_rows_log_event();
#endif
Delete_rows_log_event(const char* buf, uint event_len,
--- 1.173/sql/sql_class.cc 2005-03-23 11:15:21 +01:00
+++ 1.174/sql/sql_class.cc 2005-04-01 13:40:13 +02:00
@@ -1807,6 +1807,13 @@
bzero((char*) &status_var, sizeof(status_var));
}
+/*
+ Implementation of interface to write rows to the binary log through the
+ thread. The thread is responsible for
+ */
+
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+
int THD::
set_pending_event(Rows_log_event* ev)
{
@@ -1841,8 +1848,6 @@
the columns suppled to the function.
*/
-#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
template <class RowsEventT>
Rows_log_event* THD::
prepare_pending(TABLE* table, uint32 server_id,
@@ -1880,11 +1885,14 @@
|| pending->get_cols() != cols)
{
// If not, flush the event and create a new RowsEventT.
+
+ // If the table does not exist, write a table map for the new table
+ if (!mysql_bin_log.is_table_mapped(table))
+ write_table_map(table);
ulong const tid = mysql_bin_log.get_table_id(table);
Rows_log_event* const
- ev = new RowsEventT(this, table, tid, cols,
- table->file->has_transactions());
+ ev = new RowsEventT(this, table, tid, cols);
ev->server_id = server_id; // I don't like this, it's too easy to forget.
if (flush_and_set_pending_event(ev))
DBUG_RETURN(NULL);
@@ -1931,6 +1939,226 @@
DBUG_PRINT("exit", ("0"));
DBUG_RETURN(0); // All OK
+}
+
+size_t THD::
+max_row_length(TABLE *table, const byte *record) const
+{
+ DBUG_ENTER("THD::max_row_length");
+ DBUG_PRINT("enter", ("record = 0x%0x", record));
+
+ size_t length = table->s->reclength + 2 * table->s->fields;
+ uint* const beg = table->s->blob_field;
+ uint* const end = beg + table->s->blob_fields;
+
+ for (uint *ptr = beg ; ptr != end ; ++ptr)
+ {
+ Field_blob* const blob = (Field_blob*) table->field[*ptr];
+ length += blob->get_length(record + blob->offset()) + 2;
+ }
+
+ DBUG_RETURN(length);
+}
+
+size_t THD::
+pack_row(TABLE *table,
+ byte *row_data,
+ size_t max_size,
+ const byte *record) const
+{
+ DBUG_ENTER("THD::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, table->s->null_bytes);
+ ptr += table->s->null_bytes;
+
+ for ( Field **field = 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);
+}
+
+int THD::
+write_row(TABLE* table, bitvector const& cols, byte const *record)
+{
+ DBUG_ENTER("THD::write_row");
+ DBUG_PRINT("enter", ("cols = { size: %d, data = %p }; "
+ "table=%p (%s), record=%p",
+ cols.size(), cols.data(),
+ table, table->s->table_name, 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(table, record);
+ byte* const row_data = my_malloc(max_len, MYF(MY_WME));
+ size_t const len = pack_row(table, row_data, max_len, record);
+
+ Rows_log_event* const
+ ev = thd->prepare_pending<Write_rows_log_event>(table, server_id, cols,
len);
+
+ if (ev == NULL)
+ DBUG_RETURN(1);
+
+ // add_row_data copies row_data to internal buffer
+ ev->add_row_data(row_data,len);
+
+ my_free(row_data, MYF(MY_WME));
+
+ DBUG_RETURN(0);
+}
+
+int THD::
+update_row(TABLE* table, bitvector const& cols,
+ const byte *before_record, const byte *after_record)
+{
+ DBUG_ENTER("THD::update_row");
+ DBUG_PRINT("enter", ("cols = { size: %d, data = %p }; "
+ "table=%p (%s); "
+ "before=%p; after=%p",
+ cols.size(), cols.data(),
+ table, table->s->table_name,
+ 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(table, before_record);
+ size_t const after_maxlen = max_row_length(table, 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(table, before_row,
+ before_maxlen, before_record);
+ size_t const after_size = pack_row(table, after_row,
+ after_maxlen, after_record);
+
+ Rows_log_event* const
+ ev = thd->prepare_pending<Update_rows_log_event>(table,
+ server_id, cols,
+ 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 THD::
+delete_row(TABLE* table, bitvector const& cols, byte const *record)
+{
+ DBUG_ENTER("THD::delete_row");
+ DBUG_PRINT("enter", ("cols = { size: %d, data = %p }; "
+ "table=%p (%s), record=%p",
+ cols.size(), cols.data(),
+ table, table->s->table_name, record));
+
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ /*
+ 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(table, record);
+ byte* const row_data = my_malloc(max_len, MYF(MY_WME));
+ size_t const len = pack_row(table, row_data, max_len, record);
+
+ Rows_log_event* const
+ ev = prepare_pending<Delete_rows_log_event>(table, server_id, cols, 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 THD::
+write_table_map(TABLE* table)
+{
+ DBUG_ENTER("THD::write_table_map()");
+ DBUG_PRINT("enter", ("table=%p (%s)", table, table->s->table_name));
+
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ ulong table_id = mysql_bin_log.get_table_id(table);
+
+ Table_map_log_event
+ the_event(this, table, table_id);
+
+ if (mysql_bin_log.write(&the_event))
+ DBUG_RETURN(1);
+ DBUG_RETURN(0);
+}
+
+int THD::
+flush_pending_event(bool stmt_end)
+{
+ DBUG_ENTER("THD::flush_pending_event(bool)");
+ if (!opt_binlog_row_level || !mysql_bin_log.is_open())
+ DBUG_RETURN(0);
+
+ /*
+ 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 = get_pending_event()) {
+ pending->set_flags(Rows_log_event::STMT_END_F);
+
+ // !!! This is extra right now: there have to be a more advanced logic
+ // !!! to decide when the transaction actually ends.
+ pending->set_flags(Rows_log_event::TRANS_END_F);
+
+ DBUG_ASSERT(mysql_bin_log.is_open());
+ mysql_bin_log.clear_table_mappings();
+ }
+ }
+
+ DBUG_PRINT("flush", ("thd = 0x%0x", this));
+ int const error = flush_and_set_pending_event(0);
+ DBUG_RETURN(error);
}
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
--- 1.228/sql/sql_class.h 2005-03-23 11:15:21 +01:00
+++ 1.229/sql/sql_class.h 2005-04-01 13:40:14 +02:00
@@ -31,6 +31,7 @@
class Format_description_log_event;
class sp_rcontext;
class sp_cache;
+class Rows_log_event;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
@@ -239,7 +240,9 @@
pthread_cond_t COND_prep_xids;
friend class Log_event;
- table_mapping* m_table_map;
+ // 'Mutable' needed since this class can not be initialized in the
+ // constructor.
+ mutable table_mapping* m_table_map;
ulong m_next_table_id;
public:
@@ -260,6 +263,13 @@
// This will return a table id for the table. If the table is not known, a
// new table id will be invented and returned.
ulong get_table_id(TABLE* table);
+
+ // This will check if the given table is mapped to any table id
+ int is_table_mapped(TABLE* table) const;
+
+ // This will clear all table mappings
+ void clear_table_mappings();
+
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
/*
These describe the log's format. This is used only for relay logs.
@@ -1091,6 +1101,28 @@
/* container for handler's private per-connection data */
void *ha_data[MAX_HA];
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+
+ /*
+ Public interface to write rows to the binlog
+ */
+ int write_row(TABLE* table, bitvector const& cols, const byte *buf);
+ int delete_row(TABLE* table, bitvector const& cols, const byte *buf);
+ int update_row(TABLE* table, bitvector const& cols,
+ const byte *old_data, const byte *new_data);
+
+ void set_server_id(uint32 sid) { server_id = sid; }
+
+ int transaction_begin() {
+ return 0;
+ }
+
+ int transaction_end() {
+
+ return flush_pending_event(true);
+ }
+
+private:
/*
Member functions to handle pending event for row-level logging.
*/
@@ -1103,6 +1135,16 @@
prepare_pending(TABLE* table, uint32 server_id,
bitvector const& cols, size_t needed);
+ size_t max_row_length(TABLE* table, const byte *data) const;
+ size_t pack_row(TABLE* table, byte *row_data,
+ size_t max_len, const byte *data) const;
+
+ int flush_pending_event(bool stmt_end);
+ int write_table_map(TABLE*);
+
+#endif
+
+public:
struct st_transactions {
SAVEPOINT *savepoints;
THD_TRANS all; // Trans since BEGIN WORK
--- 1.3/mysql-test/r/rpl_row_basic.result 2005-03-21 23:26:18 +01:00
+++ 1.4/mysql-test/r/rpl_row_basic.result 2005-04-01 13:32:22 +02:00
@@ -7,8 +7,8 @@
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))
+<binlog> <pos> Format_desc 1 <end_log_pos> Server ver:
5.1.0-alpha-debug-log, Binlog ver: 4
+<binlog> <pos> Query 1 <end_log_pos> use `test`; CREATE TABLE t1 (C1
CHAR(1), C2 CHAR(1), INDEX (C1))
SELECT * FROM t1;
C1 C2
SELECT * FROM t1;
@@ -17,10 +17,10 @@
INSERT INTO t1 VALUES ('A','C'), ('X', 'Z'), ('A', 'A');
SHOW BINLOG EVENTS FROM 218;
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>
+<binlog> <pos> Table_map 1 <end_log_pos>
+<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Table_map 1 <end_log_pos>
+<binlog> <pos> Write_rows 1 <end_log_pos>
SELECT * FROM t1;
C1 C2
A B
@@ -40,8 +40,8 @@
DELETE FROM t1 WHERE C1 = C2;
SHOW BINLOG EVENTS FROM 374;
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>
+<binlog> <pos> Table_map 1 <end_log_pos>
+<binlog> <pos> Delete_rows 1 <end_log_pos>
SELECT * FROM t1;
C1 C2
A B
@@ -57,8 +57,8 @@
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
SHOW BINLOG EVENTS FROM 447;
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>
+<binlog> <pos> Table_map 1 <end_log_pos>
+<binlog> <pos> Update_rows 1 <end_log_pos>
SELECT * FROM t1;
C1 C2
A B
--- 1.3/mysql-test/t/rpl_row_basic.test 2005-03-21 23:26:18 +01:00
+++ 1.4/mysql-test/t/rpl_row_basic.test 2005-04-01 13:40:13 +02:00
@@ -5,7 +5,7 @@
#
CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1));
---replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
+--replace_column 1 <binlog> 2 <pos> 5 <end_log_pos>
SHOW BINLOG EVENTS;
SELECT * FROM t1;
sync_slave_with_master;
@@ -15,18 +15,18 @@
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>
+--replace_column 1 <binlog> 2 <pos> 5 <end_log_pos>
SHOW BINLOG EVENTS FROM 218;
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>
+--replace_column 1 <binlog> 2 <pos> 5 <end_log_pos>
SHOW BINLOG EVENTS FROM 374;
SELECT * FROM t1;
sync_slave_with_master;
@@ -39,7 +39,7 @@
#
connection master;
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
---replace_column 1 <binlog> 2 <pos> 4 <server_id> 5 <end_log_pos>
+--replace_column 1 <binlog> 2 <pos> 5 <end_log_pos>
SHOW BINLOG EVENTS FROM 447;
SELECT * FROM t1;
sync_slave_with_master;
--- 1.6/sql/rpl_injector.cc 2005-03-24 09:47:51 +01:00
+++ 1.7/sql/rpl_injector.cc 2005-04-01 13:32:30 +02:00
@@ -1,7 +1,5 @@
// -*- Mode: C++; c-indentation-style: gnu -*-
-// This include cannot be here since there is no include guard on
-// 'mysql_priv.h'.
#include "mysql_priv.h"
#include "rpl_injector.h"
@@ -66,8 +64,8 @@
{
DBUG_ENTER("injector::transaction::write_row(...)");
TABLE* table = get_table(m_thd, tbl);
- table->file->row_writer()->set_server_id(sid);
- table->file->row_writer()->write_row(cols, record);
+ m_thd->set_server_id(sid);
+ m_thd->write_row(table, cols, record);
DBUG_RETURN(0);
}
@@ -78,8 +76,8 @@
{
DBUG_ENTER("injector::transaction::delete_row(...)");
TABLE* table = get_table(m_thd, tbl);
- table->file->row_writer()->set_server_id(sid);
- table->file->row_writer()->delete_row(cols, record);
+ m_thd->set_server_id(sid);
+ m_thd->delete_row(table, cols, record);
DBUG_RETURN(0);
}
@@ -90,8 +88,8 @@
{
DBUG_ENTER("injector::transaction::update_row(...)");
TABLE* table = get_table(m_thd, tbl);
- table->file->row_writer()->set_server_id(sid);
- table->file->row_writer()->update_row(cols, before, after);
+ m_thd->set_server_id(sid);
+ m_thd->update_row(table, cols, before, after);
DBUG_RETURN(0);
}
--- 1.30/mysql-test/r/user_var.result 2005-03-21 19:53:25 +01:00
+++ 1.31/mysql-test/r/user_var.result 2005-04-01 13:32:23 +02:00
@@ -176,13 +176,7 @@
set @var1= "';aaa";
SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
-show binlog events from 100;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 100 User var 1 141 @`a b`=_latin1 0x68656C6C6F COLLATE
latin1_swedish_ci
-master-bin.000001 141 Query 1 234 use `test`; INSERT INTO t1 VALUES(@`a b`)
-master-bin.000001 234 User var 1 276 @`var1`=_latin1 0x273B616161 COLLATE
latin1_swedish_ci
-master-bin.000001 276 User var 1 314 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
-master-bin.000001 314 Query 1 415 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.1834) | Mats Kindahl | 1 Apr |