List:Commits« Previous MessageNext Message »
From:Dao-Gang.Qu Date:August 18 2009 2:59pm
Subject:bzr commit into mysql-5.0-bugteam branch (Dao-Gang.Qu:2789) Bug#23894
View as plain text  
#At file:///home/daogangq/mysql/bzrwork/bug23890/mysql-5.0-bugteam/ based on revid:epotemkin@stripped

 2789 Dao-Gang.Qu@stripped	2009-08-18
      Bug #23894  	mysqlbinlog outputs SET INSERT_ID=n statements unnecesarily with --database
      
      mysqlbinlog --database=bar N-bin.000003 >003bar.txt
      will output all the SET INSERT_ID=n assignments in the binary log even if the database argument 
      'bar' isn't mentioned in the binary log. The COMMITS isn't associated with database in the 
      binary log, so the SET INSERT_ID=n assignments will be output in any situation.
      
      To fix the problem, we need record and update the using database from context. So that 
      the SET INSERT_ID=n assignments will be output in the following two cases:
      1. The database argument is consistent with the using database.
      2. The database argument is NULL.
     @ client/mysqlbinlog.cc
        Added database_using[] array to record and update the using database from context.

    modified:
      client/mysqlbinlog.cc
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2009-06-29 13:17:01 +0000
+++ b/client/mysqlbinlog.cc	2009-08-18 14:59:04 +0000
@@ -42,9 +42,11 @@
 
 
 #define CLIENT_CAPABILITIES	(CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
+#define DATABASE_NAME_LENGTH    256
 
 char server_version[SERVER_VERSION_LENGTH];
 ulong server_id = 0;
+char database_using[DATABASE_NAME_LENGTH];
 
 // needed by net_serv.c
 ulong bytes_sent = 0L, bytes_received = 0L;
@@ -557,6 +559,8 @@ int process_event(PRINT_EVENT_INFO *prin
 
     switch (ev_type) {
     case QUERY_EVENT:
+      /* Update the using database name */
+      strcpy(database_using, ((Query_log_event*)ev)->db);
       if (check_database(((Query_log_event*)ev)->db))
         goto end;
       ev->print(result_file, print_event_info);
@@ -662,6 +666,15 @@ Create_file event for file_id: %u\n",exv
 Begin_load_query event for file_id: %u\n", exlq->file_id);
       break;
     }
+    case INTVAR_EVENT:
+    {
+      /* If the database argument is not NULL and inconsistent with 
+         the using database, go to end. Else, print the event info */
+      if (check_database(database_using))
+        goto end;
+      ev->print(result_file, print_event_info);
+      break;
+    }
     default:
       ev->print(result_file, print_event_info);
     }


Attachment: [text/bzr-bundle] bzr/dao-gang.qu@sun.com-20090818145904-i5m1rza3jbqfcdfm.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (Dao-Gang.Qu:2789) Bug#23894Dao-Gang.Qu18 Aug
  • Re: bzr commit into mysql-5.0-bugteam branch (Dao-Gang.Qu:2789)Bug#23894He Zhenxing31 Aug