List:Internals« Previous MessageNext Message »
From:kent Date:November 1 2005 10:24pm
Subject:bk commit into 5.1 tree (kent:1.1951)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kent. When kent does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1951 05/11/01 23:24:14 kent@stripped +3 -0
  Merge mysql.com:/Users/kent/mysql/bk/mysql-5.0-tmp
  into mysql.com:/Users/kent/mysql/bk/mysql-5.1

  sql/log_event.h
    1.118 05/11/01 23:24:10 kent@stripped +0 -0
    Auto merged

  sql/log_event.cc
    1.192 05/11/01 23:24:09 kent@stripped +0 -0
    Auto merged

  client/mysqlbinlog.cc
    1.117 05/11/01 23:24:08 kent@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kent
# Host:	c-7d4072d5.010-2112-6f72651.cust.bredbandsbolaget.se
# Root:	/Users/kent/mysql/bk/mysql-5.1/RESYNC

--- 1.191/sql/log_event.cc	2005-10-21 08:53:02 +02:00
+++ 1.192/sql/log_event.cc	2005-11-01 23:24:09 +01:00
@@ -882,15 +882,71 @@
   Log_event::print_header()
 */
 
-void Log_event::print_header(FILE* file)
+void Log_event::print_header(FILE* file, my_off_t hexdump_from)
 {
   char llbuff[22];
   fputc('#', file);
   print_timestamp(file);
   fprintf(file, " server id %d  end_log_pos %s ", server_id,
-	  llstr(log_pos,llbuff)); 
+	  llstr(log_pos,llbuff));
+
+  /* mysqlbinlog --hexdump */
+  if (hexdump_from)
+  {
+    fprintf(file, "\n");
+    uchar *ptr= (uchar*)temp_buf;
+    my_off_t size=
+      uint4korr(ptr + EVENT_LEN_OFFSET) - LOG_EVENT_MINIMAL_HEADER_LEN;
+    my_off_t i;
+
+    /* Header len * 4 >= header len * (2 chars + space + extra space) */
+    char *h, hex_string[LOG_EVENT_MINIMAL_HEADER_LEN*4]= {0};
+    char *c, char_string[16+1]= {0};
+
+    /* Common header of event */
+    fprintf(file, "# Position  Timestamp   Type   Master ID        "
+	    "Size      Master Pos    Flags \n");
+    fprintf(file, "# %8.8lx %02x %02x %02x %02x   %02x   "
+	    "%02x %02x %02x %02x   %02x %02x %02x %02x   "
+	    "%02x %02x %02x %02x   %02x %02x\n",
+	    hexdump_from, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4],
+	    ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], ptr[10], ptr[11],
+	    ptr[12], ptr[13], ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]);
+    ptr += LOG_EVENT_MINIMAL_HEADER_LEN;
+    hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN;
+
+    /* Rest of event (without common header) */
+    for (i= 0, c= char_string, h=hex_string;
+	 i < size;
+	 i++, ptr++)
+    {
+      my_snprintf(h, 4, "%02x ", *ptr);
+      h += 3;
+
+      *c++= my_isalnum(&my_charset_bin, *ptr) ? *ptr : '.';
+
+      if (i % 16 == 15)
+      {
+	fprintf(file, "# %8.8lx %-48.48s |%16s|\n",
+		hexdump_from + (i & 0xfffffff0), hex_string, char_string);
+	hex_string[0]= 0;
+	char_string[0]= 0;
+	c= char_string;
+	h= hex_string;
+      }
+      else if (i % 8 == 7) *h++ = ' ';
+    }
+    *c= '\0';
+
+    /* Non-full last line */
+    if (hex_string[0]) {
+      printf("# %8.8lx %-48.48s |%s|\n# ",
+	     hexdump_from + (i & 0xfffffff0), hex_string, char_string);
+    }
+  }
 }
 
+
 /*
   Log_event::print_timestamp()
 */
@@ -1374,6 +1430,7 @@
 
 #ifdef MYSQL_CLIENT
 void Query_log_event::print_query_header(FILE* file, bool short_form,
+					 my_off_t hexdump_from,
                                          LAST_EVENT_INFO* last_event_info)
 {
   // TODO: print the catalog ??
@@ -1383,7 +1440,7 @@
 
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\t%s\tthread_id=%lu\texec_time=%lu\terror_code=%d\n",
 	    get_type_str(), (ulong) thread_id, (ulong) exec_time, error_code);
   }
@@ -1504,10 +1561,10 @@
 }
 
 
-void Query_log_event::print(FILE* file, bool short_form,
+void Query_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
                             LAST_EVENT_INFO* last_event_info)
 {
-  print_query_header(file, short_form, last_event_info);
+  print_query_header(file, short_form, hexdump_from, last_event_info);
   my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
   fputs(";\n", file);
 }
