~percona-dev/percona-server/release-5.1.52-12-rnt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# name       : mysqlbinlog_fix.patch
# introduced : 12
# maintainer : Oleg
#
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
diff -Nur a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
--- a/client/mysqlbinlog.cc	2010-08-08 11:58:55.458112142 +0400
+++ b/client/mysqlbinlog.cc	2010-08-08 12:31:03.858088787 +0400
@@ -730,9 +730,17 @@
 
     switch (ev_type) {
     case QUERY_EVENT:
-      if (!((Query_log_event*)ev)->is_trans_keyword() &&
-          shall_skip_database(((Query_log_event*)ev)->db))
-        goto end;
+      if (!((Query_log_event*)ev)->is_trans_keyword())
+      {
+        if (shall_skip_database(((Query_log_event*)ev)->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
+        ev->flags|= LOG_EVENT_SUPPRESS_USE_F;
+      }
       if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
       {
         if ((retval= write_event_header_and_base64(ev, result_file,
@@ -1382,6 +1390,10 @@
 */
 static Exit_status safe_connect()
 {
+  /* Close and old connections to MySQL */
+  if (mysql)
+    mysql_close(mysql);
+
   mysql= mysql_init(NULL);
 
   if (!mysql)