diff options
author | unknown <guilhem@mysql.com> | 2003-09-12 17:26:48 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-09-12 17:26:48 +0200 |
commit | 8cc642d721cf63ae3c784bec9893a3a04732bf31 (patch) | |
tree | 4193928a4a9684a4fae0ff7bc16006071bfa12c1 /sql | |
parent | 2a5e1057a21a5616c0a63306b70bb09e3d51919a (diff) | |
download | mariadb-git-8cc642d721cf63ae3c784bec9893a3a04732bf31.tar.gz |
Quick backport of the following bugfix from MySQL 4.0.14.
DO NOT COPY THIS CODE TO 4.0. The bugfix is better in 4.0,
but here in 3.23 we don't want to add a new error code so
we just use ER_EMPTY_QUERY. Bug was:
"If a query was ignored on the slave (because of
@code{replicate-ignore-table} and other similar rules), the slave
still checked if the query got the same error code (0, no error) as on
the master. So if the master had an error on the query (for example,
``Duplicate entry'' in a multiple-row insert), then the slave stopped
and warned that the error codes didn't match. (Bug #797)"
sql/slave.cc:
Ignore ER_EMPTY_QUERY as it is also a marker for "query was ignored because
of replicate-*-table rules".
sql/sql_parse.cc:
In a slave thread, mark an ignored query (because of replicate-*-table rules)
as empty. The caller, exec_event(), will understand this error code as "ignorable
query, don't compare the error codes on master and slave".
Diffstat (limited to 'sql')
-rw-r--r-- | sql/slave.cc | 3 | ||||
-rw-r--r-- | sql/sql_parse.cc | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 50cb224d83d..a51db52cc7f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -923,7 +923,8 @@ point. If you are sure that your master is ok, run this query manually on the\ inline int ignored_error_code(int err_code) { - return use_slave_mask && bitmap_is_set(&slave_error_mask, err_code); + return ((err_code == ER_EMPTY_QUERY) || + (use_slave_mask && bitmap_is_set(&slave_error_mask, err_code))); } static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 805063cb6dc..81233c038a1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1085,7 +1085,19 @@ mysql_execute_command(void) // rules have been given and the table list says the query should not be // replicated if(table_rules_on && tables && !tables_ok(thd,tables)) + { + /* + We consider the query as empty and warn the slave thread which will + consider ER_EMPTY_QUERY as an ignorable error. Note that this has a + drawback: if the event is corrupted it could contain an empty query; + then the slave thread will silently ignore it instead of warning. But + such corruption is unlikely enough. + In MySQL 4.0 we do it more properly using a new error code + (ER_SLAVE_IGNORED_TABLE). + */ + my_error(ER_EMPTY_QUERY, MYF(0)); DBUG_VOID_RETURN; + } // this is a workaround to deal with the shortcoming // in 3.23.44-3.23.46 masters // in RELEASE_LOCK() logging. We re-write SELECT RELEASE_LOCK() as |