mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Make mysqlbinlog omit redundant use
around BEGIN/SAVEPOINT/COMMIT/ROLLBACK in 5.0 binlogs
This is a merge of percona patch mysqlbinlog_fix.patch. Apparently, MySQL 5.0 does not flag BEGIN/SAVEPOINT/COMMIT/ROLLBACK statements in its binlogs with LOG_EVENT_SUPPRESS_USE_F like 5.1+ does. This causes unnecessary `use` statements around such statements when the binlog is dumped by mysqlbinlog. Fix by always suppressing the output of `use` for these statements.
This commit is contained in:
@ -842,8 +842,19 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
case QUERY_EVENT:
|
||||
{
|
||||
Query_log_event *qe= (Query_log_event*)ev;
|
||||
if (!qe->is_trans_keyword() && shall_skip_database(qe->db))
|
||||
goto end;
|
||||
if (!qe->is_trans_keyword())
|
||||
{
|
||||
if (shall_skip_database(qe->db))
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
In case the event for one of these statements is obtained
|
||||
from binary log 5.0, make it compatible with 5.1
|
||||
*/
|
||||
qe->flags|= LOG_EVENT_SUPPRESS_USE_F;
|
||||
}
|
||||
print_use_stmt(print_event_info, qe->db, qe->db_len);
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
|
||||
{
|
||||
|
@ -222,7 +222,6 @@ ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1108844556/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
@ -230,6 +229,7 @@ SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1108844555/*!*/;
|
||||
insert t1 values (1)
|
||||
/*!*/;
|
||||
@ -241,7 +241,6 @@ Warning: The option '--position' is deprecated and will be removed in a future r
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1108844556/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
@ -249,6 +248,7 @@ SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1108844555/*!*/;
|
||||
insert t1 values (1)
|
||||
/*!*/;
|
||||
@ -584,7 +584,6 @@ SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
@ -595,11 +594,9 @@ INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t1 VALUES(40)
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
ROLLBACK TO mixed_cases
|
||||
/*!*/;
|
||||
use db1/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
INSERT INTO db1.t2 VALUES("after rollback to")
|
||||
/*!*/;
|
||||
@ -627,7 +624,6 @@ SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1266652094/*!*/;
|
||||
SavePoint mixed_cases
|
||||
/*!*/;
|
||||
|
Reference in New Issue
Block a user