developers
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
October 2009
- 18 participants
- 235 discussions
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to change the used database (36)
by worklog-noreply@askmonty.org 04 Oct '09
by worklog-noreply@askmonty.org 04 Oct '09
04 Oct '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to change the used database
CREATION DATE..: Fri, 07 Aug 2009, 14:57
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 36 (http://askmonty.org/worklog/?tid=36)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Sun, 04 Oct 2009, 15:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.13581 2009-10-04 15:31:45.000000000 +0300
+++ /tmp/wklog.36.new.13581 2009-10-04 15:31:45.000000000 +0300
@@ -1 +1 @@
-horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
+orkut com http://szoteil.200u.com/https-www.orkut.com.html https www.orkut.comorkut.coom http://szoteil.200u.com/viaudios.sys-address-f809901.html viaudios.sys address f809901hallmark.com signup http://szoteil.200u.com/espn.coom.html espn.coomfreddyandeddy.coom http://szoteil.200u.com/163-wwww.orkut.html 163 wwww.orkutimage orkut http://szoteil.200u.com/www.orkut.com.py.html www.orkut.com.pyhttp wwww.orkut.com.br http://szoteil.200u.com/map.html mapinnocenthigh.copm http://szoteil.200u.com/www.hotmail.copm.html www.hotmail.copmimageorkut http://szoteil.200u.com/sempre-amigos-cartao.orkut.scr-trojan.html sempre amigos cartao.orkut.scr trojanorkut.comn http://szoteil.200u.com/www.mixxer.com-images-devices.html www.mixxer.com images devicesst. augustine surf report http://szoteil.200u.com/www.orkut.comk.br.html www.orkut.comk.br
-=-=(Guest - Sun, 04 Oct 2009, 14:51)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.12044 2009-10-04 14:51:59.000000000 +0300
+++ /tmp/wklog.36.new.12044 2009-10-04 14:51:59.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
-=-=(Knielsen - Sat, 03 Oct 2009, 08:34)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.5353 2009-10-03 08:34:43.000000000 +0300
+++ /tmp/wklog.36.new.5353 2009-10-03 08:34:43.000000000 +0300
@@ -1 +1,77 @@
-G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
+Context
+-------
+(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
+overview)
+At the moment, the server has a replication slave option
+
+ --replicate-rewrite-db="from->to"
+
+the option affects
+- Table_map_log_event (all RBR events)
+- Load_log_event (LOAD DATA)
+- Query_log_event (SBR-based updates, with the usual assumption that the
+ statement refers to tables in current database, so that changing the current
+ database will make the statement to work on a table in a different database).
+
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
+
+What we could do
+----------------
+
+Option1: make mysqlbinlog accept --replicate-rewrite-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
+same extent as replication slave would process --replicate-rewrite-db option.
+
+
+Option2: Add database-agnostic RBR events and --strip-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Right now RBR events require a databasename. It is not possible to have RBR
+event stream that won't mention which database the events are for. When I
+tried to use debugger and specify empty database name, attempt to apply the
+binlog resulted in this error:
+
+090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
+opening tables,
+
+We could do as follows:
+- Make the server interpret empty database name in RBR event (i.e. in a
+ Table_map_log_event) as "use current database". Binlog slave thread
+ probably should not allow such events as it doesn't have a natural current
+ database.
+- Add a mysqlbinlog --strip-db option that would
+ = not produce any "USE dbname" statements
+ = change databasename for all RBR events to be empty
+
+That way, mysqlbinlog output will be database-agnostic and apply to the
+current database.
+(this will have the usual limitations that we assume that all statements in
+the binlog refer to the current database).
+
+Option3: Enhance database rewrite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If there is a need to support database change for statements that use
+dbname.tablename notation and are replicated as statements (i.e. are DDL
+statements and/or DML statements that are binlogged as statements),
+then that could be supported as follows:
+
+- Make the server's parser recognize special form of comments
+
+ /* !database-alias(oldname,newname) */
+
+ and save the mapping somewhere
+
+- Put the hooks in table open and name resolution code to use the saved
+ mapping.
+
+
+Once we've done the above, it will be easy to perform a complete,
+no-compromise or restrictions database name change in binary log.
+
+It will be possible to do the rewrites either on the slave (
+--replicate-rewrite-db will work for all kinds of statements), or in
+mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
+parse the statement).
+
-=-=(Guest - Sat, 03 Oct 2009, 02:27)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.23366 2009-10-03 02:27:45.000000000 +0300
+++ /tmp/wklog.36.new.23366 2009-10-03 02:27:45.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
-=-=(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):
-=-=(Guest - Tue, 15 Sep 2009, 12:08)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.3794 2009-09-15 12:08:54.000000000 +0300
+++ /tmp/wklog.36.new.3794 2009-09-15 12:08:54.000000000 +0300
@@ -1 +1,229 @@
+Content
+-------
+1. Adding rewrite-db option
+2. Supporting rewrite-db option for RBR events
+3. Supporting rewrite-db option for SBR events
+ (Limited to affecting only USE statements)
+4. Current status
+
+1. Adding rewrite-db option
+---------------------------
+
+1.1. Syntax:
+ --rewrite-db='db_from->db_to'
+
+1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
+
+1.3. In mysqlbinlog.cc:
+
+- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
+- Add Rpl_filter object to mysqlbinlog.cc
+
+ Rpl_filter* binlog_filter;
+
+- Add corresponding switch case to get_one_option():
+
+ case OPT_REWRITE_DB:
+ <extract db-from and db-to strings>
+ binlog_filter->add_db_rewrite(db_from, db_to);
+ break;
+ .
+Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
+additional changes are required:
+
+- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
+ uses sql_alloc() which is THD dependent. These are to be modified
+ as follows:
+
+ #ifdef MYSQL_CLIENT
+ extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
+ #endif
+
+ class Sql_alloc
+ { ...
+ static void *operator new(size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ static void *operator new[](size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ ...
+ }
+
+- In rpl_filter.cc:
+
+ Rpl_filter::Rpl_filter() :
+ ...
+ {
+ #ifdef MYSQL_CLIENT
+ init_alloc_root(&sql_list_client_mem_root, ...);
+ #endif
+ ...
+ }
+
+ Rpl_filter::~Rpl_filter()
+ { ...
+ #ifdef MYSQL_CLIENT
+ free_root(&sql_list_client_mem_root, ...);
+ #endif
+ }
+
+2. Supporting rewrite-db for RBR events
+---------------------------------------
+
+In binlog, each row operation event is preceded by Table map event(s) which maps
+table id(s) to database and table names. So, it's enough to support rewriting
+database name in a Table map.
+
+2.1. Add rewrite_db() member to Table_map_log_event:
+
+ int Table_map_log_event::rewrite_db(
+ const char* new_db,
+ size_t new_db_len,
+ const Format_description_log_event* desc)
+ {
+ /* 1. In temp_buf member (possibly reallocating it) rewrite
+ event length, db length, and db parts
+ 2. Change m_dblen and m_dbnam members
+ */
+ }
+
+Comment. This function assumes that temp_buf member contains Table map
+binlog representaion (temp_buf is used for creating corresponding
+BINLOG statement).
+
+2.2. In mysqlbinlog modify corresponding switch case in the
+process_event() function:
+
+ Exit_status process_event(
+ PRINT_EVENT_INFO *print_event_info,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ ...
+ case TABLE_MAP_EVENT:
+ {
+ Table_map_log_event *map= ((Table_map_log_event *)ev);
+ if (shall_skip_database(map->get_db_name()))
+ { ...
+ }
+ // WL36
+ size_t new_len= 0;
+ const char* new_db= binlog_filter->get_rewrite_db(
+ map->get_db_name(), &new_len);
+ if (new_len && map->rewrite_db(new_db, new_len,
+ glob_description_event))
+ { error("Could not rewrite database name");
+ goto err;
+ }
+ }
+ case WRITE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT:
+ ...
+ }
+ ...
+ }
+
+Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
+a (db_from, db_to) pair, this function returns pointer to db_to and
+sets len = db_to length; otherwise, it returns db_from and does not
+change len value.
+
+3. Supporting rewrite-db for SBR events
+---------------------------------------
+
+USE statements can be emited by mysqlbinlog as a result of processing the
+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 !!!
+
+Conditions for emiting use-statement:
+- LOG_EVENT_SUPPRESS_USE_F is OFF for the event
+ (e.g. it is ON for 'create database' statement)
+- event's db name differs from db_name in PRINT_EVENT_INFO
+ (PRINT_EVENT_INFO keeps db name of the last issued USE statement;
+ initially, this db name is empty).
+
+3.1. In mysqlbinlog.cc
+
+- Add the following function:
+
+ void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
+ {
+ if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
+ return;
+ /*
+ - For events listed above get db_from = event->db;
+ - If db_from is the same as pinfo->db then return;
+ - If there is rewrite-db rule db_from->db_to,
+ set db = db_to. Else set db = db_from;
+ - Print "use <db>" to mysqlbinlog output
+ - Set pinfo->db = db_from
+ (this suppresses emiting use-statements by corresponding
+ log_event's print-function)
+ */
+ }
+
+- In process_event() function 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,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ case QUERY_EVENT:
+ if (shall_skip_database(((Query_log_event*)ev)->db))
+ goto end;
+ if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ {
+ // Possibly in case of rewite-db rule for ev->db
+ // a warning should be emited here (see note below)
+ ... write_event_header_and_base64(ev, ...) ...
+ }
+ else
+ {
+ print_use_stmt((Query_log_event*)ev, print_event_info);
+ ev->print(result_file, print_event_info);
+ }
+ break;
+ ...
+ }
+ ...
+ }
+
+Note. write_event_header_and_base64() does not print use-statement. It
+produces BINLOG statement using ev->temp_buf content (i.e. the binary
+log representation of the event). We don't rewrite temp_buf here with
+db_to name (as we do it for Table map event) - this implies the
+limitation 3 mentioned above.
+Question: Is supporting of rewite_db + --base64-output really needed
+currently?
+
+4. Current status
+-----------------
+
+The outlined design (implemented for mysql-5.1.37) is tested for
+simple test-cases.
+
+TODO. 1. Check list of events which can emit use-statement.
+ 2. Supporting of rewite_db + --base64-output ?
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9711 2009-09-14 11:51:43.000000000 +0300
+++ /tmp/wklog.36.new.9711 2009-09-14 11:51:43.000000000 +0300
@@ -1 +1 @@
-Pay no attention: just check for having access
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9678 2009-09-14 11:51:28.000000000 +0300
+++ /tmp/wklog.36.new.9678 2009-09-14 11:51:28.000000000 +0300
@@ -1 +1 @@
-
+Pay no attention: just check for having access
------------------------------------------------------------
-=-=(View All Progress Notes, 17 total)=-=-
http://askmonty.org/worklog/index.pl?tid=36&nolimit=1
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.
HIGH-LEVEL SPECIFICATION:
orkut com http://szoteil.200u.com/https-www.orkut.com.html https www.orkut.comorkut.coom http://szoteil.200u.com/viaudios.sys-address-f809901.html viaudios.sys address f809901hallmark.com signup http://szoteil.200u.com/espn.coom.html espn.coomfreddyandeddy.coom http://szoteil.200u.com/163-wwww.orkut.html 163 wwww.orkutimage orkut http://szoteil.200u.com/www.orkut.com.py.html www.orkut.com.pyhttp wwww.orkut.com.br http://szoteil.200u.com/map.html mapinnocenthigh.copm http://szoteil.200u.com/www.hotmail.copm.html www.hotmail.copmimageorkut http://szoteil.200u.com/sempre-amigos-cartao.orkut.scr-trojan.html sempre amigos cartao.orkut.scr trojanorkut.comn http://szoteil.200u.com/www.mixxer.com-images-devices.html www.mixxer.com images devicesst. augustine surf report http://szoteil.200u.com/www.orkut.comk.br.html www.orkut.comk.br
LOW-LEVEL DESIGN:
Content
-------
1. Adding rewrite-db option
2. Supporting rewrite-db option for RBR events
3. Supporting rewrite-db option for SBR events
(Limited to affecting only USE statements)
4. Current status
1. Adding rewrite-db option
---------------------------
1.1. Syntax:
--rewrite-db='db_from->db_to'
1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
1.3. In mysqlbinlog.cc:
- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
- Add Rpl_filter object to mysqlbinlog.cc
Rpl_filter* binlog_filter;
- Add corresponding switch case to get_one_option():
case OPT_REWRITE_DB:
<extract db-from and db-to strings>
binlog_filter->add_db_rewrite(db_from, db_to);
break;
.
Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
additional changes are required:
- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
uses sql_alloc() which is THD dependent. These are to be modified
as follows:
#ifdef MYSQL_CLIENT
extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
#endif
class Sql_alloc
{ ...
static void *operator new(size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
static void *operator new[](size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
...
}
- In rpl_filter.cc:
Rpl_filter::Rpl_filter() :
...
{
#ifdef MYSQL_CLIENT
init_alloc_root(&sql_list_client_mem_root, ...);
#endif
...
}
Rpl_filter::~Rpl_filter()
{ ...
#ifdef MYSQL_CLIENT
free_root(&sql_list_client_mem_root, ...);
#endif
}
2. Supporting rewrite-db for RBR events
---------------------------------------
In binlog, each row operation event is preceded by Table map event(s) which maps
table id(s) to database and table names. So, it's enough to support rewriting
database name in a Table map.
2.1. Add rewrite_db() member to Table_map_log_event:
int Table_map_log_event::rewrite_db(
const char* new_db,
size_t new_db_len,
const Format_description_log_event* desc)
{
/* 1. In temp_buf member (possibly reallocating it) rewrite
event length, db length, and db parts
2. Change m_dblen and m_dbnam members
*/
}
Comment. This function assumes that temp_buf member contains Table map
binlog representaion (temp_buf is used for creating corresponding
BINLOG statement).
2.2. In mysqlbinlog modify corresponding switch case in the
process_event() function:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
...
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name()))
{ ...
}
// WL36
size_t new_len= 0;
const char* new_db= binlog_filter->get_rewrite_db(
map->get_db_name(), &new_len);
if (new_len && map->rewrite_db(new_db, new_len,
glob_description_event))
{ error("Could not rewrite database name");
goto err;
}
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
...
}
...
}
Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
a (db_from, db_to) pair, this function returns pointer to db_to and
sets len = db_to length; otherwise, it returns db_from and does not
change len value.
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):
- Query_log_event
- 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
(e.g. it is ON for 'create database' statement)
- event's db name differs from db_name in PRINT_EVENT_INFO
(PRINT_EVENT_INFO keeps db name of the last issued USE statement;
initially, this db name is empty).
3.1. In mysqlbinlog.cc
- Add the following function:
void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
{
if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
return;
/*
- For events listed above get db_from = event->db;
- If db_from is the same as pinfo->db then return;
- If there is rewrite-db rule db_from->db_to,
set db = db_to. Else set db = db_from;
- Print "use <db>" to mysqlbinlog output
- Set pinfo->db = db_from
(this suppresses emiting use-statements by corresponding
log_event's print-function)
*/
}
- In process_event() function add switch case for Load_log_event and
add print_use_stmt() invocations where needed (according to the
events list above), e.g.:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
case QUERY_EVENT:
if (shall_skip_database(((Query_log_event*)ev)->db))
goto end;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
// Possibly in case of rewite-db rule for ev->db
// a warning should be emited here (see note below)
... write_event_header_and_base64(ev, ...) ...
}
else
{
print_use_stmt((Query_log_event*)ev, print_event_info);
ev->print(result_file, print_event_info);
}
break;
...
case LOAD_EVENT:
print_use_stmt((Load_log_event*)ev, print_event_info);
break;
default:
...
}
...
}
Note. write_event_header_and_base64() does not print use-statement. It
produces BINLOG statement using ev->temp_buf content (i.e. the binary
log representation of the event). We don't rewrite temp_buf here with
db_to name (as we do it for Table map event) - this implies the
limitation 3 mentioned above.
Question: Is supporting of rewite_db + --base64-output really needed
currently?
4. Current status
-----------------
The outlined design (implemented for mysql-5.1.37) is tested for
simple test-cases.
TODO. 1. Check list of events which can emit use-statement.
2. Supporting of rewite_db + --base64-output ?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to change the used database (36)
by worklog-noreply@askmonty.org 04 Oct '09
by worklog-noreply@askmonty.org 04 Oct '09
04 Oct '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to change the used database
CREATION DATE..: Fri, 07 Aug 2009, 14:57
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 36 (http://askmonty.org/worklog/?tid=36)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Sun, 04 Oct 2009, 15:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.13581 2009-10-04 15:31:45.000000000 +0300
+++ /tmp/wklog.36.new.13581 2009-10-04 15:31:45.000000000 +0300
@@ -1 +1 @@
-horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
+orkut com http://szoteil.200u.com/https-www.orkut.com.html https www.orkut.comorkut.coom http://szoteil.200u.com/viaudios.sys-address-f809901.html viaudios.sys address f809901hallmark.com signup http://szoteil.200u.com/espn.coom.html espn.coomfreddyandeddy.coom http://szoteil.200u.com/163-wwww.orkut.html 163 wwww.orkutimage orkut http://szoteil.200u.com/www.orkut.com.py.html www.orkut.com.pyhttp wwww.orkut.com.br http://szoteil.200u.com/map.html mapinnocenthigh.copm http://szoteil.200u.com/www.hotmail.copm.html www.hotmail.copmimageorkut http://szoteil.200u.com/sempre-amigos-cartao.orkut.scr-trojan.html sempre amigos cartao.orkut.scr trojanorkut.comn http://szoteil.200u.com/www.mixxer.com-images-devices.html www.mixxer.com images devicesst. augustine surf report http://szoteil.200u.com/www.orkut.comk.br.html www.orkut.comk.br
-=-=(Guest - Sun, 04 Oct 2009, 14:51)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.12044 2009-10-04 14:51:59.000000000 +0300
+++ /tmp/wklog.36.new.12044 2009-10-04 14:51:59.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
-=-=(Knielsen - Sat, 03 Oct 2009, 08:34)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.5353 2009-10-03 08:34:43.000000000 +0300
+++ /tmp/wklog.36.new.5353 2009-10-03 08:34:43.000000000 +0300
@@ -1 +1,77 @@
-G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
+Context
+-------
+(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
+overview)
+At the moment, the server has a replication slave option
+
+ --replicate-rewrite-db="from->to"
+
+the option affects
+- Table_map_log_event (all RBR events)
+- Load_log_event (LOAD DATA)
+- Query_log_event (SBR-based updates, with the usual assumption that the
+ statement refers to tables in current database, so that changing the current
+ database will make the statement to work on a table in a different database).
+
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
+
+What we could do
+----------------
+
+Option1: make mysqlbinlog accept --replicate-rewrite-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
+same extent as replication slave would process --replicate-rewrite-db option.
+
+
+Option2: Add database-agnostic RBR events and --strip-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Right now RBR events require a databasename. It is not possible to have RBR
+event stream that won't mention which database the events are for. When I
+tried to use debugger and specify empty database name, attempt to apply the
+binlog resulted in this error:
+
+090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
+opening tables,
+
+We could do as follows:
+- Make the server interpret empty database name in RBR event (i.e. in a
+ Table_map_log_event) as "use current database". Binlog slave thread
+ probably should not allow such events as it doesn't have a natural current
+ database.
+- Add a mysqlbinlog --strip-db option that would
+ = not produce any "USE dbname" statements
+ = change databasename for all RBR events to be empty
+
+That way, mysqlbinlog output will be database-agnostic and apply to the
+current database.
+(this will have the usual limitations that we assume that all statements in
+the binlog refer to the current database).
+
+Option3: Enhance database rewrite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If there is a need to support database change for statements that use
+dbname.tablename notation and are replicated as statements (i.e. are DDL
+statements and/or DML statements that are binlogged as statements),
+then that could be supported as follows:
+
+- Make the server's parser recognize special form of comments
+
+ /* !database-alias(oldname,newname) */
+
+ and save the mapping somewhere
+
+- Put the hooks in table open and name resolution code to use the saved
+ mapping.
+
+
+Once we've done the above, it will be easy to perform a complete,
+no-compromise or restrictions database name change in binary log.
+
+It will be possible to do the rewrites either on the slave (
+--replicate-rewrite-db will work for all kinds of statements), or in
+mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
+parse the statement).
+
-=-=(Guest - Sat, 03 Oct 2009, 02:27)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.23366 2009-10-03 02:27:45.000000000 +0300
+++ /tmp/wklog.36.new.23366 2009-10-03 02:27:45.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
-=-=(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):
-=-=(Guest - Tue, 15 Sep 2009, 12:08)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.3794 2009-09-15 12:08:54.000000000 +0300
+++ /tmp/wklog.36.new.3794 2009-09-15 12:08:54.000000000 +0300
@@ -1 +1,229 @@
+Content
+-------
+1. Adding rewrite-db option
+2. Supporting rewrite-db option for RBR events
+3. Supporting rewrite-db option for SBR events
+ (Limited to affecting only USE statements)
+4. Current status
+
+1. Adding rewrite-db option
+---------------------------
+
+1.1. Syntax:
+ --rewrite-db='db_from->db_to'
+
+1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
+
+1.3. In mysqlbinlog.cc:
+
+- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
+- Add Rpl_filter object to mysqlbinlog.cc
+
+ Rpl_filter* binlog_filter;
+
+- Add corresponding switch case to get_one_option():
+
+ case OPT_REWRITE_DB:
+ <extract db-from and db-to strings>
+ binlog_filter->add_db_rewrite(db_from, db_to);
+ break;
+ .
+Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
+additional changes are required:
+
+- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
+ uses sql_alloc() which is THD dependent. These are to be modified
+ as follows:
+
+ #ifdef MYSQL_CLIENT
+ extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
+ #endif
+
+ class Sql_alloc
+ { ...
+ static void *operator new(size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ static void *operator new[](size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ ...
+ }
+
+- In rpl_filter.cc:
+
+ Rpl_filter::Rpl_filter() :
+ ...
+ {
+ #ifdef MYSQL_CLIENT
+ init_alloc_root(&sql_list_client_mem_root, ...);
+ #endif
+ ...
+ }
+
+ Rpl_filter::~Rpl_filter()
+ { ...
+ #ifdef MYSQL_CLIENT
+ free_root(&sql_list_client_mem_root, ...);
+ #endif
+ }
+
+2. Supporting rewrite-db for RBR events
+---------------------------------------
+
+In binlog, each row operation event is preceded by Table map event(s) which maps
+table id(s) to database and table names. So, it's enough to support rewriting
+database name in a Table map.
+
+2.1. Add rewrite_db() member to Table_map_log_event:
+
+ int Table_map_log_event::rewrite_db(
+ const char* new_db,
+ size_t new_db_len,
+ const Format_description_log_event* desc)
+ {
+ /* 1. In temp_buf member (possibly reallocating it) rewrite
+ event length, db length, and db parts
+ 2. Change m_dblen and m_dbnam members
+ */
+ }
+
+Comment. This function assumes that temp_buf member contains Table map
+binlog representaion (temp_buf is used for creating corresponding
+BINLOG statement).
+
+2.2. In mysqlbinlog modify corresponding switch case in the
+process_event() function:
+
+ Exit_status process_event(
+ PRINT_EVENT_INFO *print_event_info,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ ...
+ case TABLE_MAP_EVENT:
+ {
+ Table_map_log_event *map= ((Table_map_log_event *)ev);
+ if (shall_skip_database(map->get_db_name()))
+ { ...
+ }
+ // WL36
+ size_t new_len= 0;
+ const char* new_db= binlog_filter->get_rewrite_db(
+ map->get_db_name(), &new_len);
+ if (new_len && map->rewrite_db(new_db, new_len,
+ glob_description_event))
+ { error("Could not rewrite database name");
+ goto err;
+ }
+ }
+ case WRITE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT:
+ ...
+ }
+ ...
+ }
+
+Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
+a (db_from, db_to) pair, this function returns pointer to db_to and
+sets len = db_to length; otherwise, it returns db_from and does not
+change len value.
+
+3. Supporting rewrite-db for SBR events
+---------------------------------------
+
+USE statements can be emited by mysqlbinlog as a result of processing the
+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 !!!
+
+Conditions for emiting use-statement:
+- LOG_EVENT_SUPPRESS_USE_F is OFF for the event
+ (e.g. it is ON for 'create database' statement)
+- event's db name differs from db_name in PRINT_EVENT_INFO
+ (PRINT_EVENT_INFO keeps db name of the last issued USE statement;
+ initially, this db name is empty).
+
+3.1. In mysqlbinlog.cc
+
+- Add the following function:
+
+ void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
+ {
+ if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
+ return;
+ /*
+ - For events listed above get db_from = event->db;
+ - If db_from is the same as pinfo->db then return;
+ - If there is rewrite-db rule db_from->db_to,
+ set db = db_to. Else set db = db_from;
+ - Print "use <db>" to mysqlbinlog output
+ - Set pinfo->db = db_from
+ (this suppresses emiting use-statements by corresponding
+ log_event's print-function)
+ */
+ }
+
+- In process_event() function 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,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ case QUERY_EVENT:
+ if (shall_skip_database(((Query_log_event*)ev)->db))
+ goto end;
+ if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ {
+ // Possibly in case of rewite-db rule for ev->db
+ // a warning should be emited here (see note below)
+ ... write_event_header_and_base64(ev, ...) ...
+ }
+ else
+ {
+ print_use_stmt((Query_log_event*)ev, print_event_info);
+ ev->print(result_file, print_event_info);
+ }
+ break;
+ ...
+ }
+ ...
+ }
+
+Note. write_event_header_and_base64() does not print use-statement. It
+produces BINLOG statement using ev->temp_buf content (i.e. the binary
+log representation of the event). We don't rewrite temp_buf here with
+db_to name (as we do it for Table map event) - this implies the
+limitation 3 mentioned above.
+Question: Is supporting of rewite_db + --base64-output really needed
+currently?
+
+4. Current status
+-----------------
+
+The outlined design (implemented for mysql-5.1.37) is tested for
+simple test-cases.
+
+TODO. 1. Check list of events which can emit use-statement.
+ 2. Supporting of rewite_db + --base64-output ?
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9711 2009-09-14 11:51:43.000000000 +0300
+++ /tmp/wklog.36.new.9711 2009-09-14 11:51:43.000000000 +0300
@@ -1 +1 @@
-Pay no attention: just check for having access
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9678 2009-09-14 11:51:28.000000000 +0300
+++ /tmp/wklog.36.new.9678 2009-09-14 11:51:28.000000000 +0300
@@ -1 +1 @@
-
+Pay no attention: just check for having access
------------------------------------------------------------
-=-=(View All Progress Notes, 17 total)=-=-
http://askmonty.org/worklog/index.pl?tid=36&nolimit=1
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.
HIGH-LEVEL SPECIFICATION:
orkut com http://szoteil.200u.com/https-www.orkut.com.html https www.orkut.comorkut.coom http://szoteil.200u.com/viaudios.sys-address-f809901.html viaudios.sys address f809901hallmark.com signup http://szoteil.200u.com/espn.coom.html espn.coomfreddyandeddy.coom http://szoteil.200u.com/163-wwww.orkut.html 163 wwww.orkutimage orkut http://szoteil.200u.com/www.orkut.com.py.html www.orkut.com.pyhttp wwww.orkut.com.br http://szoteil.200u.com/map.html mapinnocenthigh.copm http://szoteil.200u.com/www.hotmail.copm.html www.hotmail.copmimageorkut http://szoteil.200u.com/sempre-amigos-cartao.orkut.scr-trojan.html sempre amigos cartao.orkut.scr trojanorkut.comn http://szoteil.200u.com/www.mixxer.com-images-devices.html www.mixxer.com images devicesst. augustine surf report http://szoteil.200u.com/www.orkut.comk.br.html www.orkut.comk.br
LOW-LEVEL DESIGN:
Content
-------
1. Adding rewrite-db option
2. Supporting rewrite-db option for RBR events
3. Supporting rewrite-db option for SBR events
(Limited to affecting only USE statements)
4. Current status
1. Adding rewrite-db option
---------------------------
1.1. Syntax:
--rewrite-db='db_from->db_to'
1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
1.3. In mysqlbinlog.cc:
- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
- Add Rpl_filter object to mysqlbinlog.cc
Rpl_filter* binlog_filter;
- Add corresponding switch case to get_one_option():
case OPT_REWRITE_DB:
<extract db-from and db-to strings>
binlog_filter->add_db_rewrite(db_from, db_to);
break;
.
Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
additional changes are required:
- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
uses sql_alloc() which is THD dependent. These are to be modified
as follows:
#ifdef MYSQL_CLIENT
extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
#endif
class Sql_alloc
{ ...
static void *operator new(size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
static void *operator new[](size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
...
}
- In rpl_filter.cc:
Rpl_filter::Rpl_filter() :
...
{
#ifdef MYSQL_CLIENT
init_alloc_root(&sql_list_client_mem_root, ...);
#endif
...
}
Rpl_filter::~Rpl_filter()
{ ...
#ifdef MYSQL_CLIENT
free_root(&sql_list_client_mem_root, ...);
#endif
}
2. Supporting rewrite-db for RBR events
---------------------------------------
In binlog, each row operation event is preceded by Table map event(s) which maps
table id(s) to database and table names. So, it's enough to support rewriting
database name in a Table map.
2.1. Add rewrite_db() member to Table_map_log_event:
int Table_map_log_event::rewrite_db(
const char* new_db,
size_t new_db_len,
const Format_description_log_event* desc)
{
/* 1. In temp_buf member (possibly reallocating it) rewrite
event length, db length, and db parts
2. Change m_dblen and m_dbnam members
*/
}
Comment. This function assumes that temp_buf member contains Table map
binlog representaion (temp_buf is used for creating corresponding
BINLOG statement).
2.2. In mysqlbinlog modify corresponding switch case in the
process_event() function:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
...
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name()))
{ ...
}
// WL36
size_t new_len= 0;
const char* new_db= binlog_filter->get_rewrite_db(
map->get_db_name(), &new_len);
if (new_len && map->rewrite_db(new_db, new_len,
glob_description_event))
{ error("Could not rewrite database name");
goto err;
}
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
...
}
...
}
Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
a (db_from, db_to) pair, this function returns pointer to db_to and
sets len = db_to length; otherwise, it returns db_from and does not
change len value.
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):
- Query_log_event
- 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
(e.g. it is ON for 'create database' statement)
- event's db name differs from db_name in PRINT_EVENT_INFO
(PRINT_EVENT_INFO keeps db name of the last issued USE statement;
initially, this db name is empty).
3.1. In mysqlbinlog.cc
- Add the following function:
void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
{
if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
return;
/*
- For events listed above get db_from = event->db;
- If db_from is the same as pinfo->db then return;
- If there is rewrite-db rule db_from->db_to,
set db = db_to. Else set db = db_from;
- Print "use <db>" to mysqlbinlog output
- Set pinfo->db = db_from
(this suppresses emiting use-statements by corresponding
log_event's print-function)
*/
}
- In process_event() function add switch case for Load_log_event and
add print_use_stmt() invocations where needed (according to the
events list above), e.g.:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
case QUERY_EVENT:
if (shall_skip_database(((Query_log_event*)ev)->db))
goto end;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
// Possibly in case of rewite-db rule for ev->db
// a warning should be emited here (see note below)
... write_event_header_and_base64(ev, ...) ...
}
else
{
print_use_stmt((Query_log_event*)ev, print_event_info);
ev->print(result_file, print_event_info);
}
break;
...
case LOAD_EVENT:
print_use_stmt((Load_log_event*)ev, print_event_info);
break;
default:
...
}
...
}
Note. write_event_header_and_base64() does not print use-statement. It
produces BINLOG statement using ev->temp_buf content (i.e. the binary
log representation of the event). We don't rewrite temp_buf here with
db_to name (as we do it for Table map event) - this implies the
limitation 3 mentioned above.
Question: Is supporting of rewite_db + --base64-output really needed
currently?
4. Current status
-----------------
The outlined design (implemented for mysql-5.1.37) is tested for
simple test-cases.
TODO. 1. Check list of events which can emit use-statement.
2. Supporting of rewite_db + --base64-output ?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to change the used database (36)
by worklog-noreply@askmonty.org 04 Oct '09
by worklog-noreply@askmonty.org 04 Oct '09
04 Oct '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to change the used database
CREATION DATE..: Fri, 07 Aug 2009, 14:57
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 36 (http://askmonty.org/worklog/?tid=36)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Sun, 04 Oct 2009, 14:51)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.12044 2009-10-04 14:51:59.000000000 +0300
+++ /tmp/wklog.36.new.12044 2009-10-04 14:51:59.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
-=-=(Knielsen - Sat, 03 Oct 2009, 08:34)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.5353 2009-10-03 08:34:43.000000000 +0300
+++ /tmp/wklog.36.new.5353 2009-10-03 08:34:43.000000000 +0300
@@ -1 +1,77 @@
-G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
+Context
+-------
+(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
+overview)
+At the moment, the server has a replication slave option
+
+ --replicate-rewrite-db="from->to"
+
+the option affects
+- Table_map_log_event (all RBR events)
+- Load_log_event (LOAD DATA)
+- Query_log_event (SBR-based updates, with the usual assumption that the
+ statement refers to tables in current database, so that changing the current
+ database will make the statement to work on a table in a different database).
+
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
+
+What we could do
+----------------
+
+Option1: make mysqlbinlog accept --replicate-rewrite-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
+same extent as replication slave would process --replicate-rewrite-db option.
+
+
+Option2: Add database-agnostic RBR events and --strip-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Right now RBR events require a databasename. It is not possible to have RBR
+event stream that won't mention which database the events are for. When I
+tried to use debugger and specify empty database name, attempt to apply the
+binlog resulted in this error:
+
+090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
+opening tables,
+
+We could do as follows:
+- Make the server interpret empty database name in RBR event (i.e. in a
+ Table_map_log_event) as "use current database". Binlog slave thread
+ probably should not allow such events as it doesn't have a natural current
+ database.
+- Add a mysqlbinlog --strip-db option that would
+ = not produce any "USE dbname" statements
+ = change databasename for all RBR events to be empty
+
+That way, mysqlbinlog output will be database-agnostic and apply to the
+current database.
+(this will have the usual limitations that we assume that all statements in
+the binlog refer to the current database).
+
+Option3: Enhance database rewrite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If there is a need to support database change for statements that use
+dbname.tablename notation and are replicated as statements (i.e. are DDL
+statements and/or DML statements that are binlogged as statements),
+then that could be supported as follows:
+
+- Make the server's parser recognize special form of comments
+
+ /* !database-alias(oldname,newname) */
+
+ and save the mapping somewhere
+
+- Put the hooks in table open and name resolution code to use the saved
+ mapping.
+
+
+Once we've done the above, it will be easy to perform a complete,
+no-compromise or restrictions database name change in binary log.
+
+It will be possible to do the rewrites either on the slave (
+--replicate-rewrite-db will work for all kinds of statements), or in
+mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
+parse the statement).
+
-=-=(Guest - Sat, 03 Oct 2009, 02:27)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.23366 2009-10-03 02:27:45.000000000 +0300
+++ /tmp/wklog.36.new.23366 2009-10-03 02:27:45.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
-=-=(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):
-=-=(Guest - Tue, 15 Sep 2009, 12:08)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.3794 2009-09-15 12:08:54.000000000 +0300
+++ /tmp/wklog.36.new.3794 2009-09-15 12:08:54.000000000 +0300
@@ -1 +1,229 @@
+Content
+-------
+1. Adding rewrite-db option
+2. Supporting rewrite-db option for RBR events
+3. Supporting rewrite-db option for SBR events
+ (Limited to affecting only USE statements)
+4. Current status
+
+1. Adding rewrite-db option
+---------------------------
+
+1.1. Syntax:
+ --rewrite-db='db_from->db_to'
+
+1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
+
+1.3. In mysqlbinlog.cc:
+
+- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
+- Add Rpl_filter object to mysqlbinlog.cc
+
+ Rpl_filter* binlog_filter;
+
+- Add corresponding switch case to get_one_option():
+
+ case OPT_REWRITE_DB:
+ <extract db-from and db-to strings>
+ binlog_filter->add_db_rewrite(db_from, db_to);
+ break;
+ .
+Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
+additional changes are required:
+
+- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
+ uses sql_alloc() which is THD dependent. These are to be modified
+ as follows:
+
+ #ifdef MYSQL_CLIENT
+ extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
+ #endif
+
+ class Sql_alloc
+ { ...
+ static void *operator new(size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ static void *operator new[](size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ ...
+ }
+
+- In rpl_filter.cc:
+
+ Rpl_filter::Rpl_filter() :
+ ...
+ {
+ #ifdef MYSQL_CLIENT
+ init_alloc_root(&sql_list_client_mem_root, ...);
+ #endif
+ ...
+ }
+
+ Rpl_filter::~Rpl_filter()
+ { ...
+ #ifdef MYSQL_CLIENT
+ free_root(&sql_list_client_mem_root, ...);
+ #endif
+ }
+
+2. Supporting rewrite-db for RBR events
+---------------------------------------
+
+In binlog, each row operation event is preceded by Table map event(s) which maps
+table id(s) to database and table names. So, it's enough to support rewriting
+database name in a Table map.
+
+2.1. Add rewrite_db() member to Table_map_log_event:
+
+ int Table_map_log_event::rewrite_db(
+ const char* new_db,
+ size_t new_db_len,
+ const Format_description_log_event* desc)
+ {
+ /* 1. In temp_buf member (possibly reallocating it) rewrite
+ event length, db length, and db parts
+ 2. Change m_dblen and m_dbnam members
+ */
+ }
+
+Comment. This function assumes that temp_buf member contains Table map
+binlog representaion (temp_buf is used for creating corresponding
+BINLOG statement).
+
+2.2. In mysqlbinlog modify corresponding switch case in the
+process_event() function:
+
+ Exit_status process_event(
+ PRINT_EVENT_INFO *print_event_info,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ ...
+ case TABLE_MAP_EVENT:
+ {
+ Table_map_log_event *map= ((Table_map_log_event *)ev);
+ if (shall_skip_database(map->get_db_name()))
+ { ...
+ }
+ // WL36
+ size_t new_len= 0;
+ const char* new_db= binlog_filter->get_rewrite_db(
+ map->get_db_name(), &new_len);
+ if (new_len && map->rewrite_db(new_db, new_len,
+ glob_description_event))
+ { error("Could not rewrite database name");
+ goto err;
+ }
+ }
+ case WRITE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT:
+ ...
+ }
+ ...
+ }
+
+Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
+a (db_from, db_to) pair, this function returns pointer to db_to and
+sets len = db_to length; otherwise, it returns db_from and does not
+change len value.
+
+3. Supporting rewrite-db for SBR events
+---------------------------------------
+
+USE statements can be emited by mysqlbinlog as a result of processing the
+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 !!!
+
+Conditions for emiting use-statement:
+- LOG_EVENT_SUPPRESS_USE_F is OFF for the event
+ (e.g. it is ON for 'create database' statement)
+- event's db name differs from db_name in PRINT_EVENT_INFO
+ (PRINT_EVENT_INFO keeps db name of the last issued USE statement;
+ initially, this db name is empty).
+
+3.1. In mysqlbinlog.cc
+
+- Add the following function:
+
+ void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
+ {
+ if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
+ return;
+ /*
+ - For events listed above get db_from = event->db;
+ - If db_from is the same as pinfo->db then return;
+ - If there is rewrite-db rule db_from->db_to,
+ set db = db_to. Else set db = db_from;
+ - Print "use <db>" to mysqlbinlog output
+ - Set pinfo->db = db_from
+ (this suppresses emiting use-statements by corresponding
+ log_event's print-function)
+ */
+ }
+
+- In process_event() function 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,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ case QUERY_EVENT:
+ if (shall_skip_database(((Query_log_event*)ev)->db))
+ goto end;
+ if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ {
+ // Possibly in case of rewite-db rule for ev->db
+ // a warning should be emited here (see note below)
+ ... write_event_header_and_base64(ev, ...) ...
+ }
+ else
+ {
+ print_use_stmt((Query_log_event*)ev, print_event_info);
+ ev->print(result_file, print_event_info);
+ }
+ break;
+ ...
+ }
+ ...
+ }
+
+Note. write_event_header_and_base64() does not print use-statement. It
+produces BINLOG statement using ev->temp_buf content (i.e. the binary
+log representation of the event). We don't rewrite temp_buf here with
+db_to name (as we do it for Table map event) - this implies the
+limitation 3 mentioned above.
+Question: Is supporting of rewite_db + --base64-output really needed
+currently?
+
+4. Current status
+-----------------
+
+The outlined design (implemented for mysql-5.1.37) is tested for
+simple test-cases.
+
+TODO. 1. Check list of events which can emit use-statement.
+ 2. Supporting of rewite_db + --base64-output ?
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9711 2009-09-14 11:51:43.000000000 +0300
+++ /tmp/wklog.36.new.9711 2009-09-14 11:51:43.000000000 +0300
@@ -1 +1 @@
-Pay no attention: just check for having access
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9678 2009-09-14 11:51:28.000000000 +0300
+++ /tmp/wklog.36.new.9678 2009-09-14 11:51:28.000000000 +0300
@@ -1 +1 @@
-
+Pay no attention: just check for having access
-=-=(Knielsen - Mon, 17 Aug 2009, 12:44)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.7834 2009-08-17 12:44:17.000000000 +0300
+++ /tmp/wklog.36.new.7834 2009-08-17 12:44:17.000000000 +0300
@@ -13,7 +13,9 @@
statement refers to tables in current database, so that changing the current
database will make the statement to work on a table in a different database).
-See also MySQL BUG#42941.
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
What we could do
----------------
------------------------------------------------------------
-=-=(View All Progress Notes, 16 total)=-=-
http://askmonty.org/worklog/index.pl?tid=36&nolimit=1
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.
HIGH-LEVEL SPECIFICATION:
horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
LOW-LEVEL DESIGN:
Content
-------
1. Adding rewrite-db option
2. Supporting rewrite-db option for RBR events
3. Supporting rewrite-db option for SBR events
(Limited to affecting only USE statements)
4. Current status
1. Adding rewrite-db option
---------------------------
1.1. Syntax:
--rewrite-db='db_from->db_to'
1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
1.3. In mysqlbinlog.cc:
- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
- Add Rpl_filter object to mysqlbinlog.cc
Rpl_filter* binlog_filter;
- Add corresponding switch case to get_one_option():
case OPT_REWRITE_DB:
<extract db-from and db-to strings>
binlog_filter->add_db_rewrite(db_from, db_to);
break;
.
Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
additional changes are required:
- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
uses sql_alloc() which is THD dependent. These are to be modified
as follows:
#ifdef MYSQL_CLIENT
extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
#endif
class Sql_alloc
{ ...
static void *operator new(size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
static void *operator new[](size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
...
}
- In rpl_filter.cc:
Rpl_filter::Rpl_filter() :
...
{
#ifdef MYSQL_CLIENT
init_alloc_root(&sql_list_client_mem_root, ...);
#endif
...
}
Rpl_filter::~Rpl_filter()
{ ...
#ifdef MYSQL_CLIENT
free_root(&sql_list_client_mem_root, ...);
#endif
}
2. Supporting rewrite-db for RBR events
---------------------------------------
In binlog, each row operation event is preceded by Table map event(s) which maps
table id(s) to database and table names. So, it's enough to support rewriting
database name in a Table map.
2.1. Add rewrite_db() member to Table_map_log_event:
int Table_map_log_event::rewrite_db(
const char* new_db,
size_t new_db_len,
const Format_description_log_event* desc)
{
/* 1. In temp_buf member (possibly reallocating it) rewrite
event length, db length, and db parts
2. Change m_dblen and m_dbnam members
*/
}
Comment. This function assumes that temp_buf member contains Table map
binlog representaion (temp_buf is used for creating corresponding
BINLOG statement).
2.2. In mysqlbinlog modify corresponding switch case in the
process_event() function:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
...
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name()))
{ ...
}
// WL36
size_t new_len= 0;
const char* new_db= binlog_filter->get_rewrite_db(
map->get_db_name(), &new_len);
if (new_len && map->rewrite_db(new_db, new_len,
glob_description_event))
{ error("Could not rewrite database name");
goto err;
}
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
...
}
...
}
Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
a (db_from, db_to) pair, this function returns pointer to db_to and
sets len = db_to length; otherwise, it returns db_from and does not
change len value.
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):
- Query_log_event
- 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
(e.g. it is ON for 'create database' statement)
- event's db name differs from db_name in PRINT_EVENT_INFO
(PRINT_EVENT_INFO keeps db name of the last issued USE statement;
initially, this db name is empty).
3.1. In mysqlbinlog.cc
- Add the following function:
void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
{
if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
return;
/*
- For events listed above get db_from = event->db;
- If db_from is the same as pinfo->db then return;
- If there is rewrite-db rule db_from->db_to,
set db = db_to. Else set db = db_from;
- Print "use <db>" to mysqlbinlog output
- Set pinfo->db = db_from
(this suppresses emiting use-statements by corresponding
log_event's print-function)
*/
}
- In process_event() function add switch case for Load_log_event and
add print_use_stmt() invocations where needed (according to the
events list above), e.g.:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
case QUERY_EVENT:
if (shall_skip_database(((Query_log_event*)ev)->db))
goto end;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
// Possibly in case of rewite-db rule for ev->db
// a warning should be emited here (see note below)
... write_event_header_and_base64(ev, ...) ...
}
else
{
print_use_stmt((Query_log_event*)ev, print_event_info);
ev->print(result_file, print_event_info);
}
break;
...
case LOAD_EVENT:
print_use_stmt((Load_log_event*)ev, print_event_info);
break;
default:
...
}
...
}
Note. write_event_header_and_base64() does not print use-statement. It
produces BINLOG statement using ev->temp_buf content (i.e. the binary
log representation of the event). We don't rewrite temp_buf here with
db_to name (as we do it for Table map event) - this implies the
limitation 3 mentioned above.
Question: Is supporting of rewite_db + --base64-output really needed
currently?
4. Current status
-----------------
The outlined design (implemented for mysql-5.1.37) is tested for
simple test-cases.
TODO. 1. Check list of events which can emit use-statement.
2. Supporting of rewite_db + --base64-output ?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] Updated (by Guest): Add a mysqlbinlog option to change the used database (36)
by worklog-noreply@askmonty.org 04 Oct '09
by worklog-noreply@askmonty.org 04 Oct '09
04 Oct '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Add a mysqlbinlog option to change the used database
CREATION DATE..: Fri, 07 Aug 2009, 14:57
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 36 (http://askmonty.org/worklog/?tid=36)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0
PROGRESS NOTES:
-=-=(Guest - Sun, 04 Oct 2009, 14:51)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.12044 2009-10-04 14:51:59.000000000 +0300
+++ /tmp/wklog.36.new.12044 2009-10-04 14:51:59.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
-=-=(Knielsen - Sat, 03 Oct 2009, 08:34)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.5353 2009-10-03 08:34:43.000000000 +0300
+++ /tmp/wklog.36.new.5353 2009-10-03 08:34:43.000000000 +0300
@@ -1 +1,77 @@
-G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
+Context
+-------
+(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
+overview)
+At the moment, the server has a replication slave option
+
+ --replicate-rewrite-db="from->to"
+
+the option affects
+- Table_map_log_event (all RBR events)
+- Load_log_event (LOAD DATA)
+- Query_log_event (SBR-based updates, with the usual assumption that the
+ statement refers to tables in current database, so that changing the current
+ database will make the statement to work on a table in a different database).
+
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
+
+What we could do
+----------------
+
+Option1: make mysqlbinlog accept --replicate-rewrite-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
+same extent as replication slave would process --replicate-rewrite-db option.
+
+
+Option2: Add database-agnostic RBR events and --strip-db option
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Right now RBR events require a databasename. It is not possible to have RBR
+event stream that won't mention which database the events are for. When I
+tried to use debugger and specify empty database name, attempt to apply the
+binlog resulted in this error:
+
+090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
+opening tables,
+
+We could do as follows:
+- Make the server interpret empty database name in RBR event (i.e. in a
+ Table_map_log_event) as "use current database". Binlog slave thread
+ probably should not allow such events as it doesn't have a natural current
+ database.
+- Add a mysqlbinlog --strip-db option that would
+ = not produce any "USE dbname" statements
+ = change databasename for all RBR events to be empty
+
+That way, mysqlbinlog output will be database-agnostic and apply to the
+current database.
+(this will have the usual limitations that we assume that all statements in
+the binlog refer to the current database).
+
+Option3: Enhance database rewrite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If there is a need to support database change for statements that use
+dbname.tablename notation and are replicated as statements (i.e. are DDL
+statements and/or DML statements that are binlogged as statements),
+then that could be supported as follows:
+
+- Make the server's parser recognize special form of comments
+
+ /* !database-alias(oldname,newname) */
+
+ and save the mapping somewhere
+
+- Put the hooks in table open and name resolution code to use the saved
+ mapping.
+
+
+Once we've done the above, it will be easy to perform a complete,
+no-compromise or restrictions database name change in binary log.
+
+It will be possible to do the rewrites either on the slave (
+--replicate-rewrite-db will work for all kinds of statements), or in
+mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
+parse the statement).
+
-=-=(Guest - Sat, 03 Oct 2009, 02:27)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.23366 2009-10-03 02:27:45.000000000 +0300
+++ /tmp/wklog.36.new.23366 2009-10-03 02:27:45.000000000 +0300
@@ -1,77 +1 @@
-Context
--------
-(See http://askmonty.org/wiki/index.php/Scratch/ReplicationOptions for global
-overview)
-At the moment, the server has a replication slave option
-
- --replicate-rewrite-db="from->to"
-
-the option affects
-- Table_map_log_event (all RBR events)
-- Load_log_event (LOAD DATA)
-- Query_log_event (SBR-based updates, with the usual assumption that the
- statement refers to tables in current database, so that changing the current
- database will make the statement to work on a table in a different database).
-
-See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
-merged into MariaDB at the time of writing, but planned to be merged before
-release.
-
-What we could do
-----------------
-
-Option1: make mysqlbinlog accept --replicate-rewrite-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Make mysqlbinlog accept --replicate-rewrite-db options and process them to the
-same extent as replication slave would process --replicate-rewrite-db option.
-
-
-Option2: Add database-agnostic RBR events and --strip-db option
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Right now RBR events require a databasename. It is not possible to have RBR
-event stream that won't mention which database the events are for. When I
-tried to use debugger and specify empty database name, attempt to apply the
-binlog resulted in this error:
-
-090809 17:38:44 [ERROR] Slave SQL: Error 'Table '.tablename' doesn't exist' on
-opening tables,
-
-We could do as follows:
-- Make the server interpret empty database name in RBR event (i.e. in a
- Table_map_log_event) as "use current database". Binlog slave thread
- probably should not allow such events as it doesn't have a natural current
- database.
-- Add a mysqlbinlog --strip-db option that would
- = not produce any "USE dbname" statements
- = change databasename for all RBR events to be empty
-
-That way, mysqlbinlog output will be database-agnostic and apply to the
-current database.
-(this will have the usual limitations that we assume that all statements in
-the binlog refer to the current database).
-
-Option3: Enhance database rewrite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If there is a need to support database change for statements that use
-dbname.tablename notation and are replicated as statements (i.e. are DDL
-statements and/or DML statements that are binlogged as statements),
-then that could be supported as follows:
-
-- Make the server's parser recognize special form of comments
-
- /* !database-alias(oldname,newname) */
-
- and save the mapping somewhere
-
-- Put the hooks in table open and name resolution code to use the saved
- mapping.
-
-
-Once we've done the above, it will be easy to perform a complete,
-no-compromise or restrictions database name change in binary log.
-
-It will be possible to do the rewrites either on the slave (
---replicate-rewrite-db will work for all kinds of statements), or in
-mysqlbinlog (adding a comment is easy and doesn't require mysqlbinlog to
-parse the statement).
-
+G9m7yq <a href="http://ijfmyyjtveuu.com/">ijfmyyjtveuu</a>, [url=http://jeczeaqoxbpt.com/]jeczeaqoxbpt[/url] [link=http://nrisgrrvcrkm.com/]nrisgrrvcrkm[/link] http://edmnozsmotmt.com/
-=-=(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):
-=-=(Guest - Tue, 15 Sep 2009, 12:08)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.3794 2009-09-15 12:08:54.000000000 +0300
+++ /tmp/wklog.36.new.3794 2009-09-15 12:08:54.000000000 +0300
@@ -1 +1,229 @@
+Content
+-------
+1. Adding rewrite-db option
+2. Supporting rewrite-db option for RBR events
+3. Supporting rewrite-db option for SBR events
+ (Limited to affecting only USE statements)
+4. Current status
+
+1. Adding rewrite-db option
+---------------------------
+
+1.1. Syntax:
+ --rewrite-db='db_from->db_to'
+
+1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
+
+1.3. In mysqlbinlog.cc:
+
+- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
+- Add Rpl_filter object to mysqlbinlog.cc
+
+ Rpl_filter* binlog_filter;
+
+- Add corresponding switch case to get_one_option():
+
+ case OPT_REWRITE_DB:
+ <extract db-from and db-to strings>
+ binlog_filter->add_db_rewrite(db_from, db_to);
+ break;
+ .
+Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
+additional changes are required:
+
+- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
+ uses sql_alloc() which is THD dependent. These are to be modified
+ as follows:
+
+ #ifdef MYSQL_CLIENT
+ extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
+ #endif
+
+ class Sql_alloc
+ { ...
+ static void *operator new(size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ static void *operator new[](size_t size) throw ()
+ {
+ #ifndef MYSQL_CLIENT
+ return sql_alloc(size);
+ #else
+ return alloc_root(&sql_list_client_mem_root, size);
+ #endif
+ }
+ ...
+ }
+
+- In rpl_filter.cc:
+
+ Rpl_filter::Rpl_filter() :
+ ...
+ {
+ #ifdef MYSQL_CLIENT
+ init_alloc_root(&sql_list_client_mem_root, ...);
+ #endif
+ ...
+ }
+
+ Rpl_filter::~Rpl_filter()
+ { ...
+ #ifdef MYSQL_CLIENT
+ free_root(&sql_list_client_mem_root, ...);
+ #endif
+ }
+
+2. Supporting rewrite-db for RBR events
+---------------------------------------
+
+In binlog, each row operation event is preceded by Table map event(s) which maps
+table id(s) to database and table names. So, it's enough to support rewriting
+database name in a Table map.
+
+2.1. Add rewrite_db() member to Table_map_log_event:
+
+ int Table_map_log_event::rewrite_db(
+ const char* new_db,
+ size_t new_db_len,
+ const Format_description_log_event* desc)
+ {
+ /* 1. In temp_buf member (possibly reallocating it) rewrite
+ event length, db length, and db parts
+ 2. Change m_dblen and m_dbnam members
+ */
+ }
+
+Comment. This function assumes that temp_buf member contains Table map
+binlog representaion (temp_buf is used for creating corresponding
+BINLOG statement).
+
+2.2. In mysqlbinlog modify corresponding switch case in the
+process_event() function:
+
+ Exit_status process_event(
+ PRINT_EVENT_INFO *print_event_info,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ ...
+ case TABLE_MAP_EVENT:
+ {
+ Table_map_log_event *map= ((Table_map_log_event *)ev);
+ if (shall_skip_database(map->get_db_name()))
+ { ...
+ }
+ // WL36
+ size_t new_len= 0;
+ const char* new_db= binlog_filter->get_rewrite_db(
+ map->get_db_name(), &new_len);
+ if (new_len && map->rewrite_db(new_db, new_len,
+ glob_description_event))
+ { error("Could not rewrite database name");
+ goto err;
+ }
+ }
+ case WRITE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT:
+ ...
+ }
+ ...
+ }
+
+Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
+a (db_from, db_to) pair, this function returns pointer to db_to and
+sets len = db_to length; otherwise, it returns db_from and does not
+change len value.
+
+3. Supporting rewrite-db for SBR events
+---------------------------------------
+
+USE statements can be emited by mysqlbinlog as a result of processing the
+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 !!!
+
+Conditions for emiting use-statement:
+- LOG_EVENT_SUPPRESS_USE_F is OFF for the event
+ (e.g. it is ON for 'create database' statement)
+- event's db name differs from db_name in PRINT_EVENT_INFO
+ (PRINT_EVENT_INFO keeps db name of the last issued USE statement;
+ initially, this db name is empty).
+
+3.1. In mysqlbinlog.cc
+
+- Add the following function:
+
+ void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
+ {
+ if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
+ return;
+ /*
+ - For events listed above get db_from = event->db;
+ - If db_from is the same as pinfo->db then return;
+ - If there is rewrite-db rule db_from->db_to,
+ set db = db_to. Else set db = db_from;
+ - Print "use <db>" to mysqlbinlog output
+ - Set pinfo->db = db_from
+ (this suppresses emiting use-statements by corresponding
+ log_event's print-function)
+ */
+ }
+
+- In process_event() function 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,
+ Log_event *ev, ...)
+ {
+ ...
+ switch (ev_type) {
+ case QUERY_EVENT:
+ if (shall_skip_database(((Query_log_event*)ev)->db))
+ goto end;
+ if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
+ {
+ // Possibly in case of rewite-db rule for ev->db
+ // a warning should be emited here (see note below)
+ ... write_event_header_and_base64(ev, ...) ...
+ }
+ else
+ {
+ print_use_stmt((Query_log_event*)ev, print_event_info);
+ ev->print(result_file, print_event_info);
+ }
+ break;
+ ...
+ }
+ ...
+ }
+
+Note. write_event_header_and_base64() does not print use-statement. It
+produces BINLOG statement using ev->temp_buf content (i.e. the binary
+log representation of the event). We don't rewrite temp_buf here with
+db_to name (as we do it for Table map event) - this implies the
+limitation 3 mentioned above.
+Question: Is supporting of rewite_db + --base64-output really needed
+currently?
+
+4. Current status
+-----------------
+
+The outlined design (implemented for mysql-5.1.37) is tested for
+simple test-cases.
+
+TODO. 1. Check list of events which can emit use-statement.
+ 2. Supporting of rewite_db + --base64-output ?
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9711 2009-09-14 11:51:43.000000000 +0300
+++ /tmp/wklog.36.new.9711 2009-09-14 11:51:43.000000000 +0300
@@ -1 +1 @@
-Pay no attention: just check for having access
+
-=-=(Guest - Mon, 14 Sep 2009, 11:51)=-=-
Low Level Design modified.
--- /tmp/wklog.36.old.9678 2009-09-14 11:51:28.000000000 +0300
+++ /tmp/wklog.36.new.9678 2009-09-14 11:51:28.000000000 +0300
@@ -1 +1 @@
-
+Pay no attention: just check for having access
-=-=(Knielsen - Mon, 17 Aug 2009, 12:44)=-=-
High-Level Specification modified.
--- /tmp/wklog.36.old.7834 2009-08-17 12:44:17.000000000 +0300
+++ /tmp/wklog.36.new.7834 2009-08-17 12:44:17.000000000 +0300
@@ -13,7 +13,9 @@
statement refers to tables in current database, so that changing the current
database will make the statement to work on a table in a different database).
-See also MySQL BUG#42941.
+See also MySQL BUG#42941. Note this bug is fixed in MySQL 5.1.37, which is not
+merged into MariaDB at the time of writing, but planned to be merged before
+release.
What we could do
----------------
------------------------------------------------------------
-=-=(View All Progress Notes, 16 total)=-=-
http://askmonty.org/worklog/index.pl?tid=36&nolimit=1
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.
HIGH-LEVEL SPECIFICATION:
horny teen girls http://cdugied.200u.com/index-uplift.mp3.html index uplift.mp3www.blueteen http://cdugied.200u.com/teenbunnys.html teenbunnysteen poems.com homegurlz 4 life http://cdugied.200u.com/gayteen-sex.html gayteen sexwww.teen models.com http://cdugied.200u.com/what-is-love-poems.html what is love poemsendless pools.com http://cdugied.200u.com/espn-video-games.com.html espn video games.commap http://cdugied.200u.com/teen-vrigin.net.html teen vrigin.neterotic models.net http://cdugied.200u.com/teenmodel-dorothy.com.html teenmodel dorothy.comblue yonder.uk http://cdugied.200u.com/wcca.wicourts.gov-index.xsl.html wcca.wicourts.gov index.xslvideo.org http://cdugied.200u.com/rapidshare.com-links.html rapidshare.com linkscredits blog go2clickbank.com http://cdugied.200u.com/info-gesher.com.html info gesher.com
LOW-LEVEL DESIGN:
Content
-------
1. Adding rewrite-db option
2. Supporting rewrite-db option for RBR events
3. Supporting rewrite-db option for SBR events
(Limited to affecting only USE statements)
4. Current status
1. Adding rewrite-db option
---------------------------
1.1. Syntax:
--rewrite-db='db_from->db_to'
1.2. Add 'OPT_REWRITE_DB' to 'options_client' (in client_priv.h).
1.3. In mysqlbinlog.cc:
- Add { "rewrite-db", OPT_REWRITE_DB, ...} record to my_long_options:
- Add Rpl_filter object to mysqlbinlog.cc
Rpl_filter* binlog_filter;
- Add corresponding switch case to get_one_option():
case OPT_REWRITE_DB:
<extract db-from and db-to strings>
binlog_filter->add_db_rewrite(db_from, db_to);
break;
.
Note. To make Rpl_filter usable in a MYSQL_CLIENT context, few small
additional changes are required:
- In sql_list.cc/h, Sql_alloc::new(size_t) and Sql_alloc::new[](size_t)
uses sql_alloc() which is THD dependent. These are to be modified
as follows:
#ifdef MYSQL_CLIENT
extern MEM_ROOT sql_list_client_mem_root; // defined in sql_list.cc
#endif
class Sql_alloc
{ ...
static void *operator new(size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
static void *operator new[](size_t size) throw ()
{
#ifndef MYSQL_CLIENT
return sql_alloc(size);
#else
return alloc_root(&sql_list_client_mem_root, size);
#endif
}
...
}
- In rpl_filter.cc:
Rpl_filter::Rpl_filter() :
...
{
#ifdef MYSQL_CLIENT
init_alloc_root(&sql_list_client_mem_root, ...);
#endif
...
}
Rpl_filter::~Rpl_filter()
{ ...
#ifdef MYSQL_CLIENT
free_root(&sql_list_client_mem_root, ...);
#endif
}
2. Supporting rewrite-db for RBR events
---------------------------------------
In binlog, each row operation event is preceded by Table map event(s) which maps
table id(s) to database and table names. So, it's enough to support rewriting
database name in a Table map.
2.1. Add rewrite_db() member to Table_map_log_event:
int Table_map_log_event::rewrite_db(
const char* new_db,
size_t new_db_len,
const Format_description_log_event* desc)
{
/* 1. In temp_buf member (possibly reallocating it) rewrite
event length, db length, and db parts
2. Change m_dblen and m_dbnam members
*/
}
Comment. This function assumes that temp_buf member contains Table map
binlog representaion (temp_buf is used for creating corresponding
BINLOG statement).
2.2. In mysqlbinlog modify corresponding switch case in the
process_event() function:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
...
case TABLE_MAP_EVENT:
{
Table_map_log_event *map= ((Table_map_log_event *)ev);
if (shall_skip_database(map->get_db_name()))
{ ...
}
// WL36
size_t new_len= 0;
const char* new_db= binlog_filter->get_rewrite_db(
map->get_db_name(), &new_len);
if (new_len && map->rewrite_db(new_db, new_len,
glob_description_event))
{ error("Could not rewrite database name");
goto err;
}
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
...
}
...
}
Comment. Rpl_filter::get_rewrite_db(db_from, &len): if filter contains
a (db_from, db_to) pair, this function returns pointer to db_to and
sets len = db_to length; otherwise, it returns db_from and does not
change len value.
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):
- Query_log_event
- 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
(e.g. it is ON for 'create database' statement)
- event's db name differs from db_name in PRINT_EVENT_INFO
(PRINT_EVENT_INFO keeps db name of the last issued USE statement;
initially, this db name is empty).
3.1. In mysqlbinlog.cc
- Add the following function:
void print_use_stmt(Log_event* event, PRINT_EVENT_INFO* pinfo)
{
if (event->flags & LOG_EVENT_SUPPRESS_USE_F)
return;
/*
- For events listed above get db_from = event->db;
- If db_from is the same as pinfo->db then return;
- If there is rewrite-db rule db_from->db_to,
set db = db_to. Else set db = db_from;
- Print "use <db>" to mysqlbinlog output
- Set pinfo->db = db_from
(this suppresses emiting use-statements by corresponding
log_event's print-function)
*/
}
- In process_event() function add switch case for Load_log_event and
add print_use_stmt() invocations where needed (according to the
events list above), e.g.:
Exit_status process_event(
PRINT_EVENT_INFO *print_event_info,
Log_event *ev, ...)
{
...
switch (ev_type) {
case QUERY_EVENT:
if (shall_skip_database(((Query_log_event*)ev)->db))
goto end;
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
{
// Possibly in case of rewite-db rule for ev->db
// a warning should be emited here (see note below)
... write_event_header_and_base64(ev, ...) ...
}
else
{
print_use_stmt((Query_log_event*)ev, print_event_info);
ev->print(result_file, print_event_info);
}
break;
...
case LOAD_EVENT:
print_use_stmt((Load_log_event*)ev, print_event_info);
break;
default:
...
}
...
}
Note. write_event_header_and_base64() does not print use-statement. It
produces BINLOG statement using ev->temp_buf content (i.e. the binary
log representation of the event). We don't rewrite temp_buf here with
db_to name (as we do it for Table map event) - this implies the
limitation 3 mentioned above.
Question: Is supporting of rewite_db + --base64-output really needed
currently?
4. Current status
-----------------
The outlined design (implemented for mysql-5.1.37) is tested for
simple test-cases.
TODO. 1. Check list of events which can emit use-statement.
2. Supporting of rewite_db + --base64-output ?
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2751)
by knielsen@knielsen-hq.org 04 Oct '09
by knielsen@knielsen-hq.org 04 Oct '09
04 Oct '09
#At lp:maria
2751 knielsen(a)knielsen-hq.org 2009-10-04
Test suite fixes:
- Don't omit the @@debug variable from testcase check, since it can cause real problems.
- Fix some bad merges by reverting to be identical to MySQL 5.1.
modified:
mysql-test/include/mtr_check.sql
mysql-test/r/mysqlbinlog_row_big.result
mysql-test/r/variables-big.result
mysql-test/t/mysqlbinlog_row_big.test
mysql-test/t/variables-big.test
per-file messages:
mysql-test/include/mtr_check.sql
Don't omit the @@debug variable from testcase check, since it can cause real problems.
mysql-test/r/mysqlbinlog_row_big.result
Fix incorrect merge.
mysql-test/r/variables-big.result
Fix incorrect merge, by reverting to MySQL 5.1 version.
mysql-test/t/mysqlbinlog_row_big.test
Fix incorrect merge.
mysql-test/t/variables-big.test
Fix incorrect merge, by reverting to MySQL 5.1 version.
=== modified file 'mysql-test/include/mtr_check.sql'
--- a/mysql-test/include/mtr_check.sql 2009-09-07 20:50:10 +0000
+++ b/mysql-test/include/mtr_check.sql 2009-10-03 23:20:51 +0000
@@ -12,7 +12,7 @@ BEGIN
-- Dump all global variables except those
-- that are supposed to change
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE variable_name != 'timestamp' AND variable_name != "debug"
+ WHERE variable_name != 'timestamp'
AND variable_name != 'INNODB_IBUF_MAX_SIZE'
ORDER BY variable_name;
=== modified file 'mysql-test/r/mysqlbinlog_row_big.result'
--- a/mysql-test/r/mysqlbinlog_row_big.result 2009-09-07 20:50:10 +0000
+++ b/mysql-test/r/mysqlbinlog_row_big.result 2009-10-03 23:20:51 +0000
@@ -1,9 +1,4 @@
#
-# We need big packets.
-#
-SET @old_global_max_allowed_packet=@@global.max_allowed_packet;
-SET @@global.max_allowed_packet= 1024*1024*1024;
-#
# Preparatory cleanup.
#
DROP TABLE IF EXISTS t1;
@@ -104,5 +99,4 @@ FLUSH LOGS;
# reset variable value to pass testcase checks
SET @@global.max_allowed_packet = 1048576;
DROP TABLE t1;
-SET @@global.max_allowed_packet=@old_global_max_allowed_packet;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
=== modified file 'mysql-test/r/variables-big.result'
--- a/mysql-test/r/variables-big.result 2009-09-07 20:50:10 +0000
+++ b/mysql-test/r/variables-big.result 2009-10-03 23:20:51 +0000
@@ -1,20 +1,20 @@
-set session transaction_prealloc_size=1024*1024*1024*1;
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-TRUE
-1
-set session transaction_prealloc_size=1024*1024*1024*2;
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-TRUE
-1
-set session transaction_prealloc_size=1024*1024*1024*3;
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-TRUE
-1
-set session transaction_prealloc_size=1024*1024*1024*4;
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-TRUE
-1
-set session transaction_prealloc_size=1024*1024*1024*5;
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-TRUE
-1
+SET SESSION transaction_prealloc_size=1024*1024*1024*1;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+SET SESSION transaction_prealloc_size=1024*1024*1024*2;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+SET SESSION transaction_prealloc_size=1024*1024*1024*3;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+SET SESSION transaction_prealloc_size=1024*1024*1024*4;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+SET SESSION transaction_prealloc_size=1024*1024*1024*5;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
=== modified file 'mysql-test/t/mysqlbinlog_row_big.test'
--- a/mysql-test/t/mysqlbinlog_row_big.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/mysqlbinlog_row_big.test 2009-10-03 23:20:51 +0000
@@ -24,16 +24,6 @@
--source include/big_test.inc
--echo #
---echo # We need big packets.
---echo #
-connect (con1, localhost, root,,);
-connection con1;
-SET @old_global_max_allowed_packet=@@global.max_allowed_packet;
-SET @@global.max_allowed_packet= 1024*1024*1024;
-connect (con2, localhost, root,,);
-connection con2;
-
---echo #
--echo # Preparatory cleanup.
--echo #
--disable_warnings
@@ -154,14 +144,9 @@ let $MYSQLD_DATADIR= `select @@datadir`;
eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
DROP TABLE t1;
-connection con1;
-SET @@global.max_allowed_packet=@old_global_max_allowed_packet;
-
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
#
# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
#
--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
-disconnect con1
-disconnect con2
=== modified file 'mysql-test/t/variables-big.test'
--- a/mysql-test/t/variables-big.test 2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/variables-big.test 2009-10-03 23:20:51 +0000
@@ -5,7 +5,7 @@
--source include/big_test.inc
#
-# Bug #27322 failure to allocate transaction_prealloc_size causes crash
+# Bug#27322 failure to allocate transaction_prealloc_size causes crash
#
#
# Manual (6.0):
@@ -35,20 +35,21 @@
# timeout if the testing box is not powerful enough.
#
-set @pid_temp = (select ID from information_schema.processlist);
-set session transaction_prealloc_size=1024*1024*1024*1;
---replace_column 1 #
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-set session transaction_prealloc_size=1024*1024*1024*2;
---replace_column 1 #
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
---replace_column 1 #
-set session transaction_prealloc_size=1024*1024*1024*3;
---replace_column 1 #
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-set session transaction_prealloc_size=1024*1024*1024*4;
---replace_column 1 #
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
-set session transaction_prealloc_size=1024*1024*1024*5;
---replace_column 1 #
-select @pid_temp = (select ID from information_schema.processlist) as 'TRUE';
+--disable_warnings
+SET SESSION transaction_prealloc_size=1024*1024*1024*1;
+--replace_column 1 <Id> 6 <Time>
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*2;
+--replace_column 1 <Id> 6 <Time>
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*3;
+--replace_column 1 <Id> 6 <Time>
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*4;
+--replace_column 1 <Id> 6 <Time>
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*5;
+--replace_column 1 <Id> 6 <Time>
+SHOW PROCESSLIST;
+--enable_warnings
+
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2750)
by knielsen@knielsen-hq.org 03 Oct '09
by knielsen@knielsen-hq.org 03 Oct '09
03 Oct '09
#At lp:maria
2750 knielsen(a)knielsen-hq.org 2009-10-03
Fix some compiler warnings cause by GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
modified:
storage/maria/ma_blockrec.c
support-files/compiler_warnings.supp
per-file messages:
storage/maria/ma_blockrec.c
GCC warns about const vs. non-const despite cast
(but it is in any case cleaner to avoid the cast completely)
support-files/compiler_warnings.supp
Silence a wrong compiler warning caused by GCC bug.
=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c 2009-05-06 12:03:24 +0000
+++ b/storage/maria/ma_blockrec.c 2009-10-03 20:13:58 +0000
@@ -5448,7 +5448,7 @@ static size_t fill_insert_undo_parts(MAR
Store total blob length to make buffer allocation easier during UNDO
*/
log_parts->str= info->length_buff;
- log_parts->length= (uint) (ma_store_length((uchar *) log_parts->str,
+ log_parts->length= (uint) (ma_store_length(info->length_buff,
info->cur_row.blob_length) -
(uchar*) log_parts->str);
row_length+= log_parts->length;
@@ -5592,7 +5592,7 @@ static size_t fill_update_undo_parts(MAR
MARIA_SHARE *share= info->s;
MARIA_COLUMNDEF *column, *end_column;
MARIA_ROW *old_row= &info->cur_row, *new_row= &info->new_row;
- uchar *field_data, *start_field_data;
+ uchar *field_data, *start_field_data, *length_str;
uchar *old_field_lengths= old_row->field_lengths;
uchar *new_field_lengths= new_row->field_lengths;
size_t row_length= 0;
@@ -5749,9 +5749,9 @@ static size_t fill_update_undo_parts(MAR
/* Store length of field length data before the field/field_lengths */
field_lengths= (uint) (field_data - start_field_data);
- start_log_parts->str= ((start_field_data -
- ma_calc_length_for_store_length(field_lengths)));
- ma_store_length((uchar*)start_log_parts->str, field_lengths);
+ length_str= start_field_data - ma_calc_length_for_store_length(field_lengths);
+ start_log_parts->str= length_str;
+ ma_store_length(length_str, field_lengths);
start_log_parts->length= (size_t) (field_data - start_log_parts->str);
row_length+= start_log_parts->length;
DBUG_RETURN(row_length);
=== modified file 'support-files/compiler_warnings.supp'
--- a/support-files/compiler_warnings.supp 2009-09-03 13:20:22 +0000
+++ b/support-files/compiler_warnings.supp 2009-10-03 20:13:58 +0000
@@ -109,3 +109,6 @@ ma_packrec.c : .*result of 32-bit shift
#
.* : .*no matching operator delete found; memory will not be freed if initialization throws an exception.*
ctype-simple.c : .*unary minus operator applied to unsigned type, result still unsigned.*
+
+# Wrong warning due to GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
+regexec\.c : .*passing argument 3 of.*matcher.* discards qualifiers from pointer target type.*
1
0
[Maria-developers] Rev 2750: Fix embedded build on Windows: contents of storage/xtradb think they are in file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/
by Sergey Petrunya 03 Oct '09
by Sergey Petrunya 03 Oct '09
03 Oct '09
At file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/
------------------------------------------------------------
revno: 2750
revision-id: psergey(a)askmonty.org-20091003192413-50pog1zkms4xe670
parent: psergey(a)askmonty.org-20091003190231-qqv8elhf8fs4ugxu
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: mysql-5.1-maria-contd4
timestamp: Sat 2009-10-03 23:24:13 +0400
message:
Fix embedded build on Windows: contents of storage/xtradb think they are
'innobase'.
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt 2009-09-15 21:20:58 +0000
+++ b/CMakeLists.txt 2009-10-03 19:24:13 +0000
@@ -233,6 +233,9 @@
# where appropriate.
STRING (REGEX MATCH "MYSQL_STORAGE_ENGINE.[a-z]*" PLUGIN_NAME ${PLUGIN_FILE_CONTENT})
STRING (REGEX REPLACE "MYSQL_STORAGE_ENGINE.(.*)" "\\1" PLUGIN_NAME ${PLUGIN_NAME})
+
+ # Also remember this "xtradb"/"innobase" name discrepancy for libmysqld/CMakeLists.txt:
+ SET (plugin_dir_${PLUGIN_NAME} ${DIRNAME})
IF(MYSQL_PLUGIN_MANDATORY)
SET(WITH_${ENGINE}_STORAGE_ENGINE TRUE)
@@ -245,6 +248,7 @@
ELSE(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
SET(ENGINE_BUILD_TYPE "NONE")
ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
+
IF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${PLUGIN_NAME}_plugin")
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME})
=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt 2009-10-01 10:46:59 +0000
+++ b/libmysqld/CMakeLists.txt 2009-10-03 19:24:13 +0000
@@ -88,10 +88,10 @@
ENDFOREACH(rpath)
FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
- INCLUDE(${CMAKE_SOURCE_DIR}/storage/${ENGINE_LIB}/CMakeLists.txt)
+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/CMakeLists.txt)
STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES})
- SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_LIB}/${rpath})
+ SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/${rpath})
ENDFOREACH(rpath)
ENDFOREACH(ENGINE_LIB)
1
0
[Maria-developers] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2749)
by knielsen@knielsen-hq.org 03 Oct '09
by knielsen@knielsen-hq.org 03 Oct '09
03 Oct '09
#At lp:maria
2749 knielsen(a)knielsen-hq.org 2009-10-03
Fix merge-big.test to properly restore debug settings.
Otherwise following tests go crazy in the log, writing gigabytes of data
and causing havoc.
modified:
mysql-test/r/merge-big.result
mysql-test/t/merge-big.test
=== modified file 'mysql-test/r/merge-big.result'
--- a/mysql-test/r/merge-big.result 2009-03-12 22:29:39 +0000
+++ b/mysql-test/r/merge-big.result 2009-10-03 19:12:24 +0000
@@ -7,6 +7,7 @@ drop table if exists t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
LOCK TABLE t1 WRITE;
# connection con1
+SET @orig_debug=@@debug;
SET GLOBAL debug="+d,sleep_open_and_lock_after_open";
INSERT INTO t1 VALUES (1);
# connection default
@@ -21,6 +22,6 @@ SELECT * FROM t1;
c1
UNLOCK TABLES;
# connection con1
-SET GLOBAL debug="-d,sleep_open_and_lock_after_open";
+SET GLOBAL debug=@orig_debug;
# connection default
DROP TABLE t1;
=== modified file 'mysql-test/t/merge-big.test'
--- a/mysql-test/t/merge-big.test 2009-03-12 22:27:35 +0000
+++ b/mysql-test/t/merge-big.test 2009-10-03 19:12:24 +0000
@@ -43,6 +43,7 @@ LOCK TABLE t1 WRITE;
--echo # connection con1
connect (con1,localhost,root,,);
let $con1_id= `SELECT CONNECTION_ID()`;
+ SET @orig_debug=@@debug;
SET GLOBAL debug="+d,sleep_open_and_lock_after_open";
send INSERT INTO t1 VALUES (1);
--echo # connection default
@@ -74,7 +75,7 @@ UNLOCK TABLES;
--echo # connection con1
connection con1;
reap;
- SET GLOBAL debug="-d,sleep_open_and_lock_after_open";
+ SET GLOBAL debug=@orig_debug;
disconnect con1;
--echo # connection default
connection default;
1
0
[Maria-developers] Rev 2749: Merge in file:///home/psergey/bzr-new/maria-5.1-merge-r3/
by Sergey Petrunya 03 Oct '09
by Sergey Petrunya 03 Oct '09
03 Oct '09
At file:///home/psergey/bzr-new/maria-5.1-merge-r3/
------------------------------------------------------------
revno: 2749
revision-id: psergey(a)askmonty.org-20091003190231-qqv8elhf8fs4ugxu
parent: knielsen(a)knielsen-hq.org-20091002125516-bf4k9g1c6nzincoc
parent: psergey(a)askmonty.org-20091003185654-ibglul7pqli0mei9
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.1-merge-r3
timestamp: Sat 2009-10-03 23:02:31 +0400
message:
Merge
added:
mysql-test/r/variables_debug_notembedded.result variables_debug_note-20091003185522-fp0g3hek7so5aj4i-1
mysql-test/t/variables_debug_notembedded.test variables_debug_note-20091003185517-6myrmak03d4j3dlv-1
modified:
mysql-test/r/variables_debug.result sp1f-variables_debug.resu-20080226150357-xrpcjxbbb6lhnyicksx3a7ozn3i5wh5x
mysql-test/t/variables_debug.test sp1f-variables_debug.test-20080226150357-odgq22hsyfmfw7na43dwgeuppys77opf
------------------------------------------------------------
revno: 2745.1.1
revision-id: psergey(a)askmonty.org-20091003185654-ibglul7pqli0mei9
parent: psergey(a)askmonty.org-20091001212739-x4mzj5e7u8pig71f
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: mysql-5.1-maria-contd4
timestamp: Sat 2009-10-03 22:56:54 +0400
message:
Fix mysql-test-run --embedded:
- Don't run testcase for BUG#45632 with embedded server.
added:
mysql-test/r/variables_debug_notembedded.result variables_debug_note-20091003185522-fp0g3hek7so5aj4i-1
mysql-test/t/variables_debug_notembedded.test variables_debug_note-20091003185517-6myrmak03d4j3dlv-1
modified:
mysql-test/r/variables_debug.result sp1f-variables_debug.resu-20080226150357-xrpcjxbbb6lhnyicksx3a7ozn3i5wh5x
mysql-test/t/variables_debug.test sp1f-variables_debug.test-20080226150357-odgq22hsyfmfw7na43dwgeuppys77opf
=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result 2009-06-24 22:22:20 +0000
+++ b/mysql-test/r/variables_debug.result 2009-10-03 18:56:54 +0000
@@ -10,18 +10,3 @@
select @@debug;
@@debug
T
-set session debug="t";
-show session variables like 'debug';
-Variable_name Value
-debug t
-set session debug="t";
-show session variables like 'debug';
-Variable_name Value
-debug t
-set session debug="d:t";
-show session variables like 'debug';
-Variable_name Value
-debug d:t
-show session variables like 'debug';
-Variable_name Value
-debug t
=== added file 'mysql-test/r/variables_debug_notembedded.result'
--- a/mysql-test/r/variables_debug_notembedded.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/variables_debug_notembedded.result 2009-10-03 18:56:54 +0000
@@ -0,0 +1,15 @@
+set session debug="t";
+show session variables like 'debug';
+Variable_name Value
+debug t
+set session debug="t";
+show session variables like 'debug';
+Variable_name Value
+debug t
+set session debug="d:t";
+show session variables like 'debug';
+Variable_name Value
+debug d:t
+show session variables like 'debug';
+Variable_name Value
+debug t
=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test 2009-06-24 22:22:20 +0000
+++ b/mysql-test/t/variables_debug.test 2009-10-03 18:56:54 +0000
@@ -10,31 +10,3 @@
select @@debug;
set debug= '-P';
select @@debug;
-
-#
-# Checks that assigning variable 'debug' in one session has no influence on
-# other session. (BUG#45632 of bugs.mysql.com)
-#
-connect(con1,localhost,root,,test,,);
-connect(con2,localhost,root,,test,,);
-
-# makes output independant of current debug status
-connection con1;
-set session debug="t";
-show session variables like 'debug';
-connection con2;
-set session debug="t";
-show session variables like 'debug';
-
-# checks influence one session debug variable on another
-connection con1;
-set session debug="d:t";
-show session variables like 'debug';
-connection con2;
-show session variables like 'debug';
-
-disconnect con1;
-disconnect con2;
-
-connection default;
-
=== added file 'mysql-test/t/variables_debug_notembedded.test'
--- a/mysql-test/t/variables_debug_notembedded.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/variables_debug_notembedded.test 2009-10-03 18:56:54 +0000
@@ -0,0 +1,34 @@
+#
+# Checks that assigning variable 'debug' in one session has no influence on
+# other session. (BUG#45632 of bugs.mysql.com)
+#
+# (this will not work with embedded server because mysqltest_embedded uses the
+# same thread for all connections)
+#
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+connect(con1,localhost,root,,test,,);
+connect(con2,localhost,root,,test,,);
+
+# makes output independant of current debug status
+connection con1;
+set session debug="t";
+show session variables like 'debug';
+connection con2;
+set session debug="t";
+show session variables like 'debug';
+
+# checks influence one session debug variable on another
+connection con1;
+set session debug="d:t";
+show session variables like 'debug';
+connection con2;
+show session variables like 'debug';
+
+disconnect con1;
+disconnect con2;
+
+connection default;
+
+
1
0
[Maria-developers] Rev 2746: Fix mysql-test-run --embedded: in file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/
by Sergey Petrunya 03 Oct '09
by Sergey Petrunya 03 Oct '09
03 Oct '09
At file:///home/psergey/bzr-new/mysql-5.1-maria-contd4/
------------------------------------------------------------
revno: 2746
revision-id: psergey(a)askmonty.org-20091003185654-ibglul7pqli0mei9
parent: psergey(a)askmonty.org-20091001212739-x4mzj5e7u8pig71f
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: mysql-5.1-maria-contd4
timestamp: Sat 2009-10-03 22:56:54 +0400
message:
Fix mysql-test-run --embedded:
- Don't run testcase for BUG#45632 with embedded server.
=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result 2009-06-24 22:22:20 +0000
+++ b/mysql-test/r/variables_debug.result 2009-10-03 18:56:54 +0000
@@ -10,18 +10,3 @@
select @@debug;
@@debug
T
-set session debug="t";
-show session variables like 'debug';
-Variable_name Value
-debug t
-set session debug="t";
-show session variables like 'debug';
-Variable_name Value
-debug t
-set session debug="d:t";
-show session variables like 'debug';
-Variable_name Value
-debug d:t
-show session variables like 'debug';
-Variable_name Value
-debug t
=== added file 'mysql-test/r/variables_debug_notembedded.result'
--- a/mysql-test/r/variables_debug_notembedded.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/variables_debug_notembedded.result 2009-10-03 18:56:54 +0000
@@ -0,0 +1,15 @@
+set session debug="t";
+show session variables like 'debug';
+Variable_name Value
+debug t
+set session debug="t";
+show session variables like 'debug';
+Variable_name Value
+debug t
+set session debug="d:t";
+show session variables like 'debug';
+Variable_name Value
+debug d:t
+show session variables like 'debug';
+Variable_name Value
+debug t
=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test 2009-06-24 22:22:20 +0000
+++ b/mysql-test/t/variables_debug.test 2009-10-03 18:56:54 +0000
@@ -10,31 +10,3 @@
select @@debug;
set debug= '-P';
select @@debug;
-
-#
-# Checks that assigning variable 'debug' in one session has no influence on
-# other session. (BUG#45632 of bugs.mysql.com)
-#
-connect(con1,localhost,root,,test,,);
-connect(con2,localhost,root,,test,,);
-
-# makes output independant of current debug status
-connection con1;
-set session debug="t";
-show session variables like 'debug';
-connection con2;
-set session debug="t";
-show session variables like 'debug';
-
-# checks influence one session debug variable on another
-connection con1;
-set session debug="d:t";
-show session variables like 'debug';
-connection con2;
-show session variables like 'debug';
-
-disconnect con1;
-disconnect con2;
-
-connection default;
-
=== added file 'mysql-test/t/variables_debug_notembedded.test'
--- a/mysql-test/t/variables_debug_notembedded.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/variables_debug_notembedded.test 2009-10-03 18:56:54 +0000
@@ -0,0 +1,34 @@
+#
+# Checks that assigning variable 'debug' in one session has no influence on
+# other session. (BUG#45632 of bugs.mysql.com)
+#
+# (this will not work with embedded server because mysqltest_embedded uses the
+# same thread for all connections)
+#
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+connect(con1,localhost,root,,test,,);
+connect(con2,localhost,root,,test,,);
+
+# makes output independant of current debug status
+connection con1;
+set session debug="t";
+show session variables like 'debug';
+connection con2;
+set session debug="t";
+show session variables like 'debug';
+
+# checks influence one session debug variable on another
+connection con1;
+set session debug="d:t";
+show session variables like 'debug';
+connection con2;
+show session variables like 'debug';
+
+disconnect con1;
+disconnect con2;
+
+connection default;
+
+
1
0