Below is the list of changes that have just been committed into a local
5.1 repository of elkin. When elkin 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@stripped, 2007-04-29 20:15:15+03:00, aelkin@stripped +15 -0
wl3557 conflict detection
the final part covering ndb_apply_status (to not participate in conflict detection) and
associated issues.
nbd specific tests require some bug fixes merge;
generic replication code also needs some bug fixes merge;
mysql-test/extra/rpl_tests/rpl_row_conflicts_basic.test@stripped, 2007-04-29 20:15:11+03:00, aelkin@stripped +299 -0
New BitKeeper file ``mysql-test/extra/rpl_tests/rpl_row_conflicts_basic.test''
mysql-test/extra/rpl_tests/rpl_row_conflicts_basic.test@stripped, 2007-04-29 20:15:11+03:00, aelkin@stripped +0 -0
mysql-test/r/rpl_row_conflicts_2myisam.result@stripped, 2007-04-29 20:15:09+03:00, aelkin@stripped +61 -9
new results
mysql-test/r/rpl_row_conflicts_3innodb.result@stripped, 2007-04-29 20:15:09+03:00, aelkin@stripped +61 -9
new results
mysql-test/r/rpl_row_conflicts_7ndb.result@stripped, 2007-04-29 20:15:09+03:00, aelkin@stripped +32 -24
new results, to be redone because of some bugs fixes are not there yet.
mysql-test/t/rpl_row_conflicts_7ndb.test@stripped, 2007-04-29 20:15:09+03:00, aelkin@stripped +301 -1
specific test for ndb, tests are not complete because of some bug fixes are not here.
sql/ha_ndbcluster_binlog.cc@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +2 -1
passing the table map flag value to ignore ndb_apply_status from conflict detection on slave
sql/log.cc@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +3 -2
table map flag as an arg to binlogging methods
sql/log_event.cc@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +60 -35
table map flag handling;
bulk insert is active only when no conflict detection.
sql/log_event.h@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +16 -20
new table map flag value
sql/rpl_injector.cc@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +6 -3
table map flag
sql/rpl_injector.h@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +3 -1
more arg to use_table
sql/rpl_tblmap.cc@stripped, 2007-04-29 20:15:10+03:00, aelkin@stripped +21 -3
storing and extracting table map flag from table id cache
sql/rpl_tblmap.h@stripped, 2007-04-29 20:15:11+03:00, aelkin@stripped +3 -1
a new arg to set_table
sql/sql_class.h@stripped, 2007-04-29 20:15:11+03:00, aelkin@stripped +4 -1
table map arg
sql/table.h@stripped, 2007-04-29 20:15:11+03:00, aelkin@stripped +1 -0
workaround to keep table map flag in table_list structure for a while.
# 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: aelkin
# Host: dsl-hkibras1-ff18c300-219.dhcp.inet.fi
# Root: /home/elkin/MySQL/TEAM/FIXES/5.1/wl3557_conflict_detection
--- 1.253/sql/log.cc 2007-01-17 20:45:39 +02:00
+++ 1.254/sql/log.cc 2007-04-29 20:15:10 +03:00
@@ -3509,7 +3509,8 @@ int THD::binlog_flush_transaction_cache(
Write a table map to the binary log.
*/
-int THD::binlog_write_table_map(TABLE *table, bool is_trans)
+int THD::binlog_write_table_map(TABLE *table, bool is_trans,
+ Table_map_log_event::flag_set map_flags)
{
int error;
DBUG_ENTER("THD::binlog_write_table_map");
@@ -3522,7 +3523,7 @@ int THD::binlog_write_table_map(TABLE *t
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
Table_map_log_event::flag_set const
- flags= Table_map_log_event::TM_NO_FLAGS;
+ flags= map_flags? map_flags : Table_map_log_event::TM_NO_FLAGS;
Table_map_log_event
the_event(this, table, table->s->table_map_id, is_trans, flags);
--- 1.265/sql/log_event.cc 2007-04-24 11:32:57 +03:00
+++ 1.266/sql/log_event.cc 2007-04-29 20:15:10 +03:00
@@ -5781,7 +5781,8 @@ int Rows_log_event::exec_event(st_relay_
TABLE_LIST *ptr;
for (ptr= rli->tables_to_lock ; ptr ; ptr= ptr->next_global)
{
- rli->m_table_map.set_table(ptr->table_id, ptr->table);
+ rli->m_table_map.set_table(ptr->table_id, ptr->table,
+ ptr->table_map_flags);
}
#ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(rli->tables_to_lock);
@@ -5800,7 +5801,7 @@ int Rows_log_event::exec_event(st_relay_
(this was set up by Table_map_log_event::exec_event() which
tested replicate-* rules).
*/
-
+ bool conflict_check;
/*
It's not needed to set_time() but
1) it continues the property that "Time" in SHOW PROCESSLIST shows how
@@ -5826,8 +5827,11 @@ int Rows_log_event::exec_event(st_relay_
thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS;
/* A small test to verify that objects have consistent types */
DBUG_ASSERT(sizeof(thd->options) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
-
- error= do_before_row_operations(table);
+
+ conflict_check= opt_slave_conflict_detection &&
+ !(rli->m_table_map.get_table_map_flags(m_table_id) &
+ Table_map_log_event::NO_CONFLICT_DETECTION_CHECKS_F);
+ error= do_before_row_operations(table, conflict_check);
while (error == 0 && row_start < (const char*) m_rows_end)
{
char const *row_end= NULL;
@@ -5842,9 +5846,9 @@ int Rows_log_event::exec_event(st_relay_
THD* old_thd= table->in_use;
if (!table->in_use)
table->in_use= thd;
- error= do_exec_row(table); // returns 0 | HA_ error
+ error= do_exec_row(table, conflict_check);
table->in_use = old_thd;
-
+
switch (error)
{
@@ -5910,7 +5914,7 @@ int Rows_log_event::exec_event(st_relay_
DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
rli->abort_slave=1;);
- error= do_after_row_operations(table, error);
+ error= do_after_row_operations(table, error, conflict_check);
if (!cache_stmt)
{
DBUG_PRINT("info", ("Marked that we need to keep log"));
@@ -6137,6 +6141,9 @@ Table_map_log_event::Table_map_log_event
m_table_id(tid),
m_flags(flags)
{
+ DBUG_ENTER("Table_map_log_event::Table_map_log_event(THD*, TABLE*,...)");
+ DBUG_PRINT("info",("tid: %lu, table: %s, is_ta: %d, map_flags: %u",
+ tid, tbl->s->table_name.str, is_transactional, flags));
DBUG_ASSERT(m_table_id != ~0UL);
/*
In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
@@ -6162,6 +6169,7 @@ Table_map_log_event::Table_map_log_event
for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
m_coltype[i]= m_table->field[i]->type();
}
+ DBUG_VOID_RETURN;
}
#endif /* !defined(MYSQL_CLIENT) */
@@ -6231,11 +6239,12 @@ Table_map_log_event::Table_map_log_event
uchar *ptr_after_colcnt= (uchar*) ptr_colcnt;
m_colcnt= net_field_length(&ptr_after_colcnt);
- DBUG_PRINT("info",("m_dblen: %lu off: %ld m_tbllen: %lu off: %ld m_colcnt: %lu off: %ld",
+ DBUG_PRINT("info",("m_dblen: %lu off: %ld m_tbllen: %lu off: %ld m_colcnt: %lu off: %ld m_flags: %u",
m_dblen, (long) (ptr_dblen-(const byte*)vpart),
m_tbllen, (long) (ptr_tbllen-(const byte*)vpart),
- m_colcnt, (long) (ptr_colcnt-(const byte*)vpart)));
-
+ m_colcnt, (long) (ptr_colcnt-(const byte*)vpart),
+ m_flags));
+
/* Allocate mem for all fields in one go. If fails, catched in is_valid() */
m_memory= my_multi_malloc(MYF(MY_WME),
&m_dbnam, m_dblen + 1,
@@ -6381,6 +6390,11 @@ int Table_map_log_event::exec_event(st_r
rli->tables_to_lock= table_list;
rli->tables_to_lock_count++;
/* 'memory' is freed in clear_tables_to_lock */
+
+ /* we could set_table here, that would not need `table_map_flags'
+ member to pass flag_set to Rows_log's exec method */
+ rli->tables_to_lock->table_map_flags= m_flags;
+ DBUG_PRINT("info",("m_table_id: %lu m_flags: %u", m_table_id, m_flags));
}
/*
@@ -6510,11 +6524,11 @@ Write_rows_log_event::Write_rows_log_eve
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int Write_rows_log_event::do_before_row_operations(TABLE *table)
+int Write_rows_log_event::do_before_row_operations(TABLE *table, bool conflict_check)
{
int error= 0;
- if (!opt_slave_conflict_detection)
+ if (!conflict_check)
{
/*
We are using REPLACE semantics and not INSERT IGNORE semantics
@@ -6535,6 +6549,16 @@ int Write_rows_log_event::do_before_row_
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); // Needed for ndbcluster
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE); // Needed for ndbcluster
table->file->extra(HA_EXTRA_IGNORE_NO_KEY); // Needed for ndbcluster
+
+ /* bulk moved into conflict-check-off branch due to
+ do_extra, calling the bulk hanlder, can return an eroror */
+
+ /*
+ TODO: the cluster team (Tomas?) says that it's better if the engine knows
+ how many rows are going to be inserted, then it can allocate needed memory
+ from the start.
+ */
+ table->file->ha_start_bulk_insert(0);
}
else
{
@@ -6544,12 +6568,6 @@ int Write_rows_log_event::do_before_row_
table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);*/
}
/*
- TODO: the cluster team (Tomas?) says that it's better if the engine knows
- how many rows are going to be inserted, then it can allocate needed memory
- from the start.
- */
- table->file->ha_start_bulk_insert(0);
- /*
We need TIMESTAMP_NO_AUTO_SET otherwise ha_write_row() will not use fill
any TIMESTAMP column with data from the row but instead will use
the event's current time.
@@ -6568,17 +6586,18 @@ int Write_rows_log_event::do_before_row_
return error;
}
-int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
+int Write_rows_log_event::do_after_row_operations(TABLE *table, int error,
+ bool conflict_check)
{
if (error == 0)
{
- if (!opt_slave_conflict_detection)
+ if (!conflict_check)
{
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
- table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
+ // bug#27077 table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
+ error= table->file->ha_end_bulk_insert();
}
- error= table->file->ha_end_bulk_insert();
}
return error;
}
@@ -6769,6 +6788,7 @@ replace_record(THD *thd, TABLE *table,
if (conflict_check &&
(error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOUND_DUPP_UNIQUE))
error= HA_ERR_REPLICATION_CONFLICT;
+ DBUG_PRINT("info", ("error: %d", error));
DBUG_RETURN(error);
}
if ((keynum= table->file->get_dup_key(error)) < 0) //ER(ER_DUP_ENTRY)
@@ -6860,12 +6880,12 @@ replace_record(THD *thd, TABLE *table,
DBUG_RETURN(error);
}
-int Write_rows_log_event::do_exec_row(TABLE *table)
+int Write_rows_log_event::do_exec_row(TABLE *table, bool conflict_check)
{
DBUG_ASSERT(table != NULL);
int error= replace_record(thd, table, m_master_reclength, m_width,
- /* mismatch of cols with master does not matter */
- opt_slave_conflict_detection);
+ /* mismatch of cols with master does not matter */
+ conflict_check);
return error;
}
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
@@ -6939,8 +6959,8 @@ static int find_and_fetch_row(TABLE *tab
{
int error;
DBUG_ENTER("find_and_fetch_row(TABLE *table, byte *key, byte *record)");
- DBUG_PRINT("enter", ("table: 0x%lx, key: 0x%lx record: 0x%lx",
- (long) table, (long) key, (long) table->record[1]));
+ DBUG_PRINT("enter", ("table: 0x%lx, key: 0x%lx record: 0x%lx, cnfl_check: %d",
+ (long) table, (long) key, (long) table->record[1], conflict_check));
DBUG_ASSERT(table->in_use != NULL);
@@ -6964,6 +6984,7 @@ static int find_and_fetch_row(TABLE *tab
store_record(table,record[1]); // BI
table->file->position(table->record[0]); // OR
error= table->file->rnd_pos(table->record[0], table->file->ref);
+ DBUG_PRINT("info", ("rnd_pos error: %d", error));
/*
rnd_pos() returns OR in table->record[0], so we have to
move it to table->record[1].
@@ -7170,7 +7191,8 @@ Delete_rows_log_event::Delete_rows_log_e
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int Delete_rows_log_event::do_before_row_operations(TABLE *table)
+int Delete_rows_log_event::do_before_row_operations(TABLE *table,
+ bool conflict_check)
{
DBUG_ASSERT(m_memory == NULL);
@@ -7206,7 +7228,8 @@ int Delete_rows_log_event::do_before_row
return error;
}
-int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error)
+int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error,
+ bool conflict_check)
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
table->file->ha_index_or_rnd_end();
@@ -7247,14 +7270,14 @@ int Delete_rows_log_event::do_prepare_ro
return error;
}
-int Delete_rows_log_event::do_exec_row(TABLE *table)
+int Delete_rows_log_event::do_exec_row(TABLE *table, bool conflict_check)
{
int error;
DBUG_ASSERT(table != NULL);
if (!(error= find_and_fetch_row(table, m_key,
(table->s->fields == m_width) &&
- opt_slave_conflict_detection)))
+ conflict_check)))
{
/*
Now we should have the right row to delete. We are using
@@ -7315,7 +7338,8 @@ Update_rows_log_event::Update_rows_log_e
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int Update_rows_log_event::do_before_row_operations(TABLE *table)
+int Update_rows_log_event::do_before_row_operations(TABLE *table,
+ bool conflict_check)
{
DBUG_ASSERT(m_memory == NULL);
@@ -7343,7 +7367,8 @@ int Update_rows_log_event::do_before_row
return error;
}
-int Update_rows_log_event::do_after_row_operations(TABLE *table, int error)
+int Update_rows_log_event::do_after_row_operations(TABLE *table, int error,
+ bool conflict_check)
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
table->file->ha_index_or_rnd_end();
@@ -7408,13 +7433,13 @@ int Update_rows_log_event::do_prepare_ro
return error;
}
-int Update_rows_log_event::do_exec_row(TABLE *table)
+int Update_rows_log_event::do_exec_row(TABLE *table, bool conflict_check)
{
DBUG_ASSERT(table != NULL);
int error= find_and_fetch_row(table, m_key,
(table->s->fields == m_width) &&
- opt_slave_conflict_detection);
+ conflict_check);
if (error)
return error;
--- 1.146/sql/log_event.h 2007-02-14 19:45:40 +02:00
+++ 1.147/sql/log_event.h 2007-04-29 20:15:10 +03:00
@@ -1752,15 +1752,10 @@ public:
enum enum_flag
{
- /*
- Nothing here right now, but the flags support is there in
- preparation for changes that are coming. Need to add a
- constant to make it compile under HP-UX: aCC does not like
- empty enumerations.
- */
- ENUM_FLAG_COUNT
+ /* Master can set the flag to avoid conflict detection for the table */
+ NO_CONFLICT_DETECTION_CHECKS_F = (1U << 0)
};
-
+
typedef uint16 flag_set;
/* Special constants representing sets of flags */
@@ -1976,7 +1971,7 @@ private:
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;
+ virtual int do_before_row_operations(TABLE *table, bool conflict_check)= 0;
/*
Primitive to clean up after a sequence of row executions.
@@ -1987,7 +1982,8 @@ private:
this member function should be called to clean up and release
any allocated buffers.
*/
- virtual int do_after_row_operations(TABLE *table, int error) = 0;
+ virtual int do_after_row_operations(TABLE *table, int error,
+ bool conflict_check)= 0;
/*
Primitive to prepare for handling one row in a row-level event.
@@ -2020,7 +2016,7 @@ private:
0 if execution succeeded, 1 if execution failed.
*/
- virtual int do_exec_row(TABLE *table) = 0;
+ virtual int do_exec_row(TABLE *table, bool conflict_check) = 0;
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
@@ -2076,11 +2072,11 @@ private:
gptr m_memory;
byte *m_after_image;
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
+ virtual int do_before_row_operations(TABLE *table, bool conflict_check);
+ virtual int do_after_row_operations(TABLE *table, int error, bool conflict_check);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_exec_row(TABLE *table, bool conflict_detection);
#endif
};
@@ -2141,11 +2137,11 @@ private:
byte *m_key;
byte *m_after_image;
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
+ virtual int do_before_row_operations(TABLE *table, bool conflict_check);
+ virtual int do_after_row_operations(TABLE *table, int error, bool conflict_check);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_exec_row(TABLE *table, bool conflict_check);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
@@ -2212,11 +2208,11 @@ private:
byte *m_key;
byte *m_after_image;
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
+ virtual int do_before_row_operations(TABLE *table, bool conflict_check);
+ virtual int do_after_row_operations(TABLE *table, int error, bool conflict_check);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*,
char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_exec_row(TABLE *table, bool conflict_check);
#endif
};
--- 1.342/sql/sql_class.h 2007-01-17 20:32:08 +02:00
+++ 1.343/sql/sql_class.h 2007-04-29 20:15:11 +03:00
@@ -947,7 +947,10 @@ public:
void binlog_start_trans_and_stmt();
int binlog_flush_transaction_cache();
void binlog_set_stmt_begin();
- int binlog_write_table_map(TABLE *table, bool is_transactional);
+ /* can not include log_event.h before this class declaration and thereafter
+ can not use Table_map_log_event::TM_NO_FLAGS */
+ int binlog_write_table_map(TABLE *table, bool is_transactional,
+ uint16 flags= 0);
int binlog_write_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, my_size_t colcnt,
const byte *buf);
--- 1.157/sql/table.h 2006-12-31 02:06:37 +02:00
+++ 1.158/sql/table.h 2007-04-29 20:15:11 +03:00
@@ -694,6 +694,7 @@ typedef struct st_table_list
List<String> *use_index, *ignore_index;
TABLE *table; /* opened table */
uint table_id; /* table id (from binlog) for opened table */
+ uint16 table_map_flags; /* repl rbr flags set by master - todo: move to RPL_TABLE_LIST */
/*
select_result for derived table to pass it from table creation to table
filling procedure
--- New file ---
+++ mysql-test/extra/rpl_tests/rpl_row_conflicts_basic.test 07/04/29 20:15:11
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
#
# Basic tests of row-level replication conflicts
# detection (WL3557)
#
# 1. table with primary key (index_read) NO DETECTION at the beginning
# 2. table with primary key
# 3. no primary keys case
# 4. Bit-fields (the section is due to there were bugs with rows pack/unpack)
# 5. REPLACE/INSERT
connection master;
--disable_warnings
drop table if exists t1,t2,t3,t4;
--enable_warnings
eval CREATE TABLE t1 (a int, b bit(12)) ENGINE= $type;
eval CREATE TABLE t2 (a int, b int) ENGINE= $type;
eval CREATE TABLE t3 (a int primary key, b int) ENGINE= $type;
eval CREATE TABLE t4 (a int unique, b int) ENGINE= $type;
insert into t1 values (1,b'111111111111'),(2,b'011111111111'),(1,b'000000000000');
insert into t2 values (1,1),(2,2),(1,1);
insert into t3 values (1,1),(2,2),(3,3);
#
# 1. table with primary key (index_read)
# NO DETECTION at the beginning
#
sync_slave_with_master;
#connection slave;
update t3 set b=-1 where a=1 /* 1. NO DETECTION */;
select * from t3 order by a;
connection master;
update t3 set b=-2 where a=1;
select * from t3 order by a;
sync_slave_with_master;
#connection slave;
select * from t3 order by a;
# instersting are 4 cols:
# 10 Slave_IO_Running, 11 Slave_SQL_Running, 18 Last_Errno, 19 Last_Error
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--query_vertical show slave status;
update t3 set b=1 where a=1;
connection master;
update t3 set b=1 where a=1;
sync_slave_with_master;
#connection slave;
select * from t3 order by a /* must be (1,1),(2,2),(3,3) */;
#
# 2. table with primary key
#
# connection slave;
set @@global.slave_conflict_detection=1;
update t3 set b=-1 where a=1 /* 2. table with primary key */;
select * from t3 order by a;
connection master;
update t3 set b=-2 where a=1;
select * from t3 order by a;
connection slave;
wait_for_slave_to_stop;
select * from t3 order by a;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*/failed at #slave-relay-bin/
--query_vertical show slave status;
update t3 set b=1 where a=1; # user fixes Old Row
start slave sql_thread;
connection master;
update t3 set b=1 where a=1;
select * from t3 order by a;
sync_slave_with_master;
#connection slave;
select * from t3 order by a /* must be same content master above */;
# conflict with detete, same as above
# connection slave;
delete from t3 where a=1;
select * from t3 order by a;
connection master;
delete from t3 where a=1;
select * from t3 order by a;
connection slave;
wait_for_slave_to_stop;
select * from t3 order by a;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
insert into t3 values (1,1);
start slave sql_thread;
connection master;
delete from t3 where a=1;
select * from t3 order by a;
sync_slave_with_master;
#connection slave;
select * from t3 order by a /* must be same content master above */;
#
# 3. no primary keys case
#
# U. update
# connection slave;
update t2 set b=-1 where a=1 /* 3. no primary keys case */;
select * from t2 order by a;
connection master;
update t2 set b=-2 where a=1;
select * from t2 order by a;
connection slave;
wait_for_slave_to_stop;
select * from t2 order by a;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
update t2 set b=1 where a=1; # user fixes Old Row
start slave sql_thread;
connection master;
update t2 set b=1 where a=1;
select * from t2 order by a;
sync_slave_with_master;
#connection slave;
select * from t2 order by a /* must be same content master above */;
# D. DELETE
# connection slave;
delete from t2 where a=2;
select * from t2 order by a;
connection master;
delete from t2 where a=2;
select * from t2 order by a;
connection slave;
wait_for_slave_to_stop;
select * from t2 order by a;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
insert into t2 values (2,2);
start slave sql_thread;
connection master;
delete from t2 where a=1;
select * from t2 order by a;
sync_slave_with_master;
#connection slave;
select * from t2 order by a /* must be same content master above */;
#
# 4. Bit-fields (the section is due to there were bugs with rows pack/unpack)
#
# connection slave;
select a,hex(b) from t1 /* 4. Bit-fields */;
update t1 set b=b'000100010001' where a=2; ### bug (in unpack?) with a=1
select a,hex(b) from t1;
connection master;
update t1 set b=b'000100010001' where a=2;
connection slave;
wait_for_slave_to_stop;
select a,hex(b) from t1;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
update t1 set b=b'011111111111' where a=2; # user fixes Old Row
select a,hex(b) from t1;
start slave sql_thread;
connection master;
update t1 set b=b'011111111111' where a=2;
select a,hex(b) from t1;
sync_slave_with_master;
select a,hex(b) from t1 /* must be same as above */;
#
# 5. REPLACE/INSERT
#
connection slave;
select * from t3 order by a /* 5. REPLACE/INSERT */;
connection master;
select * from t3 order by a;
delete from t3 where a=3;
### also leads to stuck --sleep 30
sync_slave_with_master;
#connection slave;
insert into t3 values (3,3);
connection master;
insert into t3 values (3,3);
save_master_pos;
connection slave;
# ndb bugs 22044/27320 in the way of this wait
wait_for_slave_to_stop;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
delete from t3 where a=3;
start slave sql_thread;
sync_with_master;
select * from t3 order by a /* must be (2,2),(3,3) */;
delete from t3 where a=3 /* check the following replace */;
connection master;
replace t3 values (3,0) /* must stop on slave */;
save_master_pos;
connection slave;
# ndb bugs 22044/27320 in the way of this wait
wait_for_slave_to_stop;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
#connection slave;
select * from t3 order by a;
insert into t3 values (3,3);
start slave sql_thread;
sync_with_master;
select * from t3 order by a /* must be (2,2),(3,0) */;
## table with unique attribute, consequences the same as with prim key
connection master;
insert into t4 values (1,1);
sync_slave_with_master;
#connection slave;
insert into t4 values (2,2);
connection master;
insert into t4 values (2,2);
connection slave;
wait_for_slave_to_stop;
--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
--replace_regex /failed at .*slave-relay-bin.*//
--query_vertical show slave status;
delete from t4 where a=2;
start slave sql_thread;
## no conflict to insert into non-unique
connection master;
insert into t2 values (1,1),(2,2);
sync_slave_with_master;
#connection slave;
insert into t2 values (2,2);
connection master;
insert into t2 values (1,1);
sync_slave_with_master;
#connection slave;
select * from t2 order by a;
#
# cleanup
#
connection master;
drop table t1,t2,t3,t4;
sync_slave_with_master;
--- 1.1/mysql-test/r/rpl_row_conflicts_7ndb.result 2007-04-24 11:32:57 +03:00
+++ 1.2/mysql-test/r/rpl_row_conflicts_7ndb.result 2007-04-29 20:15:09 +03:00
@@ -4,20 +4,11 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-set @@session.binlog_format=row;
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (a int, b bit(12)) ENGINE= 'NDB' ;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't1'
CREATE TABLE t2 (a int, b int) ENGINE= 'NDB' ;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't2'
CREATE TABLE t3 (a int primary key, b int) ENGINE= 'NDB' ;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't3'
CREATE TABLE t4 (a int unique, b int) ENGINE= 'NDB' ;
-Warnings:
-Warning 1266 Using storage engine MyISAM for table 't4'
insert into t1 values (1,b'111111111111'),(2,b'011111111111'),(1,b'000000000000');
insert into t2 values (1,1),(2,2),(1,1);
insert into t3 values (1,1),(2,2),(3,3);
@@ -117,7 +108,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1293
+Last_Error Error Update_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -178,7 +169,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1467
+Last_Error Error Delete_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -240,7 +231,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:1545
+Last_Error Error Update_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -301,7 +292,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:1755
+Last_Error Error Delete_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -324,21 +315,21 @@ select * from t2 order by a /* must be s
a b
select a,hex(b) from t1 /* 4. Bit-fields */;
a hex(b)
-1 FFF
2 7FF
1 0
+1 FFF
update t1 set b=b'000100010001' where a=2;
select a,hex(b) from t1;
a hex(b)
-1 FFF
2 111
1 0
+1 FFF
update t1 set b=b'000100010001' where a=2;
select a,hex(b) from t1;
a hex(b)
-1 FFF
2 111
1 0
+1 FFF
show slave status;;
Slave_IO_State #
Master_Host #
@@ -359,7 +350,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t1 failed at #slave-relay-bin.000003:1920
+Last_Error Error Update_rows in row event applying on table test.t1
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -376,23 +367,38 @@ Seconds_Behind_Master #
update t1 set b=b'011111111111' where a=2;
select a,hex(b) from t1;
a hex(b)
-1 FFF
2 7FF
1 0
+1 FFF
start slave sql_thread;
update t1 set b=b'011111111111' where a=2;
select a,hex(b) from t1;
a hex(b)
+1 0
+2 7FF
1 FFF
+select a,hex(b) from t1 /* must be same as above */;
+a hex(b)
2 7FF
1 0
+1 FFF
select * from t3 order by a /* 5. REPLACE/INSERT */;
a b
2 2
3 3
+select * from t3 order by a;
+a b
+2 2
+3 3
delete from t3 where a=3;
+insert into t3 values (3,4);
insert into t3 values (3,3);
-insert into t3 values (3,3);
+select * from t3 order by a /* still should be (2,2),(3,3) though slave has not stopped (the bugs) */;
+a b
+2 2
+3 4
+delete from t3 where a=3 /* check the following replace */;
+replace t3 values (3,0) /* must stop on slave */;
show slave status;;
Slave_IO_State #
Master_Host #
@@ -413,7 +419,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:2164
+Last_Error Error Update_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -427,12 +433,14 @@ Master_SSL_Cert #
Master_SSL_Cipher #
Master_SSL_Key #
Seconds_Behind_Master #
-delete from t3 where a=3;
-start slave sql_thread;
-replace t3 values (3,0);
select * from t3 order by a;
a b
2 2
+insert into t3 values (3,3);
+start slave sql_thread;
+select * from t3 order by a /* must be (2,2),(3,0) */;
+a b
+2 2
3 0
insert into t4 values (1,1);
insert into t4 values (2,2);
@@ -457,7 +465,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t4 failed at #slave-relay-bin.000003:2407
+Last_Error Error Write_rows in row event applying on table test.t4
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
--- 1.1/mysql-test/t/rpl_row_conflicts_7ndb.test 2007-04-24 11:32:58 +03:00
+++ 1.2/mysql-test/t/rpl_row_conflicts_7ndb.test 2007-04-29 20:15:09 +03:00
@@ -2,5 +2,305 @@
let $type= 'NDB' ;
let $extra_index= ;
--- source extra/rpl_tests/rpl_row_conflicts_basic.test
+
+# Have to change the 5th section of rpl_row_conflicts_basic.test and imbed the source
+# because of bug#27044/27320 in the way
+# TODO: restore the source upon fixing the bugs
+### -- source extra/rpl_tests/rpl_row_conflicts_basic.test
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+#
+# Basic tests of row-level replication conflicts
+# detection (WL3557)
+#
+
+# 1. table with primary key (index_read) NO DETECTION at the beginning
+# 2. table with primary key
+# 3. no primary keys case
+# 4. Bit-fields (the section is due to there were bugs with rows pack/unpack)
+# 5. REPLACE/INSERT
+
+connection master;
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+--enable_warnings
+eval CREATE TABLE t1 (a int, b bit(12)) ENGINE= $type;
+eval CREATE TABLE t2 (a int, b int) ENGINE= $type;
+eval CREATE TABLE t3 (a int primary key, b int) ENGINE= $type;
+eval CREATE TABLE t4 (a int unique, b int) ENGINE= $type;
+
+insert into t1 values (1,b'111111111111'),(2,b'011111111111'),(1,b'000000000000');
+
+insert into t2 values (1,1),(2,2),(1,1);
+insert into t3 values (1,1),(2,2),(3,3);
+
+
+#
+# 1. table with primary key (index_read)
+# NO DETECTION at the beginning
+#
+
+sync_slave_with_master;
+#connection slave;
+update t3 set b=-1 where a=1 /* 1. NO DETECTION */;
+select * from t3 order by a;
+
+connection master;
+update t3 set b=-2 where a=1;
+select * from t3 order by a;
+
+sync_slave_with_master;
+#connection slave;
+select * from t3 order by a;
+# instersting are 4 cols:
+# 10 Slave_IO_Running, 11 Slave_SQL_Running, 18 Last_Errno, 19 Last_Error
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--query_vertical show slave status;
+update t3 set b=1 where a=1;
+
+connection master;
+update t3 set b=1 where a=1;
+
+sync_slave_with_master;
+#connection slave;
+select * from t3 order by a /* must be (1,1),(2,2),(3,3) */;
+
+
+#
+# 2. table with primary key
+#
+# connection slave;
+
+set @@global.slave_conflict_detection=1;
+
+update t3 set b=-1 where a=1 /* 2. table with primary key */;
+select * from t3 order by a;
+
+connection master;
+update t3 set b=-2 where a=1;
+select * from t3 order by a;
+
+connection slave;
+wait_for_slave_to_stop;
+select * from t3 order by a;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+update t3 set b=1 where a=1; # user fixes Old Row
+start slave sql_thread;
+
+connection master;
+update t3 set b=1 where a=1;
+select * from t3 order by a;
+
+sync_slave_with_master;
+#connection slave;
+select * from t3 order by a /* must be same content master above */;
+
+# conflict with detete, same as above
+# connection slave;
+delete from t3 where a=1;
+select * from t3 order by a;
+
+connection master;
+delete from t3 where a=1;
+select * from t3 order by a;
+
+connection slave;
+wait_for_slave_to_stop;
+
+select * from t3 order by a;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+insert into t3 values (1,1);
+
+start slave sql_thread;
+
+connection master;
+delete from t3 where a=1;
+select * from t3 order by a;
+
+sync_slave_with_master;
+#connection slave;
+select * from t3 order by a /* must be same content master above */;
+
+#
+# 3. no primary keys case
+#
+
+# U. update
+# connection slave;
+update t2 set b=-1 where a=1 /* 3. no primary keys case */;
+select * from t2 order by a;
+
+connection master;
+update t2 set b=-2 where a=1;
+select * from t2 order by a;
+
+connection slave;
+wait_for_slave_to_stop;
+select * from t2 order by a;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+update t2 set b=1 where a=1; # user fixes Old Row
+start slave sql_thread;
+
+connection master;
+update t2 set b=1 where a=1;
+select * from t2 order by a;
+
+sync_slave_with_master;
+#connection slave;
+select * from t2 order by a /* must be same content master above */;
+
+# D. DELETE
+# connection slave;
+delete from t2 where a=2;
+select * from t2 order by a;
+
+connection master;
+delete from t2 where a=2;
+select * from t2 order by a;
+
+connection slave;
+wait_for_slave_to_stop;
+
+select * from t2 order by a;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+insert into t2 values (2,2);
+
+start slave sql_thread;
+
+connection master;
+delete from t2 where a=1;
+select * from t2 order by a;
+
+sync_slave_with_master;
+#connection slave;
+select * from t2 order by a /* must be same content master above */;
+
+#
+# 4. Bit-fields (the section is due to there were bugs with rows pack/unpack)
+#
+
+# connection slave;
+select a,hex(b) from t1 /* 4. Bit-fields */;
+update t1 set b=b'000100010001' where a=2; ### ndb bug with a=1
+select a,hex(b) from t1;
+
+connection master;
+update t1 set b=b'000100010001' where a=2;
+
+connection slave;
+wait_for_slave_to_stop;
+select a,hex(b) from t1;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+update t1 set b=b'011111111111' where a=2; # user fixes Old Row
+select a,hex(b) from t1;
+start slave sql_thread;
+
+connection master;
+update t1 set b=b'011111111111' where a=2;
+select a,hex(b) from t1;
+
+sync_slave_with_master;
+select a,hex(b) from t1 /* must be same as above */;
+
+#
+# 5. REPLACE/INSERT
+#
+
+
+connection slave;
+select * from t3 order by a /* 5. REPLACE/INSERT */;
+
+connection master;
+select * from t3 order by a;
+delete from t3 where a=3;
+### also leads to stuck --sleep 30
+
+sync_slave_with_master;
+#connection slave;
+insert into t3 values (3,4);
+
+connection master;
+insert into t3 values (3,3);
+save_master_pos;
+
+connection slave;
+# ndb bugs 22044/27320 in the way of this wait
+# wait_for_slave_to_stop;
+
+# instead slave installs master's version (3,3)
+select * from t3 order by a /* still should be (2,2),(3,3) though slave has not stopped (the bugs) */;
+
+delete from t3 where a=3 /* check the following replace */;
+
+connection master;
+replace t3 values (3,0) /* must stop on slave */;
+save_master_pos;
+
+connection slave;
+wait_for_slave_to_stop;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+#connection slave;
+select * from t3 order by a;
+insert into t3 values (3,3);
+start slave sql_thread;
+sync_with_master;
+select * from t3 order by a /* must be (2,2),(3,0) */;
+
+## table with unique attribute, consequences the same as with prim key
+
+connection master;
+insert into t4 values (1,1);
+
+sync_slave_with_master;
+#connection slave;
+insert into t4 values (2,2);
+connection master;
+insert into t4 values (2,2);
+
+connection slave;
+wait_for_slave_to_stop;
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 #
+--replace_regex /failed at .*slave-relay-bin.*//
+--query_vertical show slave status;
+delete from t4 where a=2;
+start slave sql_thread;
+
+## no conflict to insert into non-unique
+
+connection master;
+insert into t2 values (1,1),(2,2);
+
+sync_slave_with_master;
+#connection slave;
+insert into t2 values (2,2);
+
+connection master;
+insert into t2 values (1,1);
+
+sync_slave_with_master;
+#connection slave;
+select * from t2 order by a;
+
+#
+# cleanup
+#
+connection master;
+drop table t1,t2,t3,t4;
+sync_slave_with_master;
+
+
-- source include/master-slave-end.inc
--- 1.1/mysql-test/r/rpl_row_conflicts_2myisam.result 2007-03-11 19:40:13 +02:00
+++ 1.2/mysql-test/r/rpl_row_conflicts_2myisam.result 2007-04-29 20:15:09 +03:00
@@ -4,7 +4,6 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-set @@session.binlog_format=row;
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (a int, b bit(12)) ENGINE= 'MyISAM' ;
CREATE TABLE t2 (a int, b int) ENGINE= 'MyISAM' ;
@@ -109,7 +108,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1305
+Last_Error Error Update_rows in row event applying on table test.t3 failed at #slave-relay-bin
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -170,7 +169,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1479
+Last_Error Error Delete_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -232,7 +231,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:1557
+Last_Error Error Update_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -293,7 +292,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:1767
+Last_Error Error Delete_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -351,7 +350,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t1 failed at #slave-relay-bin.000003:1932
+Last_Error Error Update_rows in row event applying on table test.t1
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -378,10 +377,19 @@ a hex(b)
1 FFF
2 7FF
1 0
+select a,hex(b) from t1 /* must be same as above */;
+a hex(b)
+1 FFF
+2 7FF
+1 0
select * from t3 order by a /* 5. REPLACE/INSERT */;
a b
2 2
3 3
+select * from t3 order by a;
+a b
+2 2
+3 3
delete from t3 where a=3;
insert into t3 values (3,3);
insert into t3 values (3,3);
@@ -405,7 +413,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:2176
+Last_Error Error Write_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -421,10 +429,54 @@ Master_SSL_Key #
Seconds_Behind_Master #
delete from t3 where a=3;
start slave sql_thread;
-replace t3 values (3,0);
+select * from t3 order by a /* must be (2,2),(3,3) */;
+a b
+2 2
+3 3
+delete from t3 where a=3 /* check the following replace */;
+replace t3 values (3,0) /* must stop on 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 Yes
+Slave_SQL_Running No
+Replicate_Do_DB #
+Replicate_Ignore_DB #
+Replicate_Do_Table #
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table #
+Replicate_Wild_Ignore_Table #
+Last_Errno 1583
+Last_Error Error Update_rows in row event applying on table test.t3
+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 #
select * from t3 order by a;
a b
2 2
+insert into t3 values (3,3);
+start slave sql_thread;
+select * from t3 order by a /* must be (2,2),(3,0) */;
+a b
+2 2
3 0
insert into t4 values (1,1);
insert into t4 values (2,2);
@@ -449,7 +501,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t4 failed at #slave-relay-bin.000003:2419
+Last_Error Error Write_rows in row event applying on table test.t4
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
--- 1.1/mysql-test/r/rpl_row_conflicts_3innodb.result 2007-03-11 19:40:13 +02:00
+++ 1.2/mysql-test/r/rpl_row_conflicts_3innodb.result 2007-04-29 20:15:09 +03:00
@@ -4,7 +4,6 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-set @@session.binlog_format=row;
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (a int, b bit(12)) ENGINE= 'INNODB' ;
CREATE TABLE t2 (a int, b int) ENGINE= 'INNODB' ;
@@ -109,7 +108,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1440
+Last_Error Error Update_rows in row event applying on table test.t3 failed at #slave-relay-bin
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -170,7 +169,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:1668
+Last_Error Error Delete_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -232,7 +231,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:1773
+Last_Error Error Update_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -293,7 +292,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Delete_rows in row event applying on table test.t2 failed at #slave-relay-bin.000003:2037
+Last_Error Error Delete_rows in row event applying on table test.t2
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -351,7 +350,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Update_rows in row event applying on table test.t1 failed at #slave-relay-bin.000003:2256
+Last_Error Error Update_rows in row event applying on table test.t1
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -378,10 +377,19 @@ a hex(b)
1 FFF
2 7FF
1 0
+select a,hex(b) from t1 /* must be same as above */;
+a hex(b)
+1 FFF
+2 7FF
+1 0
select * from t3 order by a /* 5. REPLACE/INSERT */;
a b
2 2
3 3
+select * from t3 order by a;
+a b
+2 2
+3 3
delete from t3 where a=3;
insert into t3 values (3,3);
insert into t3 values (3,3);
@@ -405,7 +413,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t3 failed at #slave-relay-bin.000003:2581
+Last_Error Error Write_rows in row event applying on table test.t3
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
@@ -421,10 +429,54 @@ Master_SSL_Key #
Seconds_Behind_Master #
delete from t3 where a=3;
start slave sql_thread;
-replace t3 values (3,0);
+select * from t3 order by a /* must be (2,2),(3,3) */;
+a b
+2 2
+3 3
+delete from t3 where a=3 /* check the following replace */;
+replace t3 values (3,0) /* must stop on 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 Yes
+Slave_SQL_Running No
+Replicate_Do_DB #
+Replicate_Ignore_DB #
+Replicate_Do_Table #
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table #
+Replicate_Wild_Ignore_Table #
+Last_Errno 1583
+Last_Error Error Update_rows in row event applying on table test.t3
+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 #
select * from t3 order by a;
a b
2 2
+insert into t3 values (3,3);
+start slave sql_thread;
+select * from t3 order by a /* must be (2,2),(3,0) */;
+a b
+2 2
3 0
insert into t4 values (1,1);
insert into t4 values (2,2);
@@ -449,7 +501,7 @@ Replicate_Ignore_Table #
Replicate_Wild_Do_Table #
Replicate_Wild_Ignore_Table #
Last_Errno 1583
-Last_Error Error Write_rows in row event applying on table test.t4 failed at #slave-relay-bin.000003:2905
+Last_Error Error Write_rows in row event applying on table test.t4
Skip_Counter #
Exec_Master_Log_Pos #
Relay_Log_Space #
--- 1.3/sql/rpl_tblmap.cc 2006-12-23 21:33:29 +02:00
+++ 1.4/sql/rpl_tblmap.cc 2007-04-29 20:15:10 +03:00
@@ -63,6 +63,23 @@ st_table* table_mapping::get_table(ulong
DBUG_RETURN(NULL);
}
+uint16 table_mapping::get_table_map_flags(ulong table_id)
+{
+ DBUG_ENTER("table_mapping::get_table_map_flags(ulong)");
+ DBUG_PRINT("enter", ("table_id: %lu", table_id));
+ entry *e= find_entry(table_id);
+ if (e)
+ {
+ DBUG_PRINT("info", ("tid %lu, table 0x%lx (%s) -> map_flags %u",
+ table_id, (long) e->table,
+ MAYBE_TABLE_NAME(e->table), e->flags));
+ DBUG_RETURN(e->flags);
+ }
+
+ DBUG_PRINT("info", ("tid %lu is not mapped!", table_id));
+ DBUG_RETURN((uint16) -1);
+}
+
/*
Called when we are out of table id entries. Creates TABLE_ID_CHUNK
new entries, chain them and attach them at the head of the list of free
@@ -89,12 +106,12 @@ int table_mapping::expand()
return 0;
}
-int table_mapping::set_table(ulong table_id, TABLE* table)
+int table_mapping::set_table(ulong table_id, TABLE* table, uint16 flags)
{
DBUG_ENTER("table_mapping::set_table(ulong,TABLE*)");
- DBUG_PRINT("enter", ("table_id: %lu table: 0x%lx (%s)",
+ DBUG_PRINT("enter", ("table_id: %lu table: 0x%lx (%s) map_flags: %u",
table_id,
- (long) table, MAYBE_TABLE_NAME(table)));
+ (long) table, MAYBE_TABLE_NAME(table), flags));
entry *e= find_entry(table_id);
if (e == 0)
{
@@ -108,6 +125,7 @@ int table_mapping::set_table(ulong table
e->table_id= table_id;
e->table= table;
+ e->flags= flags;
my_hash_insert(&m_table_ids,(byte *)e);
DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)",
--- 1.3/sql/rpl_tblmap.h 2006-12-23 21:33:29 +02:00
+++ 1.4/sql/rpl_tblmap.h 2007-04-29 20:15:11 +03:00
@@ -63,8 +63,9 @@ public:
~table_mapping();
TABLE* get_table(ulong table_id);
+ uint16 get_table_map_flags(ulong table_id);
- int set_table(ulong table_id, TABLE* table);
+ int set_table(ulong table_id, TABLE* table, uint16 flags= 0);
int remove_table(ulong table_id);
void clear_tables();
ulong count() const { return m_table_ids.records; }
@@ -80,6 +81,7 @@ private:
TABLE *table;
entry *next;
};
+ uint16 flags;
};
entry *find_entry(ulong table_id)
--- 1.96/sql/ha_ndbcluster_binlog.cc 2007-04-24 11:32:57 +03:00
+++ 1.97/sql/ha_ndbcluster_binlog.cc 2007-04-29 20:15:10 +03:00
@@ -3805,7 +3805,8 @@ restart:
const LEX_STRING& name=table->s->table_name;
DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
injector::transaction::table tbl(table, TRUE);
- int ret= trans.use_table(::server_id, tbl);
+ int ret= trans.use_table(::server_id, tbl,
+ Table_map_log_event::NO_CONFLICT_DETECTION_CHECKS_F);
DBUG_ASSERT(ret == 0);
// Set all fields non-null.
--- 1.8/sql/rpl_injector.cc 2007-01-12 13:24:33 +02:00
+++ 1.9/sql/rpl_injector.cc 2007-04-29 20:15:10 +03:00
@@ -66,10 +66,11 @@ int injector::transaction::commit()
DBUG_RETURN(0);
}
-int injector::transaction::use_table(server_id_type sid, table tbl)
+int injector::transaction::use_table(server_id_type sid, table tbl,
+ Table_map_log_event::flag_set flags)
{
DBUG_ENTER("injector::transaction::use_table");
-
+
int error;
if ((error= check_state(TABLE_STATE)))
@@ -77,7 +78,9 @@ int injector::transaction::use_table(ser
m_thd->set_server_id(sid);
error= m_thd->binlog_write_table_map(tbl.get_table(),
- tbl.is_transactional());
+ tbl.is_transactional(), flags);
+ DBUG_PRINT("info", ("table %s, map_flags %u -> error %u",
+ tbl.get_table()->s->table_name.str, flags, error));
DBUG_RETURN(error);
}
--- 1.8/sql/rpl_injector.h 2007-01-12 13:24:34 +02:00
+++ 1.9/sql/rpl_injector.h 2007-04-29 20:15:10 +03:00
@@ -177,7 +177,9 @@ public:
>0 Failure
*/
- int use_table(server_id_type sid, table tbl);
+ int use_table(server_id_type sid, table tbl,
+ Table_map_log_event::flag_set flags=
+ Table_map_log_event::TM_NO_FLAGS);
/*
Add a 'write row' entry to the transaction.
| Thread |
|---|
| • bk commit into 5.1 tree (aelkin:1.2412) | Andrei Elkin | 29 Apr |