[Commits] Rev 3460: MDEV-26: Global Transaction ID in http://bazaar.launchpad.net/~maria-captains/maria/10.0

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Fri Feb 22 13:31:55 EET 2013


At http://bazaar.launchpad.net/~maria-captains/maria/10.0

------------------------------------------------------------
revno: 3460
revision-id: knielsen at knielsen-hq.org-20130222113155-cc1dgyi6t5hjnrui
parent: knielsen at knielsen-hq.org-20130222092317-5f80p9abmv2k5f44
committer: knielsen at knielsen-hq.org
branch nick: work-10.0-mdev26
timestamp: Fri 2013-02-22 12:31:55 +0100
message:
  MDEV-26: Global Transaction ID
  
   - Fix skipping initial MyISAM DML when connecting using GTID.
  
   - Fix RESET MASTER not clearing in-memory binlog state.
  
   - Fix not reading standalone flag in Gtid_log_event::peek().
  
   - Fix skipping DDL that the slave has already seen when using GTID position.
=== modified file 'sql/log.cc'
--- a/sql/log.cc	2013-02-22 09:23:17 +0000
+++ b/sql/log.cc	2013-02-22 11:31:55 +0000
@@ -3797,6 +3797,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd,
       break;
   }
 
+  if (!is_relay_log)
+    rpl_global_gtid_binlog_state.reset();
+
   /* Start logging with a new file */
   close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED);
   if ((error= my_delete_allow_opened(index_file_name, MYF(0)))) // Reset (open will update)

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2013-02-22 09:23:17 +0000
+++ b/sql/log_event.cc	2013-02-22 11:31:55 +0000
@@ -4260,6 +4260,17 @@ Query_log_event::do_shall_skip(Relay_log
   DBUG_RETURN(Log_event::do_shall_skip(rli));
 }
 
+
+bool
+Query_log_event::peek_is_commit_rollback(const char *event_start,
+                                         size_t event_len)
+{
+  if (event_len < LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN || event_len < 9)
+    return false;
+  return !memcmp(event_start + (event_len-7), "\0COMMIT", 7) ||
+         !memcmp(event_start + (event_len-9), "\0ROLLBACK", 9);
+}
+
 #endif
 
 
@@ -7017,6 +7028,8 @@ Gtid_log_event::peek(const char *event_s
   *seq_no= uint8korr(p);
   p+= 8;
   *domain_id= uint4korr(p);
+  p+= 4;
+  *flags2= (uchar)*p;
   return false;
 }
 

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2013-02-19 10:45:29 +0000
+++ b/sql/log_event.h	2013-02-22 11:31:55 +0000
@@ -1913,6 +1913,8 @@ public:        /* !!! Public in this pat
   int do_apply_event(Relay_log_info const *rli,
                        const char *query_arg,
                        uint32 q_len_arg);
+  static bool peek_is_commit_rollback(const char *event_start,
+                                      size_t event_len);
 #endif /* HAVE_REPLICATION */
   /*
     If true, the event always be applied by slave SQL thread or be printed by

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2013-02-22 09:23:17 +0000
+++ b/sql/sql_repl.cc	2013-02-22 11:31:55 +0000
@@ -1015,6 +1015,7 @@ send_event_to_slave(THD *thd, NET *net,
                     enum_gtid_skip_type *gtid_skip_group)
 {
   my_off_t pos;
+  size_t len= packet->length();
 
   /* Skip GTID event groups until we reach slave position within a domain_id. */
   if (event_type == GTID_EVENT && using_gtid_state && gtid_state->count() > 0)
@@ -1023,7 +1024,6 @@ send_event_to_slave(THD *thd, NET *net,
     uint64 seq_no;
     uchar flags2;
     rpl_gtid *gtid;
-    size_t len= packet->length();
 
     if (ev_offset > len ||
         Gtid_log_event::peek(packet->ptr()+ev_offset, len - ev_offset,
@@ -1054,7 +1054,8 @@ send_event_to_slave(THD *thd, NET *net,
   switch (*gtid_skip_group)
   {
   case GTID_SKIP_STANDALONE:
-    if (event_type != INTVAR_EVENT &&
+    if (event_type != GTID_EVENT &&
+        event_type != INTVAR_EVENT &&
         event_type != RAND_EVENT &&
         event_type != USER_VAR_EVENT &&
         event_type != TABLE_MAP_EVENT &&
@@ -1062,7 +1063,10 @@ send_event_to_slave(THD *thd, NET *net,
       *gtid_skip_group= GTID_SKIP_NOT;
     return NULL;
   case GTID_SKIP_TRANSACTION:
-    if (event_type == XID_EVENT /* ToDo || is_COMMIT_query_event() */)
+    if (event_type == XID_EVENT ||
+        (event_type == QUERY_EVENT &&
+         Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset,
+                                                  len - ev_offset)))
       *gtid_skip_group= GTID_SKIP_NOT;
     return NULL;
   case GTID_SKIP_NOT:
@@ -1173,7 +1177,7 @@ send_event_to_slave(THD *thd, NET *net,
                (thd, flags, packet, log_file_name, pos)))
     return "run 'before_send_event' hook failed";
 
-  if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
+  if (my_net_write(net, (uchar*) packet->ptr(), len))
     return "Failed on my_net_write()";
 
   DBUG_PRINT("info", ("log event code %d", (*packet)[LOG_EVENT_OFFSET+1] ));



More information about the commits mailing list