diff options
author | unknown <mats@romeo.(none)> | 2007-02-26 10:19:08 +0100 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2007-02-26 10:19:08 +0100 |
commit | cdfc516d46353477ac3ec79aa3474a4520e66e72 (patch) | |
tree | 5e4ac7e07562c02859e2850b474ed37891410094 /sql/sp.cc | |
parent | fa22d34ea2ffb74409569df0525ac5c22d4ddc0d (diff) | |
download | mariadb-git-cdfc516d46353477ac3ec79aa3474a4520e66e72.tar.gz |
BUG#25091 (A DELETE statement to mysql database is not logged in ROW format):
With this patch, statements that change metadata (in the mysql database)
is logged as statements, while normal changes (e.g., using INSERT, DELETE,
and/or UPDATE) is logged according to the format in effect.
The log tables (i.e., general_log and slow_log) are not replicated at all.
With this patch, the following statements are replicated as statements:
GRANT, REVOKE (ALL), CREATE USER, DROP USER, and RENAME USER.
mysql-test/extra/binlog_tests/binlog.test:
Added test to check that normal INSERT, DELETE, and UPDATE to a table in
the mysql database is replicated both under row-based and statement-based
replication.
mysql-test/r/binlog_row_binlog.result:
Result change.
mysql-test/r/binlog_stm_binlog.result:
Result change.
sql/handler.cc:
Removed hardcoded check for mysql database.
Added table-specific flag for non-replication (used by log tables).
sql/log.cc:
Adding flag that a table shall not be replicated and set it for log
tables.
sql/sp.cc:
Turning row-based replication off for statements that change metadata.
sql/sql_acl.cc:
Turning row-based replication off for statements that change metadata.
sql/table.h:
Adding flag that a table shall not be replicated.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 14703e3aa42..b2bb1654176 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -500,6 +500,13 @@ db_create_routine(THD *thd, int type, sp_head *sp) DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length, sp->m_name.str)); + /* + This statement will be replicated as a statement, even when using + row-based replication. The flag will be reset at the end of the + statement. + */ + thd->clear_current_stmt_binlog_row_based(); + if (!(table= open_proc_table_for_update(thd))) ret= SP_OPEN_TABLE_FAILED; else @@ -636,6 +643,13 @@ db_drop_routine(THD *thd, int type, sp_name *name) DBUG_PRINT("enter", ("type: %d name: %.*s", type, name->m_name.length, name->m_name.str)); + /* + This statement will be replicated as a statement, even when using + row-based replication. The flag will be reset at the end of the + statement. + */ + thd->clear_current_stmt_binlog_row_based(); + if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); if ((ret= db_find_routine_aux(thd, type, name, table)) == SP_OK) @@ -668,6 +682,13 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) DBUG_PRINT("enter", ("type: %d name: %.*s", type, name->m_name.length, name->m_name.str)); + /* + This statement will be replicated as a statement, even when using + row-based replication. The flag will be reset at the end of the + statement. + */ + thd->clear_current_stmt_binlog_row_based(); + if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); if ((ret= db_find_routine_aux(thd, type, name, table)) == SP_OK) |