Merge lp:~tsarev/percona-server/5.1-18205_01_mysqlbinlog_fix.patch into lp:percona-server/5.1

Proposed by Oleg Tsarev
Status: Superseded
Proposed branch: lp:~tsarev/percona-server/5.1-18205_01_mysqlbinlog_fix.patch
Merge into: lp:percona-server/5.1
Diff against target: 90 lines (+15/-9)
2 files modified
Percona-Server/client/mysqlbinlog.cc (+13/-3)
Percona-Server/mysql-test/r/mysqlbinlog.result (+2/-6)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.1-18205_01_mysqlbinlog_fix.patch
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Oleg Tsarev (community) Needs Resubmitting
Laurynas Biveinis Pending
Stewart Smith Pending
Review via email: mp+92275@code.launchpad.net

This proposal supersedes a proposal from 2012-02-09.

This proposal has been superseded by a proposal from 2012-02-09.

Description of the change

http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-param/250/

Make mysqlbinlog omit redundant `use` around BEGIN/SAVEPOINT/COMMIT/ROLLBACK in 5.0 binlogs
This is a merge of lp:percona-server/rnt-5.1 patch mysqlbinlog_fix.patch.

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.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Please describe the safe_connect change, what does it fix?

Line 20: s/binary log 5.0/5.0 binary log
Line 31: s/and/any

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

According to comments safe_connect "Create and initialize the global mysql object, and connect to the server".

Without this change safe_connect will overwrite available connection (see line 35 in MP) and connection will be leaked.

review: Needs Resubmitting
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

I fixed misstyping in comments

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

safe_connect() is called only once in mysqlbinlog, so it's not clear under what circumstances it could overwrite the available connection.

Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Original patch "mysqlbinlog_fix.patch" contain this, and MariaDB also merted it with this changes.
What you proposed? Remove this change?

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Yes, it doesn't seem to be necessary.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

LGTM, thank you.

review: Approve
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

But shouldn't we also have a bug report or BP for this? So it's reflected in the changelog.

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

According to customer issue 18205 fix should be included to lp:percona-server/5.1

review: Needs Resubmitting
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

It will be included but we do need to have a bug report or a blueprint (probably the former in this case), so we can track it in milestone, write release notes for it, etc.

review: Needs Information
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Excellent, but how Hrvoje will know this fix should be included into release notes?

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Description from commit it's enough.

review: Needs Resubmitting
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Probably Stewart solve this missunderstanding from both sides

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Linked bug #702303 related to feature

review: Needs Resubmitting
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Is bug 702303 really related: it concerns with --rewrite-db option, while this MP looks like it's relevant for 5.0 binlogs without such option. The fix is also completely different. I'm not saying that it's not that bug, I don't know that, but that it needs clarification.

review: Needs Information
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

It's an unrelated bug. Which is easy to find out by looking at the fix for that bug.

Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

You are right, this bug unrelated.

I have no idea which bug originally related to proposed fix.
This fix required for customer.

Perhaps avoid the burocracy? This is fix. Fix does better for Percona-Server.
What you need? I have no idea.

review: Needs Resubmitting
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

This is not a bureaucracy but quite important part of trunk merge and release process. Do you propose to write in release notes "Some fixes that do better for Percona Server"?

If there is no bug, make one.

review: Needs Information
Revision history for this message
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

bug #929521

Now all it is ok?

review: Needs Resubmitting
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

After referencing the bug # in revision comments -- yes.

review: Needs Fixing
Revision history for this message
Oleg Tsarev (tsarev) wrote :

And now?

review: Needs Resubmitting
Revision history for this message
Alexey Kopytov (akopytov) wrote :

And now I still don't see the bug # in revision comments.

review: Needs Fixing
Revision history for this message
Oleg Tsarev (tsarev) wrote :

oleg.tsarev (0) /storage/dev/percona/18205/final$ bzr log lp:~tsarev/percona-server/5.1-18205_01_mysqlbinlog_fix.patch | head -n 15
------------------------------------------------------------
revno: 424
fixes bug(s): https://launchpad.net/bugs/929521
committer: Oleg Tsarev <email address hidden>
branch nick: final
timestamp: Thu 2012-02-09 22:59:45 +0900
message:
  Make mysqlbinlog omit redundant around BEGIN/SAVEPOINT/COMMIT/ROLLBACK in 5.0 binlogs.
  This is a merge of lp:percona-server/rnt-5.1 patch mysqlbinlog_fix.patch.

  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 statements around such statements when the binlog is dumped by mysqlbinlog.

  Fix by always suppressing the output of for these statements.
