mariadb/mysql-test/t/rpl_error_ignored_table.test

56 lines
1.6 KiB
Text
Raw Normal View History

Fix for BUG#797 "If query ignored on slave (replicate-ignore-table) the slave still checks if the returned error (0) is the same as the one on the master, whereas it shouldn't test this. Plus a new test for BUG#797. include/mysqld_error.h: New error code (can be sent only to the slave thread, not to normal clients). sql/log.cc: removed comment from a previous debugging. sql/log_event.cc: ER_SLAVE_IGNORED_TABLE is an ignorable error. sql/share/czech/errmsg.txt: for BUG#797 sql/share/danish/errmsg.txt: for BUG#797 sql/share/dutch/errmsg.txt: for BUG#797 sql/share/english/errmsg.txt: for BUG#797 sql/share/estonian/errmsg.txt: for BUG#797 sql/share/french/errmsg.txt: for BUG#797 sql/share/german/errmsg.txt: for BUG#797 sql/share/greek/errmsg.txt: for BUG#797 sql/share/hungarian/errmsg.txt: for BUG#797 sql/share/italian/errmsg.txt: for BUG#797 sql/share/japanese/errmsg.txt: for BUG#797 sql/share/korean/errmsg.txt: for BUG#797 sql/share/norwegian-ny/errmsg.txt: for BUG#797 sql/share/norwegian/errmsg.txt: for BUG#797 sql/share/polish/errmsg.txt: for BUG#797 sql/share/portuguese/errmsg.txt: for BUG#797 sql/share/romanian/errmsg.txt: for BUG#797 sql/share/russian/errmsg.txt: for BUG#797 sql/share/slovak/errmsg.txt: for BUG#797 sql/share/spanish/errmsg.txt: for BUG#797 sql/share/swedish/errmsg.txt: for BUG#797 sql/share/ukrainian/errmsg.txt: for BUG#797 sql/sql_parse.cc: when in sql_parse in the slave thread we ignore the query because of replicate-do and replicate-ignore options, we return a specific error to the slave thread, so that it knows that the query has been ignored (which is different from a successful query). A small cleanup (test was done twice).
2003-07-08 15:50:57 +02:00
# Test for
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
source include/master-slave.inc;
connection master;
create table t1 (a int primary key);
# generate an error that goes to the binlog
--error 1062;
insert into t1 values (1),(1);
save_master_pos;
connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync
sync_with_master;
# The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
Fix for BUG#797 "If query ignored on slave (replicate-ignore-table) the slave still checks if the returned error (0) is the same as the one on the master, whereas it shouldn't test this. Plus a new test for BUG#797. include/mysqld_error.h: New error code (can be sent only to the slave thread, not to normal clients). sql/log.cc: removed comment from a previous debugging. sql/log_event.cc: ER_SLAVE_IGNORED_TABLE is an ignorable error. sql/share/czech/errmsg.txt: for BUG#797 sql/share/danish/errmsg.txt: for BUG#797 sql/share/dutch/errmsg.txt: for BUG#797 sql/share/english/errmsg.txt: for BUG#797 sql/share/estonian/errmsg.txt: for BUG#797 sql/share/french/errmsg.txt: for BUG#797 sql/share/german/errmsg.txt: for BUG#797 sql/share/greek/errmsg.txt: for BUG#797 sql/share/hungarian/errmsg.txt: for BUG#797 sql/share/italian/errmsg.txt: for BUG#797 sql/share/japanese/errmsg.txt: for BUG#797 sql/share/korean/errmsg.txt: for BUG#797 sql/share/norwegian-ny/errmsg.txt: for BUG#797 sql/share/norwegian/errmsg.txt: for BUG#797 sql/share/polish/errmsg.txt: for BUG#797 sql/share/portuguese/errmsg.txt: for BUG#797 sql/share/romanian/errmsg.txt: for BUG#797 sql/share/russian/errmsg.txt: for BUG#797 sql/share/slovak/errmsg.txt: for BUG#797 sql/share/spanish/errmsg.txt: for BUG#797 sql/share/swedish/errmsg.txt: for BUG#797 sql/share/ukrainian/errmsg.txt: for BUG#797 sql/sql_parse.cc: when in sql_parse in the slave thread we ignore the query because of replicate-do and replicate-ignore options, we return a specific error to the slave thread, so that it knows that the query has been ignored (which is different from a successful query). A small cleanup (test was done twice).
2003-07-08 15:50:57 +02:00
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
Fix for BUG#2983 "If statement was killed on master, slave errors despite replicate-wild-ignore-t" We introduce a new function mysql_test_parse_for_slave(). If the slave sees that the query got a really bad error on master (killed e.g.), then it calls this function to know if this query can be ignored because of replicate-*-table rules (do not worry about replicate-*-db rules: they are checked so early that they have no bug). If the answer is yes, it skips the query and continues. If it's no, then it stops and say "fix your slave data manually" (like it did before this change). mysql-test/r/rpl_error_ignored_table.result: result update mysql-test/t/rpl_error_ignored_table-slave.opt: ignore more tables mysql-test/t/rpl_error_ignored_table.test: we test if a killed query on the master, is ignored on the slave if the tables it involves should be excluded because of replicate-*-table rules. sql/log_event.cc: If the query got a really bad error on the master (thread killed etc), parse it to test the table names: if the replicate-*-do|ignore-table rules say "this query must be ignored" then we exit gracefully; otherwise we warn about the bad error and tell DBA to check/fix it. Before this change, we always warned and stopped. sql/mysql_priv.h: new function sql/slave.cc: don't print error immediately as we need to do one more test to be sure. sql/sql_parse.cc: we add a function mysql_test_parse_for_slave(), to be used only by the slave if it wants to know if the query should be ignored or not; so this function only parses the query, does not execute it.
2004-03-11 17:38:19 +01:00
# Now test that even critical errors (connection killed)
# are ignored if rules allow it.
# The "kill" idea was copied from rpl000001.test.
connection master1;
select get_lock('crash_lock%20C', 10);
connection master;
create table t2 (a int primary key);
insert into t2 values(1);
create table t3 (id int);
insert into t3 values(connection_id());
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
connection master1;
real_sleep 2;
Fix for BUG#2983 "If statement was killed on master, slave errors despite replicate-wild-ignore-t" We introduce a new function mysql_test_parse_for_slave(). If the slave sees that the query got a really bad error on master (killed e.g.), then it calls this function to know if this query can be ignored because of replicate-*-table rules (do not worry about replicate-*-db rules: they are checked so early that they have no bug). If the answer is yes, it skips the query and continues. If it's no, then it stops and say "fix your slave data manually" (like it did before this change). mysql-test/r/rpl_error_ignored_table.result: result update mysql-test/t/rpl_error_ignored_table-slave.opt: ignore more tables mysql-test/t/rpl_error_ignored_table.test: we test if a killed query on the master, is ignored on the slave if the tables it involves should be excluded because of replicate-*-table rules. sql/log_event.cc: If the query got a really bad error on the master (thread killed etc), parse it to test the table names: if the replicate-*-do|ignore-table rules say "this query must be ignored" then we exit gracefully; otherwise we warn about the bad error and tell DBA to check/fix it. Before this change, we always warned and stopped. sql/mysql_priv.h: new function sql/slave.cc: don't print error immediately as we need to do one more test to be sure. sql/sql_parse.cc: we add a function mysql_test_parse_for_slave(), to be used only by the slave if it wants to know if the query should be ignored or not; so this function only parses the query, does not execute it.
2004-03-11 17:38:19 +01:00
select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
connection master;
--error 1053,0;
Fix for BUG#2983 "If statement was killed on master, slave errors despite replicate-wild-ignore-t" We introduce a new function mysql_test_parse_for_slave(). If the slave sees that the query got a really bad error on master (killed e.g.), then it calls this function to know if this query can be ignored because of replicate-*-table rules (do not worry about replicate-*-db rules: they are checked so early that they have no bug). If the answer is yes, it skips the query and continues. If it's no, then it stops and say "fix your slave data manually" (like it did before this change). mysql-test/r/rpl_error_ignored_table.result: result update mysql-test/t/rpl_error_ignored_table-slave.opt: ignore more tables mysql-test/t/rpl_error_ignored_table.test: we test if a killed query on the master, is ignored on the slave if the tables it involves should be excluded because of replicate-*-table rules. sql/log_event.cc: If the query got a really bad error on the master (thread killed etc), parse it to test the table names: if the replicate-*-do|ignore-table rules say "this query must be ignored" then we exit gracefully; otherwise we warn about the bad error and tell DBA to check/fix it. Before this change, we always warned and stopped. sql/mysql_priv.h: new function sql/slave.cc: don't print error immediately as we need to do one more test to be sure. sql/sql_parse.cc: we add a function mysql_test_parse_for_slave(), to be used only by the slave if it wants to know if the query should be ignored or not; so this function only parses the query, does not execute it.
2004-03-11 17:38:19 +01:00
reap;
connection master1;
show binlog events from 79;
save_master_pos;
connection slave;
# SQL slave thread should not have stopped (because table of the killed
# query is in the ignore list).
sync_with_master;