[Commits] Rev 3459: 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 11:23:17 EET 2013


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

------------------------------------------------------------
revno: 3459
revision-id: knielsen at knielsen-hq.org-20130222092317-5f80p9abmv2k5f44
parent: knielsen at knielsen-hq.org-20130221134611-mjq3epyjvk62tue3
committer: knielsen at knielsen-hq.org
branch nick: work-10.0-mdev26
timestamp: Fri 2013-02-22 10:23:17 +0100
message:
  MDEV-26: Global Transaction ID
  
   - Fix that binlog_gtid_pos() (and hence slave connect) does not work
     correctly in the very first binlog file (due to not logging empty
     Gtid_list_log_event).
  
   - Remove one instance of the stupid domain_id-0-is-implicit.
  
   - Rename the confusing Gtid_Pos_Auto in SHOW SLAVE STATUS to Using_Gtid.
  
   - Fix memory leak.
=== modified file 'mysql-test/include/check-testcase.test'
--- a/mysql-test/include/check-testcase.test	2013-02-18 14:41:17 +0000
+++ b/mysql-test/include/check-testcase.test	2013-02-22 09:23:17 +0000
@@ -60,7 +60,7 @@ if ($tmp)
   --echo Last_SQL_Error 
   --echo Replicate_Ignore_Server_Ids    
   --echo Master_Server_Id       #
