diff options
author | He Zhenxing <hezx@mysql.com> | 2008-07-31 14:24:27 +0800 |
---|---|---|
committer | He Zhenxing <hezx@mysql.com> | 2008-07-31 14:24:27 +0800 |
commit | a018e98cba6158e7a2885cffcc092ab66a934d5e (patch) | |
tree | de2982498ec76b7c6ecf0d7d1258679a9ae3a459 /mysql-test/include/wait_for_slave_sql_error_and_skip.inc | |
parent | 1f28448efb44e62e9dee113ccc7d8309b1664c17 (diff) | |
download | mariadb-git-a018e98cba6158e7a2885cffcc092ab66a934d5e.tar.gz |
BUG#37051 Replication rules not evaluated correctly
The problem of this bug is that we need to get the list of tables
to be updated for a multi-table update statement, which requires to
open all the tables referenced by the statement and resolve all
the fields involved in update in order to figure out the list of
tables for update. However if there are replicate filter rules,
some tables might not exist on slave and result in a failure
before we could examine the filter rules.
I think the whole problem can not be solved on slave alone,
the master must record and send the information of tables
involved for update to slave, so that the slave do not need to
open all the tables referenced by the multi-table update statement to
figure out which tables are involved for update.
So a status variable is added to Query_log event to store the
value of table map for update on master. And on slave, it will
try to get the value of this variable and use it to examine
filter rules without opening any tables on slave, if this values
is not available, the old approach is used and thus the bug will
still occur for when replicating from old masters.
sql/sql_class.h:
add member table_map_for_update to THD
sql/sql_parse.cc:
check filter rules by using table_map_for_update value
sql/sql_update.cc:
save the value of table_map_for_update
Diffstat (limited to 'mysql-test/include/wait_for_slave_sql_error_and_skip.inc')
-rw-r--r-- | mysql-test/include/wait_for_slave_sql_error_and_skip.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc new file mode 100644 index 00000000000..c38277b33ff --- /dev/null +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -0,0 +1,23 @@ +# ==== Purpose ==== +# +# Wait for slave SQL error, skip the erroneous statement and restart +# slave +# +# ==== Usage ==== +# +# let show_sql_error=0|1; +# source include/wait_for_slave_sql_error_and_skip.inc; + +echo --source include/wait_for_slave_sql_error_and_skip.inc; +connection slave; +source include/wait_for_slave_sql_error.inc; +if ($show_sql_error) +{ + let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); + echo Last_SQL_Error = $error; +} + +# skip the erroneous statement +set global sql_slave_skip_counter=1; +source include/start_slave.inc; +connection master; |