------------------------------------------------------------

review: Needs Resubmitting
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Woohoo! You did it! Congratulations!

Truly yours,
"Pure Mathematician"

review: Approve
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

I see that requirements for fixes were quite reasonable and explainable.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/client/mysqlbinlog.cc'
2--- Percona-Server/client/mysqlbinlog.cc 2011-07-11 16:13:27 +0000
3+++ Percona-Server/client/mysqlbinlog.cc 2012-02-09 14:07:20 +0000
4@@ -741,9 +741,19 @@
5
6 switch (ev_type) {
7 case QUERY_EVENT:
8- if (!((Query_log_event*)ev)->is_trans_keyword() &&
9- shall_skip_database(((Query_log_event*)ev)->db))
10- goto end;
11+ if (!((Query_log_event*)ev)->is_trans_keyword())
12+ {
13+ if (shall_skip_database(((Query_log_event*)ev)->db))
14+ goto end;
15+ }
16+ else
17+ {
18+ /*
19+ In case the event for one of these statements is obtained
20+ from 5.0 binary log, make it compatible with 5.1.
21+ */
22+ ev->flags|= LOG_EVENT_SUPPRESS_USE_F;
23+ }
24 if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
25 {
26 if ((retval= write_event_header_and_base64(ev, result_file,
27
28=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog.result'
29--- Percona-Server/mysql-test/r/mysqlbinlog.result 2011-03-25 14:16:13 +0000
30+++ Percona-Server/mysql-test/r/mysqlbinlog.result 2012-02-09 14:07:20 +0000
31@@ -220,7 +220,6 @@
32 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
33 DELIMITER /*!*/;
34 ROLLBACK/*!*/;
35-use test/*!*/;
36 SET TIMESTAMP=1108844556/*!*/;
37 SET @@session.pseudo_thread_id=999999999/*!*/;
38 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
39@@ -228,6 +227,7 @@
40 SET @@session.collation_database=DEFAULT/*!*/;
41 BEGIN
42 /*!*/;
43+use test/*!*/;
44 SET TIMESTAMP=1108844555/*!*/;
45 insert t1 values (1)
46 /*!*/;
47@@ -239,7 +239,6 @@
48 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
49 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
50 DELIMITER /*!*/;
51-use test/*!*/;
52 SET TIMESTAMP=1108844556/*!*/;
53 SET @@session.pseudo_thread_id=999999999/*!*/;
54 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
55@@ -247,6 +246,7 @@
56 SET @@session.collation_database=DEFAULT/*!*/;
57 BEGIN
58 /*!*/;
59+use test/*!*/;
60 SET TIMESTAMP=1108844555/*!*/;
61 insert t1 values (1)
62 /*!*/;
63@@ -581,7 +581,6 @@
64 SET @@session.collation_database=DEFAULT/*!*/;
65 BEGIN
66 /*!*/;
67-use test/*!*/;
68 SET TIMESTAMP=1266652094/*!*/;
69 SavePoint mixed_cases
70 /*!*/;
71@@ -592,11 +591,9 @@
72 SET TIMESTAMP=1266652094/*!*/;
73 INSERT INTO db1.t1 VALUES(40)
74 /*!*/;
75-use test/*!*/;
76 SET TIMESTAMP=1266652094/*!*/;
77 ROLLBACK TO mixed_cases
78 /*!*/;
79-use db1/*!*/;
80 SET TIMESTAMP=1266652094/*!*/;
81 INSERT INTO db1.t2 VALUES("after rollback to")
82 /*!*/;
83@@ -624,7 +621,6 @@
84 SET @@session.collation_database=DEFAULT/*!*/;
85 BEGIN
86 /*!*/;
87-use test/*!*/;
88 SET TIMESTAMP=1266652094/*!*/;
89 SavePoint mixed_cases
90 /*!*/;

Subscribers

People subscribed via source and target branches