-  --echo Gtid_Pos_Auto  0
+  --echo Using_Gtid     0
 }
 if (!$tmp) {
   # Note: after WL#5177, fields 13-18 shall not be filtered-out.

=== modified file 'mysql-test/include/rpl_end.inc'
--- a/mysql-test/include/rpl_end.inc	2013-02-21 07:10:55 +0000
+++ b/mysql-test/include/rpl_end.inc	2013-02-22 09:23:17 +0000
@@ -89,7 +89,7 @@ while ($_rpl_server)
   --let $rpl_connection_name= server_$_rpl_server
   --source include/rpl_connection.inc
 
-  # Clear Gtid_Pos_Auto in SHOW SLAVE STATUS to keep check_testcase happy.
+  # Clear Using_Gtid in SHOW SLAVE STATUS to keep check_testcase happy.
   CHANGE MASTER TO master_log_file='';
 
   --dec $_rpl_server

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2013-01-25 14:21:49 +0000
+++ b/sql/log.cc	2013-02-22 09:23:17 +0000
@@ -3233,12 +3233,9 @@ bool MYSQL_BIN_LOG::open(const char *log
           there had been an entry (domain_id, server_id, 0).
         */
 
-        if (rpl_global_gtid_binlog_state.count())
-        {
-          Gtid_list_log_event gl_ev(&rpl_global_gtid_binlog_state);
-          if (gl_ev.write(&log_file))
-            goto err;
-        }
+        Gtid_list_log_event gl_ev(&rpl_global_gtid_binlog_state);
+        if (gl_ev.write(&log_file))
+          goto err;
 
         /* Output a binlog checkpoint event at the start of the binlog file. */
 

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2013-02-19 10:45:29 +0000
+++ b/sql/log_event.cc	2013-02-22 09:23:17 +0000
@@ -7209,9 +7209,9 @@ Gtid_list_log_event::Gtid_list_log_event
   buf+= header_size;
   count= uint4korr(buf) & ((1<<28)-1);
   buf+= 4;
-  if (count == 0 ||
-      event_len - (header_size + post_header_len) < count*element_size ||
-      (!(list= (rpl_gtid *)my_malloc(count*sizeof(*list), MYF(MY_WME)))))
+  if (event_len - (header_size + post_header_len) < count*element_size ||
+      (!(list= (rpl_gtid *)my_malloc(count*sizeof(*list) + (count == 0),
+                                     MYF(MY_WME)))))
     return;
 
   for (i= 0; i < count; ++i)
@@ -7303,11 +7303,10 @@ rpl_binlog_state::get_most_recent_gtid_l
 Gtid_list_log_event::Gtid_list_log_event(rpl_binlog_state *gtid_set)
   : count(gtid_set->count()), list(0)
 {
-  DBUG_ASSERT(count != 0);
-
   /* Failure to allocate memory will be caught by is_valid() returning false. */
-  if (count != 0 && count < (1<<28) &&
-      (list = (rpl_gtid *)my_malloc(count * sizeof(*list), MYF(MY_WME))))
+  if (count < (1<<28) &&
+      (list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
+                                    MYF(MY_WME))))
     gtid_set->get_gtid_list(list, count);
 }
 
@@ -7345,17 +7344,13 @@ Gtid_list_log_event::pack_info(THD *thd,
   uint32 i;
 
   buf.length(0);
+  buf.append(STRING_WITH_LEN("["));
   for (i= 0; i < count; ++i)
   {
     if (i)
       buf.append(STRING_WITH_LEN(", "));
-    else
-      buf.append(STRING_WITH_LEN("["));
-    if (list[i].domain_id)
-    {
-      buf.append_ulonglong((ulonglong)list[i].domain_id);
-      buf.append(STRING_WITH_LEN("-"));
-    }
+    buf.append_ulonglong((ulonglong)list[i].domain_id);
+    buf.append(STRING_WITH_LEN("-"));
     buf.append_ulonglong((ulonglong)list[i].server_id);
     buf.append(STRING_WITH_LEN("-"));
     buf.append_ulonglong(list[i].seq_no);
@@ -7381,8 +7376,7 @@ Gtid_list_log_event::print(FILE *file, P
     print_header(&cache, print_event_info, FALSE);
     for (i= 0; i < count; ++i)
     {
-      if (list[i].domain_id)
-        my_b_printf(&cache, "%u-", list[i].domain_id);
+      my_b_printf(&cache, "%u-", list[i].domain_id);
       longlong10_to_str(list[i].seq_no, buf, 10);
       my_b_printf(&cache, "%u-%s", list[i].server_id, buf);
       if (i < count-1)
@@ -7417,7 +7411,8 @@ Gtid_list_log_event::peek(const char *ev
   if (event_len < LOG_EVENT_HEADER_LEN + GTID_LIST_HEADER_LEN +
       16 * count)
     return true;
-  if (!(gtid_list= (rpl_gtid *)my_malloc(sizeof(rpl_gtid)*count, MYF(MY_WME))))
+  if (!(gtid_list= (rpl_gtid *)my_malloc(sizeof(rpl_gtid)*count + (count == 0),
+                                         MYF(MY_WME))))
     return true;
   *out_gtid_list= gtid_list;
   *out_list_len= count;

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2013-02-21 07:10:55 +0000
+++ b/sql/slave.cc	2013-02-22 09:23:17 +0000
@@ -2254,7 +2254,7 @@ static bool send_show_master_info_header
                                              FN_REFLEN));
   field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
                                            MYSQL_TYPE_LONG));
-  field_list.push_back(new Item_return_int("Gtid_Pos_Auto", sizeof(ulong),
+  field_list.push_back(new Item_return_int("Using_Gtid", sizeof(ulong),
                                            MYSQL_TYPE_LONG));
   if (full)
   {

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2013-02-21 13:46:11 +0000
+++ b/sql/sql_repl.cc	2013-02-22 09:23:17 +0000
@@ -735,7 +735,7 @@ gtid_find_binlog_file(slave_connection_s
 {
   MEM_ROOT memroot;
   binlog_file_entry *list;
-  Gtid_list_log_event *glev;
+  Gtid_list_log_event *glev= NULL;
   const char *errormsg= NULL;
   IO_CACHE cache;
   File file = (File)-1;
@@ -780,6 +780,8 @@ gtid_find_binlog_file(slave_connection_s
       strmake(out_name, buf, FN_REFLEN);
       goto end;
     }
+    delete glev;
+    glev= NULL;
     list= list->next;
   }
 
@@ -789,6 +791,8 @@ gtid_find_binlog_file(slave_connection_s
     "have been purged.";
 
 end:
+  if (glev)
+    delete glev;
   if (file != (File)-1)
   {
     end_io_cache(&cache);



More information about the commits mailing list