@@ -1805,11 +1862,12 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Start_log_event_v3::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Start_log_event_v3::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			       LAST_EVENT_INFO* last_event_info)
 {
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tStart: binlog v %d, server v %s created ", binlog_version,
             server_version);
     print_timestamp(file);
@@ -2533,19 +2591,20 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Load_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Load_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			   LAST_EVENT_INFO* last_event_info)
 {
-  print(file, short_form, last_event_info, 0);
+  print(file, short_form, hexdump_from, last_event_info, 0);
 }
 
 
-void Load_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info,
-			   bool commented)
+void Load_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			   LAST_EVENT_INFO* last_event_info, bool commented)
 {
   DBUG_ENTER("Load_log_event::print");
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tQuery\tthread_id=%ld\texec_time=%ld\n",
 	    thread_id, exec_time);
   }
@@ -2950,13 +3009,14 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Rotate_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Rotate_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			     LAST_EVENT_INFO* last_event_info)
 {
   char buf[22];
 
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fprintf(file, "\tRotate to ");
   if (new_log_ident)
     my_fwrite(file, (byte*) new_log_ident, (uint)ident_len, 
@@ -3174,7 +3234,7 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Intvar_log_event::print(FILE* file, bool short_form,
+void Intvar_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
                              LAST_EVENT_INFO* last_event_info)
 {
   char llbuff[22];
@@ -3183,7 +3243,7 @@
 
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tIntvar\n");
   }
 
@@ -3264,12 +3324,13 @@
 
 
 #ifdef MYSQL_CLIENT
-void Rand_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Rand_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			   LAST_EVENT_INFO* last_event_info)
 {
   char llbuff[22],llbuff2[22];
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tRand\n");
   }
   fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n",
@@ -3334,14 +3395,15 @@
 
 
 #ifdef MYSQL_CLIENT
-void Xid_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Xid_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			  LAST_EVENT_INFO* last_event_info)
 {
   if (!short_form)
   {
     char buf[64];
     longlong10_to_str(xid, buf, 10);
 
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tXid = %s\n", buf);
     fflush(file);
   }
@@ -3532,11 +3594,12 @@
 */
 
 #ifdef MYSQL_CLIENT
-void User_var_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void User_var_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			       LAST_EVENT_INFO* last_event_info)
 {
   if (!short_form)
   {
-    print_header(file);
+    print_header(file, hexdump_from);
     fprintf(file, "\tUser_var\n");
   }
 
@@ -3707,11 +3770,12 @@
 
 #ifdef HAVE_REPLICATION
 #ifdef MYSQL_CLIENT
-void Unknown_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Unknown_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			      LAST_EVENT_INFO* last_event_info)
 {
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fputc('\n', file);
   fprintf(file, "# %s", "Unknown event\n");
 }
@@ -3778,12 +3842,13 @@
 
 
 #ifdef MYSQL_CLIENT
-void Slave_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Slave_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			    LAST_EVENT_INFO* last_event_info)
 {
   char llbuff[22];
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fputc('\n', file);
   fprintf(file, "\
 Slave: master_host: '%s'  master_port: %d  master_log: '%s'  master_pos: %s\n",
@@ -3863,12 +3928,13 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Stop_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_event_info)
+void Stop_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
+			   LAST_EVENT_INFO* last_event_info)
 {
   if (short_form)
     return;
 
-  print_header(file);
+  print_header(file, hexdump_from);
   fprintf(file, "\tStop\n");
   fflush(file);
 }
@@ -4042,19 +4108,20 @@
 */
 
 #ifdef MYSQL_CLIENT
