-----------------------------------------------------------------------
                              WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to change the used database
CREATION DATE..: Fri, 07 Aug 2009, 14:57
CREATED BY.....: Psergey
SUPERVISOR.....: Monty
LEAD ARCHITECT.: 
ARCH REVIEW....: 
IMPLEMENTOR....: 
1st CODE REVIEW: 
2nd CODE REVIEW: 
QA.............: 
COPIES TO......: 
CATEGORY.......: Server-Sprint
TASK ID........: 36 (http://askmonty.org/worklog/?tid=36)
VERSION........: Server-5.3
STATUS.........: Complete
PRIORITY.......: 60

DEPENDS ON.....:

DEPENDANT......:

DESCRIPTION:

Sometimes there is a need to take a binary log and apply it to a database with 
a different name than the original name of the database on binlog producer.

If one is using statement-based replication, he can achieve this by grepping
out "USE dbname" statements out of the output of mysqlbinlog(*).  With
row-based replication this is no longer possible, as database name is encoded
within the the BINLOG '....' statement.

This task is about adding an option to mysqlbinlog that would allow to change 
the names of used databases in both RBR and SBR events.

(*) this implies that all statements refer to tables in the current database,
doesn't catch updates made inside stored functions and so forth, but still
works for a practially-important subset of cases.


PROGRESS NOTES:

-=-=(Guest - Fri, 18 Jun 2010, 15:20)=-=-
Version updated.
--- /tmp/wklog.36.old.11335     2010-06-18 15:20:26.000000000 +0000
+++ /tmp/wklog.36.new.11335     2010-06-18 15:20:26.000000000 +0000
@@ -1 +1 @@
-Server-9.x
+Server-5.3

-=-=(Guest - Thu, 17 Jun 2010, 00:39)=-=-
Dependency deleted: 39 no longer depends on 36

-=-=(Guest - Sat, 07 Nov 2009, 22:43)=-=-
Category updated.
--- /tmp/wklog.36.old.9112      2009-11-07 22:43:50.000000000 +0200
+++ /tmp/wklog.36.new.9112      2009-11-07 22:43:50.000000000 +0200
@@ -1 +1 @@
-Server-RawIdeaBin
+Server-Sprint

-=-=(Guest - Sat, 07 Nov 2009, 22:43)=-=-
Status updated.
--- /tmp/wklog.36.old.9112      2009-11-07 22:43:50.000000000 +0200
+++ /tmp/wklog.36.new.9112      2009-11-07 22:43:50.000000000 +0200
@@ -1 +1 @@
-Un-Assigned
+Complete

-=-=(Bothorsen - Tue, 03 Nov 2009, 13:49)=-=-
More cleanup work done by Alexi, Bo and Sergey.

-=-=(Bothorsen - Tue, 03 Nov 2009, 13:49)=-=-
Sergey and Bo has been working on getting the patch ready, and Alexi has fixed some issues with the
patch.

-=-=(Bothorsen - Tue, 03 Nov 2009, 13:47)=-=-
Alexi has implemented a patch for this item.

-=-=(Guest - Tue, 15 Sep 2009, 18:04)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.19322     2009-09-15 18:04:49.000000000 +0300
+++ /tmp/wklog.36.new.19322     2009-09-15 18:04:49.000000000 +0300
@@ -191,7 +191,7 @@
 
 - In process_event() function add switch case for Load_log_event and
    add print_use_stmt() invocations where needed (according to the
-   events lis above), e.g.:
+  events list above), e.g.:
 
       Exit_status process_event(
         PRINT_EVENT_INFO *print_event_info,

-=-=(Guest - Tue, 15 Sep 2009, 15:53)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.13421     2009-09-15 15:53:31.000000000 +0300
+++ /tmp/wklog.36.new.13421     2009-09-15 15:53:31.000000000 +0300
@@ -150,10 +150,17 @@
 following events (see process_event() function):
 
 - Query_log_event
-- Execute_load_query_log_event
-- Create_file_log_event
-
-TODO. Needed to check this list requires carefully !!!
+- Load_log_event
+- Execute_load_query_log_event [ :public Query_log_event ]
+- Create_file_log_event        [ :public Load_log_event ]
+
+TODO. Needed to check this list carefully (not sure for Create_file_log_event)
+      Notes.
+      - In replication, only Query_log_event and Load_log_event uses
+        rpl_filter->get_rewrite_db();
+      - In mysqlbinlog (process_event), Execute_load_query_log_event
+        and Create_file_log_event are processed in separate switch
+        cases. And Load_log_event is processed in the default switch case. 
 
 Conditions for emiting use-statement:
 - LOG_EVENT_SUPPRESS_USE_F is OFF for the event
@@ -182,8 +189,9 @@
           */
       }
 
-- In process_event() function add print_use_stmt() invocations where
-  needed (according to the events lis above), e.g.:
+- In process_event() function add switch case for Load_log_event and
+   add print_use_stmt() invocations where needed (according to the
+   events lis above), e.g.:
 
       Exit_status process_event(
         PRINT_EVENT_INFO *print_event_info,
@@ -207,6 +215,11 @@
             }
           break;
         ...
+        case LOAD_EVENT:
+            print_use_stmt((Load_log_event*)ev, print_event_info);
+            break;
+        default:
+            ...
         }
         ...
       }

-=-=(Guest - Tue, 15 Sep 2009, 12:12)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.3961      2009-09-15 12:12:26.000000000 +0300
+++ /tmp/wklog.36.new.3961      2009-09-15 12:12:26.000000000 +0300
@@ -144,6 +144,8 @@
 3. Supporting rewrite-db for SBR events
 ---------------------------------------
 
+Limited to emiting USE <db_to> instead of USE <db_from>.
+
 USE statements can be emited by mysqlbinlog as a result of processing the
 following events (see process_event() function):
 

	------------------------------------------------------------

		-=-=(View All Progress Notes -> 20 total)=-=-
	http://askmonty.org/worklog/index.pl?tid=36&nolimit=1


-----------------------------------------------------------------------
WorkLog (v4.0.0)