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 /sql/sql_class.h | |
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 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index a86b4d36d00..cf238de776b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -396,7 +396,6 @@ struct system_variables DATE_TIME_FORMAT *datetime_format; DATE_TIME_FORMAT *time_format; my_bool sysdate_is_now; - }; @@ -1446,6 +1445,13 @@ public: Note: in the parser, stmt_arena == thd, even for PS/SP. */ Query_arena *stmt_arena; + + /* + map for tables that will be updated for a multi-table update query + statement, for other query statements, this will be zero. + */ + table_map table_map_for_update; + /* Tells if LAST_INSERT_ID(#) was called for the current statement */ bool arg_of_last_insert_id_function; /* |