-void Create_file_log_event::print(FILE* file, bool short_form, 
+void Create_file_log_event::print(FILE* file, bool short_form, my_off_t hexdump_from,
 				  LAST_EVENT_INFO* last_event_info, bool enable_local)
 {
   if (short_form)
   {
     if (enable_local && check_fname_outside_temp_buf())
-      Load_log_event::print(file, 1, last_event_info);
+      Load_log_event::print(file, 1, hexdump_from, last_event_info);
     return;
   }
 
   if (enable_local)
   {
-    Load_log_event::print(file, short_form, last_event_info, !check_fname_outside_temp_buf());
+    Load_log_event::print(file, short_form, hexdump_from, last_event_info, 
+			  !check_fname_outside_temp_buf());
     /* 
        That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
        SHOW BINLOG EVENTS we don't.
@@ -4067,9 +4134,10 @@
 
 
 void Create_file_log_event::print(FILE* file, bool short_form,
+				  my_off_t hexdump_from,
 				  LAST_EVENT_INFO* last_event_info)
 {
-  print(file,short_form,last_event_info,0);
+  print(file, short_form, hexdump_from, last_event_info, 0);
 }
 #endif /* MYSQL_CLIENT */
 
@@ -4230,11 +4298,12 @@
 
 #ifdef MYSQL_CLIENT  
 void Append_block_log_event::print(FILE* file, bool short_form,
+				   my_off_t hexdump_from,
 				   LAST_EVENT_INFO* last_event_info)
 {
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fputc('\n', file);
   fprintf(file, "#%s: file_id: %d  block_len: %d\n",
 	  get_type_str(), file_id, block_len);
@@ -4374,11 +4443,12 @@
 
 #ifdef MYSQL_CLIENT  
 void Delete_file_log_event::print(FILE* file, bool short_form,
+				  my_off_t hexdump_from,
 				  LAST_EVENT_INFO* last_event_info)
 {
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fputc('\n', file);
   fprintf(file, "#Delete_file: file_id=%u\n", file_id);
 }
@@ -4470,11 +4540,12 @@
 
 #ifdef MYSQL_CLIENT  
 void Execute_load_log_event::print(FILE* file, bool short_form,
+				   my_off_t hexdump_from,
 				   LAST_EVENT_INFO* last_event_info)
 {
   if (short_form)
     return;
-  print_header(file);
+  print_header(file, hexdump_from);
   fputc('\n', file);
   fprintf(file, "#Exec_load: file_id=%d\n",
 	  file_id);
@@ -4682,17 +4753,19 @@
 
 #ifdef MYSQL_CLIENT
 void Execute_load_query_log_event::print(FILE* file, bool short_form,
+					 my_off_t hexdump_from,
                                          LAST_EVENT_INFO* last_event_info)
 {
-  print(file, short_form, last_event_info, 0);
+  print(file, short_form, hexdump_from, last_event_info, 0);
 }
 
 
 void Execute_load_query_log_event::print(FILE* file, bool short_form,
+					 my_off_t hexdump_from,
                                          LAST_EVENT_INFO* last_event_info,
                                          const char *local_fname)
 {
-  print_query_header(file, short_form, last_event_info);
+  print_query_header(file, short_form, hexdump_from, last_event_info);
 
   if (local_fname)
   {

--- 1.117/sql/log_event.h	2005-09-30 00:12:07 +02:00
+++ 1.118/sql/log_event.h	2005-11-01 23:24:10 +01:00
@@ -1260,18 +1260,17 @@
 class Rotate_log_event: public Log_event
 {
 public:
+  enum {
+    DUP_NAME= 2 // if constructor should dup the string argument
+  };
   const char* new_log_ident;
   ulonglong pos;
   uint ident_len;
-  bool alloced;
+  uint flags;
 #ifndef MYSQL_CLIENT
   Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
-		   uint ident_len_arg = 0,
-		   ulonglong pos_arg = LOG_EVENT_OFFSET)
-    :Log_event(), new_log_ident(new_log_ident_arg),
-    pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
-			   (uint) strlen(new_log_ident_arg)), alloced(0)
-  {}
+		   uint ident_len_arg,
+		   ulonglong pos_arg, uint flags);
 #ifdef HAVE_REPLICATION
   void pack_info(Protocol* protocol);
   int exec_event(struct st_relay_log_info* rli);
@@ -1285,8 +1284,8 @@
                    const Format_description_log_event* description_event);
   ~Rotate_log_event()
   {
-    if (alloced)
-      my_free((gptr) new_log_ident, MYF(0));
+    if (flags & DUP_NAME)
+      my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
   }
   Log_event_type get_type_code() { return ROTATE_EVENT;}
   int get_data_size() { return  ident_len + ROTATE_HEADER_LEN;}

--- 1.116/client/mysqlbinlog.cc	2005-09-30 00:12:07 +02:00
+++ 1.117/client/mysqlbinlog.cc	2005-11-01 23:24:08 +01:00
@@ -1011,7 +1011,8 @@
 {
   char buf[128];
   LAST_EVENT_INFO last_event_info;
-  uint len, logname_len;
+  ulong len;
+  uint logname_len;
   NET* net;
   int error= 0;
   my_off_t old_off= start_position_mot;
@@ -1442,7 +1443,7 @@
     of transaction.
   */
   fprintf(result_file,
-          "# End of log file\nROLLBACK;\n"
+          "# End of log file\nROLLBACK /* added by mysqlbinlog */;\n"
           "/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n");
   if (disable_log_bin)
     fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");
Thread
bk commit into 5.1 tree (kent:1.1951)kent1 Nov