Merge lp:~vlad-lesin/percona-server/5.6-mysqlbinlog-replacedb into lp:percona-server/5.6

Proposed by Vlad Lesin
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 544
Proposed branch: lp:~vlad-lesin/percona-server/5.6-mysqlbinlog-replacedb
Merge into: lp:percona-server/5.6
Diff against target: 1011 lines (+850/-2)
15 files modified
client/CMakeLists.txt (+2/-1)
client/client_priv.h (+1/-0)
client/mysqlbinlog.cc (+160/-0)
mysql-test/extra/rpl_tests/grep_pattern.inc (+22/-0)
mysql-test/suite/binlog/r/binlog_mysqlbinlog_rewrite_db.result (+33/-0)
mysql-test/suite/binlog/r/binlog_rewrite_db_noleak.result (+29/-0)
mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result (+29/-0)
mysql-test/suite/binlog/r/percona_mysqlbinlog_rewritedb.result (+152/-0)
mysql-test/suite/binlog/t/binlog_mysqlbinlog_rewrite_db.test (+95/-0)
mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test (+79/-0)
mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test (+61/-0)
mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb-master.opt (+1/-0)
mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb.test (+80/-0)
sql/log_event.cc (+102/-0)
sql/log_event.h (+4/-1)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.6-mysqlbinlog-replacedb
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Stewart Smith (community) Needs Fixing
George Ormond Lorch III (community) g2 Approve
Review via email: mp+196583@code.launchpad.net

Description of the change

Merged from 5.5.

Port --rewrite-db mysqlbinlog option from 5.1.

--rewrite-db is a string option which allows to replace one db-name to another
in mysqlbinlog output. The format of the string value is the following:
"from1->to1,from2->to2,from3->to3". Where "to[123]" are the names to which
the correspondent "from[123]" names must be replaced.

The original implementation does not replace db names in statements for
statement-based binlog, it just replaces db name of binlog event and issues
"USE" statement with replaced db name if necessary. I think this restriction
concerned with unwillingness to implement complex logic for parsing db names
from statements for such simple feature.

But for row-based binlog it replaces db names in statements correctly because
each table name is mapped to some number in binlog and it is quite easy to
extract such table ids from binlog event and replace one name by another.

http://jenkins.percona.com/job/percona-server-5.6-param/408/

The following changes are between 5.5 and 5.6:
1) Define "CHARSET_INFO* table_alias_charset= &my_charset_utf8_general_ci;" in 5.6 instead of "CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;" in 5.5. There is no need to define system_charset_info in 5.6 to link mysqlbinlog with rpl_filter.o, but table_alias_charset is necessary.

2) process_event() differs because the original code differs too.

To post a comment you must log in.
Revision history for this message
George Ormond Lorch III (gl-az) :
review: Approve (g2)
Revision history for this message
Stewart Smith (stewart) wrote :

It states that you can do "a->b,c->d" but I don't see the handling for the comma in the mysqlbinlog.cc command line parsing. Am I missing something? We should also test this.

review: Needs Fixing
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

See 5.5 comments.

review: Needs Fixing
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

> See 5.5 comments.
Fixed, http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/467/.

Also there is a memory leak in mysql-5.7.3 when --rewrite-db option is used. Here is the bug report http://bugs.mysql.com/bug.php?id=71283 .

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

See 5.5 comments.

http://jenkins.percona.com/view/PS 5.6/job/percona-server-5.6-param/499

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Needs Fixing
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/CMakeLists.txt'
--- client/CMakeLists.txt 2013-10-08 06:03:07 +0000
+++ client/CMakeLists.txt 2014-02-15 00:30:14 +0000
@@ -61,7 +61,8 @@
61MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)61MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
62TARGET_LINK_LIBRARIES(mysql_plugin perconaserverclient)62TARGET_LINK_LIBRARIES(mysql_plugin perconaserverclient)
6363
64MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc sql_string.cc)64MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc sql_string.cc
65 ../sql/rpl_filter.cc ../sql/sql_list.cc)
65TARGET_LINK_LIBRARIES(mysqlbinlog perconaserverclient)66TARGET_LINK_LIBRARIES(mysqlbinlog perconaserverclient)
6667
67MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)68MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
6869
=== modified file 'client/client_priv.h'
--- client/client_priv.h 2013-06-25 13:13:06 +0000
+++ client/client_priv.h 2014-02-15 00:30:14 +0000
@@ -104,6 +104,7 @@
104 OPT_SERVER_PUBLIC_KEY,104 OPT_SERVER_PUBLIC_KEY,
105 OPT_ENABLE_CLEARTEXT_PLUGIN,105 OPT_ENABLE_CLEARTEXT_PLUGIN,
106 OPT_INNODB_OPTIMIZE_KEYS,106 OPT_INNODB_OPTIMIZE_KEYS,
107 OPT_REWRITE_DB,
107 OPT_MAX_CLIENT_OPTION108 OPT_MAX_CLIENT_OPTION
108};109};
109110
110111
=== modified file 'client/mysqlbinlog.cc'
--- client/mysqlbinlog.cc 2013-10-31 18:42:25 +0000
+++ client/mysqlbinlog.cc 2014-02-15 00:30:14 +0000
@@ -60,6 +60,18 @@
60using std::min;60using std::min;
61using std::max;61using std::max;
6262
63/* Needed for Rpl_filter */
64CHARSET_INFO *table_alias_charset= &my_charset_bin;
65
66#include "rpl_filter.h"
67
68/*
69 True if obsolette syntax warning has been already shown
70 during parsing --rewrite-db command line option
71*/
72bool rewrite_db_obs_syn_warn= false;
73Rpl_filter *binlog_filter= NULL;
74
63#define BIN_LOG_HEADER_SIZE 4U75#define BIN_LOG_HEADER_SIZE 4U
64#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)76#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
65#define INTVAR_DYNAMIC_INIT 1677#define INTVAR_DYNAMIC_INIT 16
@@ -712,6 +724,35 @@
712 strcmp(log_dbname, database);724 strcmp(log_dbname, database);
713}725}
714726
727/**
728 Rewrites db name in T instance if binlog_filter contains
729 name for replacement(see --rewrite-db option).
730
731 T::db must be weak pointer and can point to the memory owned by
732 "binlog_filter" after this function execution, that is why "ev" must be
733 destroyed before "binlog_filter".
734
735 @param ev Event to process
736*/
737template <typename T>
738static void rewrite_db(T &ev)
739{
740 size_t len_to= 0;
741 const char* db_to;
742
743 DBUG_ASSERT(binlog_filter);
744
745 if (!ev.db)
746 return;
747
748 db_to= binlog_filter->get_rewrite_db(ev.db, &len_to);
749
750 if (!len_to)
751 return;
752
753 ev.db= db_to;
754 ev.db_len= len_to;
755}
715756
716/**757/**
717 Checks whether the given event should be filtered out,758 Checks whether the given event should be filtered out,
@@ -898,6 +939,13 @@
898 switch (ev_type) {939 switch (ev_type) {
899 case QUERY_EVENT:940 case QUERY_EVENT:
900 {941 {
942 /*
943 ev is deleted at the end of this function(before binlog_filter deletion)
944 so it is safe to set ev->db to some memory owned by binlog_filter here.
945 */
946 if (binlog_filter)
947 rewrite_db(*static_cast<Query_log_event *>(ev));
948
901 bool parent_query_skips=949 bool parent_query_skips=
902 !((Query_log_event*) ev)->is_trans_keyword() &&950 !((Query_log_event*) ev)->is_trans_keyword() &&
903 shall_skip_database(((Query_log_event*) ev)->db);951 shall_skip_database(((Query_log_event*) ev)->db);
@@ -989,6 +1037,12 @@
989 {1037 {
990 Create_file_log_event* ce= (Create_file_log_event*)ev;1038 Create_file_log_event* ce= (Create_file_log_event*)ev;
991 /*1039 /*
1040 ev is deleted at the end of this function(before binlog_filter deletion)
1041 so it is safe to set ev->db to some memory owned by binlog_filter here.
1042 */
1043 if (binlog_filter)
1044 rewrite_db(*ce);
1045 /*
992 We test if this event has to be ignored. If yes, we don't save1046 We test if this event has to be ignored. If yes, we don't save
993 this event; this will have the good side-effect of ignoring all1047 this event; this will have the good side-effect of ignoring all
994 related Append_block and Exec_load.1048 related Append_block and Exec_load.
@@ -1115,6 +1169,12 @@
1115 case EXECUTE_LOAD_QUERY_EVENT:1169 case EXECUTE_LOAD_QUERY_EVENT:
1116 {1170 {
1117 Execute_load_query_log_event *exlq= (Execute_load_query_log_event*)ev;1171 Execute_load_query_log_event *exlq= (Execute_load_query_log_event*)ev;
1172 /*
1173 ev is deleted at the end of this function(before binlog_filter deletion)
1174 so it is safe to set ev->db to some memory owned by binlog_filter here.
1175 */
1176 if (binlog_filter)
1177 rewrite_db(*exlq);
1118 char *fname= load_processor.grab_fname(exlq->file_id);1178 char *fname= load_processor.grab_fname(exlq->file_id);
11191179
1120 if (shall_skip_database(exlq->db))1180 if (shall_skip_database(exlq->db))
@@ -1144,6 +1204,19 @@
1144 case TABLE_MAP_EVENT:1204 case TABLE_MAP_EVENT:
1145 {1205 {
1146 Table_map_log_event *map= ((Table_map_log_event *)ev);1206 Table_map_log_event *map= ((Table_map_log_event *)ev);
1207 // Rewrite db name here (see --rewrite-db option)
1208 if (binlog_filter)
1209 {
1210 size_t len_to= 0;
1211 const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(),
1212 &len_to);
1213 if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))
1214 {
1215 error("Could not rewrite database name");
1216 goto err;
1217 }
1218 }
1219
1147 if (shall_skip_database(map->get_db_name()))1220 if (shall_skip_database(map->get_db_name()))
1148 {1221 {
1149 print_event_info->skipped_event_in_transaction= true;1222 print_event_info->skipped_event_in_transaction= true;
@@ -1589,6 +1662,10 @@
1589 "Identifiers were provided.",1662 "Identifiers were provided.",
1590 &opt_exclude_gtids_str, &opt_exclude_gtids_str, 0,1663 &opt_exclude_gtids_str, &opt_exclude_gtids_str, 0,
1591 GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},1664 GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1665 {"rewrite-db", OPT_REWRITE_DB,
1666 "Updates to a database with a different name than the original. "
1667 "Example: rewrite-db='from->to'.",
1668 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1592 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}1669 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
1593};1670};
15941671
@@ -1674,6 +1751,7 @@
1674 delete_dynamic(&buff_ev);1751 delete_dynamic(&buff_ev);
1675 1752
1676 delete glob_description_event;1753 delete glob_description_event;
1754 delete binlog_filter;
1677 if (mysql)1755 if (mysql)
1678 mysql_close(mysql);1756 mysql_close(mysql);
1679}1757}
@@ -1773,6 +1851,88 @@
1773 opt_base64_output_mode= (enum_base64_output_mode)1851 opt_base64_output_mode= (enum_base64_output_mode)
1774 (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);1852 (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
1775 break;1853 break;
1854 case OPT_REWRITE_DB: // db_from->db_to
1855 {
1856 /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */
1857 char* ptr= argument;
1858 do {
1859 char* key= ptr; // db-from
1860 char* val; // db-to
1861
1862 // Where key begins
1863 while (*key && my_isspace(&my_charset_latin1, *key))
1864 key++;
1865
1866 // Where val begins
1867 if (!(ptr= strstr(key, "->")))
1868 {
1869 sql_print_error("Bad syntax in rewrite-db: missing '->'!\n");
1870 return 1;
1871 }
1872 val= ptr + 2;
1873 while (*val && my_isspace(&my_charset_latin1, *val))
1874 val++;
1875
1876 // Write \0 and skip blanks at the end of key
1877 *ptr-- = 0;
1878 while (my_isspace(&my_charset_latin1, *ptr) && ptr > argument)
1879 *ptr-- = 0;
1880
1881 if (!*key)
1882 {
1883 sql_print_error("Bad syntax in rewrite-db: empty db-from!\n");
1884 return 1;
1885 }
1886
1887 // Skip blanks at the end of val
1888 ptr= val;
1889 while (*ptr && !my_isspace(&my_charset_latin1, *ptr) && *ptr != ',')
1890 ++ptr;
1891
1892 if (my_isspace(&my_charset_latin1, *ptr))
1893 {
1894 *(ptr++)= 0;
1895 while (*ptr && *ptr != ',')
1896 {
1897 if (!my_isspace(&my_charset_latin1, *ptr)) {
1898 sql_print_error("Bad syntax in rewrite-db: db-to must contain db "
1899 "name without spaces!\n");
1900 return 1;
1901 }
1902 ++ptr;
1903 }
1904 }
1905
1906 if (*ptr == ',')
1907 {
1908 if (!rewrite_db_obs_syn_warn)
1909 {
1910 warning("The comma-separated list of rewritings syntax is obsolete and "
1911 "discarded in 5.7\n");
1912 rewrite_db_obs_syn_warn= true;
1913 }
1914 *(ptr++)= 0;
1915 }
1916 else
1917 *ptr= 0;
1918
1919 if (!*val)
1920 {
1921 sql_print_error("Bad syntax in rewrite-db: empty db-to!\n");
1922 return 1;
1923 }
1924
1925 if (!binlog_filter &&
1926 !(binlog_filter= new Rpl_filter))
1927 {
1928 sql_print_error("Failed to create Rpl_filter\n");
1929 return 1;
1930 }
1931
1932 binlog_filter->add_db_rewrite(key, val);
1933 } while (*ptr);
1934 break;
1935 }
1776 case 'v':1936 case 'v':
1777 if (argument == disabled_my_option)1937 if (argument == disabled_my_option)
1778 verbose= 0;1938 verbose= 0;
17791939
=== added file 'mysql-test/extra/rpl_tests/grep_pattern.inc'
--- mysql-test/extra/rpl_tests/grep_pattern.inc 1970-01-01 00:00:00 +0000
+++ mysql-test/extra/rpl_tests/grep_pattern.inc 2014-02-15 00:30:14 +0000
@@ -0,0 +1,22 @@
1# Please set GREP_FILE and GREP_PATTERN environment variables
2# to work this file properly.
3--perl
4 use strict;
5 my $file= $ENV{'GREP_FILE'} or die "grep file not set";
6 my $pattern= $ENV{'GREP_PATTERN'} or die "pattern is not set";
7 open(FILE, "$file") or die("Unable to open $file: $!\n");
8 my $count = 0;
9 print "Matching lines are:\n";
10 while (<FILE>) {
11 my $line = $_;
12 if ($line =~ /$pattern/) {
13 print "$line\n";
14 $count++;
15 }
16 }
17 if ($count == 0) {
18 print "None\n";
19 }
20 print "Occurrences of the $pattern in the input file : $count\n";
21 close(FILE);
22EOF
023
=== added file 'mysql-test/suite/binlog/r/binlog_mysqlbinlog_rewrite_db.result'
--- mysql-test/suite/binlog/r/binlog_mysqlbinlog_rewrite_db.result 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/r/binlog_mysqlbinlog_rewrite_db.result 2014-02-15 00:30:14 +0000
@@ -0,0 +1,33 @@
1RESET MASTER;
2CREATE DATABASE db1;
3USE db1;
4CREATE TABLE t1 (i INT);
5INSERT INTO t1 VALUES(1);
6INSERT INTO t1 VALUES(2);
7UPDATE t1 SET i= i+1;
8DELETE FROM t1 WHERE i=2;
9[Syntax error in the use of the new option: The from database name is missing]
10[Syntax error in the use of the new option: The '->' is missing]
11[Syntax error in the use of the new option: The to database name is missing]
12[VALID SYNTAX,The from->to database names are correctly mentioned, but there is obsolete syntax warning 1]
13[Test that warning about obsolete syntax is shown only once for --rewrite-db="db1->db2,db3->db4,db5->db6"]
14[log_grep.inc] file: mysqltest.log pattern: The comma-separated list of rewritings syntax is obsolete and discarded
15[log_grep.inc] lines: 1
16[VALID SYNTAX,The from->to database names are correctly mentioned, but there is obsolete syntax warning 2]
17[Test that warning about obsolete syntax is shown only once for --rewrite-db="db1->db2,db3->db4" --rewrite-db="db5->db6,db6->db7"]
18[log_grep.inc] file: mysqltest.log pattern: The comma-separated list of rewritings syntax is obsolete and discarded
19[log_grep.inc] lines: 2
20[VALID SYNTAX,The from->to database names are correctly mentioned]
21#Dropping the database db1 and creating the table in the new database db2.
22CREATE DATABASE db2;
23DROP DATABASE db1;
24RESET MASTER;
25SELECT * FROM db2.t1;
26ERROR 42S02: Table 'db2.t1' doesn't exist
27DROP DATABASE db1;
28RESET MASTER;
29[The event of table db1.t1 has been successfully applied to db2.t1]
30include/assert.inc [Assert that table db2.t1 has one row after applying the sql file.]
31CLEANUP
32DROP DATABASE db1;
33DROP DATABASE db2;
034
=== added file 'mysql-test/suite/binlog/r/binlog_rewrite_db_noleak.result'
--- mysql-test/suite/binlog/r/binlog_rewrite_db_noleak.result 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/r/binlog_rewrite_db_noleak.result 2014-02-15 00:30:14 +0000
@@ -0,0 +1,29 @@
1RESET MASTER;
2CREATE DATABASE db1;
3USE db1;
4CREATE TABLE t1 (i INT);
5INSERT INTO db1.t1 VALUES(1);
6INSERT INTO db1.t1 VALUES(2);
7UPDATE t1 SET i= i+1;
8DELETE FROM t1 WHERE i=2;
9CREATE DATABASE db2;
10CREATE TABLE db2.t1 (i INT);
11INSERT INTO db2.t1 VALUES(3);
12INSERT INTO db2.t1 VALUES(4);
13INSERT INTO db2.t1 VALUES(5);
14UPDATE db2.t1 SET i= i+1;
15DELETE FROM db2.t1 WHERE i=4;
16call mtr.add_suppression("Slave SQL: Error executing row event:*");
17Dropping the database db1 creating the new database db3.
18DROP DATABASE db1;
19CREATE DATABASE db3;
20DROP DATABASE db2;
21RESET MASTER;
22[The sql file will be applied on the current database]
23[The content of table db3.t1 and db2.t1 will be different confirming no leak]
24include/assert.inc [The content of the table t1 in database db3 and db2 is different]
25include/assert.inc [Table t1 in db3 have different row count than t1 in db2]
26CLEANUP
27DROP DATABASE db1;
28DROP DATABASE db2;
29DROP DATABASE db3;
030
=== added file 'mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result'
--- mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result 2014-02-15 00:30:14 +0000
@@ -0,0 +1,29 @@
1RESET MASTER;
2CREATE DATABASE db1;
3USE db1;
4CREATE TABLE t1 (i INT);
5INSERT INTO t1 VALUES(1);
6INSERT INTO t1 VALUES(2);
7UPDATE t1 SET i= i+1;
8DELETE FROM t1 WHERE i=2;
9[The use <db_name> is not suppressed in the general use of mysqlbinlog]
10Matching lines are:
11use `db1`/*!*/;
12
13Occurrences of the use `db1` in the input file : 1
14[The use <db_name> is suppressed on using rewrite-db option of mysqlbinlog]
15Matching lines are:
16None
17Occurrences of the use `db1` in the input file : 0
18CREATE DATABASE db2;
19DROP DATABASE db1;
20RESET MASTER;
21SELECT * FROM db2.t1;
22ERROR 42S02: Table 'db2.t1' doesn't exist
23DROP DATABASE db1;
24RESET MASTER;
25[The event of table db1.t1 has been successfully applied to db2.t1]
26include/assert.inc [Assert that table db2.t1 has no rows after applying the sql file.]
27[CLEANUP]
28DROP DATABASE db1;
29DROP DATABASE db2;
030
=== added file 'mysql-test/suite/binlog/r/percona_mysqlbinlog_rewritedb.result'
--- mysql-test/suite/binlog/r/percona_mysqlbinlog_rewritedb.result 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/r/percona_mysqlbinlog_rewritedb.result 2014-02-15 00:30:14 +0000
@@ -0,0 +1,152 @@
1#
2# Apply log with ''
3#
4# use a
5f
60
70
8# use bbbbbbbbbbbbbbbbbbbb
9f
101
111
12# use cccccccccccccccc
13f
142
152
16# use d
17f
18#
19# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb" --rewrite-db="cccccccccccccccc->d" --database="d"'
20#
21# use a
22f
23# use bbbbbbbbbbbbbbbbbbbb
24f
25# use cccccccccccccccc
26f
27# use d
28f
292
302
31#
32# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb" --rewrite-db="cccccccccccccccc->d" --database="cccccccccccccccc"'
33#
34# use a
35f
36# use bbbbbbbbbbbbbbbbbbbb
37f
38# use cccccccccccccccc
39f
40# use d
41f
42#
43# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb" --rewrite-db="cccccccccccccccc->d" --database="bbbbbbbbbbbbbbbbbbbb"'
44#
45# use a
46f
47# use bbbbbbbbbbbbbbbbbbbb
48f
490
500
511
521
53# use cccccccccccccccc
54f
55# use d
56f
57#
58# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb" --rewrite-db="cccccccccccccccc->d" --database="a"'
59#
60# use a
61f
62# use bbbbbbbbbbbbbbbbbbbb
63f
64# use cccccccccccccccc
65f
66# use d
67f
68#
69# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb" --rewrite-db="cccccccccccccccc->d"'
70#
71# use a
72f
73# use bbbbbbbbbbbbbbbbbbbb
74f
750
760
771
781
79# use cccccccccccccccc
80f
81# use d
82f
832
842
85#
86# Apply log with '--rewrite-db=" a -> bbbbbbbbbbbbbbbbbbbb , cccccccccccccccc -> d "'
87#
88# use a
89f
90# use bbbbbbbbbbbbbbbbbbbb
91f
920
930
941
951
96# use cccccccccccccccc
97f
98# use d
99f
1002
1012
102#
103# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb,cccccccccccccccc->d"'
104#
105# use a
106f
107# use bbbbbbbbbbbbbbbbbbbb
108f
1090
1100
1111
1121
113# use cccccccccccccccc
114f
115# use d
116f
1172
1182
119#
120# Apply log with '--rewrite-db="a->d"'
121#
122# use a
123f
124# use bbbbbbbbbbbbbbbbbbbb
125f
1261
1271
128# use cccccccccccccccc
129f
1302
1312
132# use d
133f
1340
1350
136#
137# Apply log with '--rewrite-db="a->bbbbbbbbbbbbbbbbbbbb"'
138#
139# use a
140f
141# use bbbbbbbbbbbbbbbbbbbb
142f
1430
1440
1451
1461
147# use cccccccccccccccc
148f
1492
1502
151# use d
152f
0153
=== added file 'mysql-test/suite/binlog/t/binlog_mysqlbinlog_rewrite_db.test'
--- mysql-test/suite/binlog/t/binlog_mysqlbinlog_rewrite_db.test 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/t/binlog_mysqlbinlog_rewrite_db.test 2014-02-15 00:30:14 +0000
@@ -0,0 +1,95 @@
1# WL#6404 - Add rewrite-db option to mysqlbinlog on RBR
2#
3# The test checks the new rewrite-db option for the mysqlbinlog.
4#
5# The test checks the following aspects of the new option:
6
7# 1. The valid syntax for the use of the new option and the errors in
8# case the usage is not correct.
9# 2. Apply the new binlog file ( with database rewritten ) to a new database
10# and check if it works.
11#
12--source include/have_binlog_format_row.inc
13
14RESET MASTER;
15CREATE DATABASE db1;
16USE db1;
17CREATE TABLE t1 (i INT);
18
19# Get some INSERT, UPDATE and DELETE ROW events.
20INSERT INTO t1 VALUES(1);
21INSERT INTO t1 VALUES(2);
22UPDATE t1 SET i= i+1;
23DELETE FROM t1 WHERE i=2;
24
25--let $MYSQLD_DATADIR= `select @@datadir`
26--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event.sql
27
28# Using the new option to apply the row event on some other database (from db1 -> db2 in the current case)
29
30--echo [Syntax error in the use of the new option: The from database name is missing]
31--error 1
32--exec $MYSQL_BINLOG --force-if-open --rewrite-db="->db2" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
33
34--echo [Syntax error in the use of the new option: The '->' is missing]
35--error 1
36--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1 db2" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
37
38--echo [Syntax error in the use of the new option: The to database name is missing]
39--error 1
40--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
41
42--echo [VALID SYNTAX,The from->to database names are correctly mentioned, but there is obsolete syntax warning 1]
43--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db2,db3->db4,db5->db6" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
44
45--echo [Test that warning about obsolete syntax is shown only once for --rewrite-db="db1->db2,db3->db4,db5->db6"]
46--let log_file=mysqltest.log
47--let log_file_full_path=$MYSQLTEST_VARDIR/log/current_test
48--let grep_pattern=The comma-separated list of rewritings syntax is obsolete and discarded
49--source include/log_grep.inc
50
51--echo [VALID SYNTAX,The from->to database names are correctly mentioned, but there is obsolete syntax warning 2]
52--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db2,db3->db4" --rewrite-db="db5->db6,db6->db7" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
53
54--echo [Test that warning about obsolete syntax is shown only once for --rewrite-db="db1->db2,db3->db4" --rewrite-db="db5->db6,db6->db7"]
55--let log_file=mysqltest.log
56--let log_file_full_path=$MYSQLTEST_VARDIR/log/current_test
57--let grep_pattern=The comma-separated list of rewritings syntax is obsolete and discarded
58--source include/log_grep.inc
59
60--echo [VALID SYNTAX,The from->to database names are correctly mentioned]
61--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db2" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
62
63--echo #Dropping the database db1 and creating the table in the new database db2.
64
65CREATE DATABASE db2;
66DROP DATABASE db1;
67
68# The SQL file will be applied but nothing is applied on Database db2 since the row event was
69# generated for database db1 and table t1.
70
71# With gtid-mode=on we need purge gtid_executed, if not transactions
72# replayed through mysqlbinlog will be skipped.
73RESET MASTER;
74--exec $MYSQL --database=db2 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/row_event.sql
75--error ER_NO_SUCH_TABLE
76SELECT * FROM db2.t1;
77
78# The SQL file should be applied since the row event was extracted using the new mysqlbinlog option.
79
80DROP DATABASE db1;
81# With gtid-mode=on we need purge gtid_executed, if not transactions
82# replayed through mysqlbinlog will be skipped.
83RESET MASTER;
84--echo [The event of table db1.t1 has been successfully applied to db2.t1]
85--exec $MYSQL --database=db2 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
86--let $assert_text= Assert that table db2.t1 has one row after applying the sql file.
87--let $assert_cond= `SELECT COUNT(*)=1 from db2.t1`
88--source include/assert.inc
89
90--echo CLEANUP
91
92--remove_file $MYSQLTEST_VARDIR/tmp/row_event.sql
93--remove_file $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
94DROP DATABASE db1;
95DROP DATABASE db2;
096
=== added file 'mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test'
--- mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test 2014-02-15 00:30:14 +0000
@@ -0,0 +1,79 @@
1# WL#6404 - Add rewrite-db option to mysqlbinlog on RBR
2#
3# The test checks that there is no leak of the global variables used
4# to decide whether rewrite-db option is ON or OFF.
5#
6# The test checks this by creating two tables in two different databases.
7# insert rows in both of them.
8#
9# Read the binlog file using the new option --rewrite-db="db1->db3" and
10# writing in the .sql file.
11#
12# On applying the .sql file on database db3, we get an error since not
13# all events are converted for database db3. Only DB1 is converted to db3.
14# The db2 event cause the error.
15#
16
17--source include/have_binlog_format_row.inc
18RESET MASTER;
19CREATE DATABASE db1;
20USE db1;
21CREATE TABLE t1 (i INT);
22
23# Get some INSERT, UPDATE and DELETE ROW events.
24INSERT INTO db1.t1 VALUES(1);
25INSERT INTO db1.t1 VALUES(2);
26UPDATE t1 SET i= i+1;
27DELETE FROM t1 WHERE i=2;
28
29CREATE DATABASE db2;
30CREATE TABLE db2.t1 (i INT);
31
32# Get some INSERT, UPDATE and DELETE ROW events.
33INSERT INTO db2.t1 VALUES(3);
34INSERT INTO db2.t1 VALUES(4);
35INSERT INTO db2.t1 VALUES(5);
36UPDATE db2.t1 SET i= i+1;
37DELETE FROM db2.t1 WHERE i=4;
38
39--let $MYSQLD_DATADIR= `select @@datadir`
40
41# Using the new option to apply the row event on some other database (from db1 -> db3 in the current case)
42
43--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db3" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql
44call mtr.add_suppression("Slave SQL: Error executing row event:*");
45
46--echo Dropping the database db1 creating the new database db3.
47DROP DATABASE db1;
48CREATE DATABASE db3;
49
50# The SQL file will be applied but only db1 events will be replayed on db3.
51# Database db2 will not be applied on db3 confirming there is no leak.
52DROP DATABASE db2;
53
54# With gtid-mode=on we need purge gtid_executed, if not transactions
55# replayed through mysqlbinlog will be skipped.
56RESET MASTER;
57--echo [The sql file will be applied on the current database]
58--exec $MYSQL --database=db3 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql
59
60--echo [The content of table db3.t1 and db2.t1 will be different confirming no leak]
61
62--let $db3_max= `SELECT MAX(i) FROM db3.t1`
63--let $db2_max= `SELECT MAX(i) FROM db2.t1`
64--let $assert_text= The content of the table t1 in database db3 and db2 is different
65--let $assert_cond= $db3_max <> $db2_max
66--source include/assert.inc
67
68--let $db3_count= `SELECT COUNT(*) FROM db3.t1`
69--let $db2_count= `SELECT COUNT(*) FROM db2.t1`
70--let $assert_text= Table t1 in db3 have different row count than t1 in db2
71--let $assert_cond= $db3_count=1 AND $db2_count<>1
72--source include/assert.inc
73
74--echo CLEANUP
75
76#--remove_file $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql
77DROP DATABASE db1;
78DROP DATABASE db2;
79DROP DATABASE db3;
080
=== added file 'mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test'
--- mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test 2014-02-15 00:30:14 +0000
@@ -0,0 +1,61 @@
1# WL#6404 - Add rewrite-db option to mysqlbinlog on RBR
2#
3# The test aims to check that the use of rewrite-db option of
4# mysqlbinlog suppresses the USE DATABASE command logged in
5# binlog file.
6#
7
8--source include/have_binlog_format_row.inc
9RESET MASTER;
10CREATE DATABASE db1;
11USE db1;
12CREATE TABLE t1 (i INT);
13
14# Get some INSERT, UPDATE and DELETE ROW events.
15INSERT INTO t1 VALUES(1);
16INSERT INTO t1 VALUES(2);
17UPDATE t1 SET i= i+1;
18DELETE FROM t1 WHERE i=2;
19
20--let $MYSQLD_DATADIR= `select @@datadir`
21
22# Checking for the suppression of the USE DATABASE command on using the new option.
23# Reading binlog file without the rewrite-db option.
24--echo [The use <db_name> is not suppressed in the general use of mysqlbinlog]
25--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event.sql
26--let GREP_FILE=$MYSQLTEST_VARDIR/tmp/row_event.sql
27--let GREP_PATTERN=use `db1`
28--source extra/rpl_tests/grep_pattern.inc
29
30# Reading binlog file with the rewrite-db option.
31--echo [The use <db_name> is suppressed on using rewrite-db option of mysqlbinlog]
32--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db2" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
33--let GREP_FILE=$MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
34--let GREP_PATTERN=use `db1`
35--source extra/rpl_tests/grep_pattern.inc
36
37CREATE DATABASE db2;
38DROP DATABASE db1;
39# With gtid-mode=on we need purge gtid_executed, if not transactions
40# replayed through mysqlbinlog will be skipped.
41RESET MASTER;
42--exec $MYSQL --database=db2 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/row_event.sql
43--error ER_NO_SUCH_TABLE
44SELECT * FROM db2.t1;
45
46DROP DATABASE db1;
47# With gtid-mode=on we need purge gtid_executed, if not transactions
48# replayed through mysqlbinlog will be skipped.
49RESET MASTER;
50--echo [The event of table db1.t1 has been successfully applied to db2.t1]
51--exec $MYSQL --database=db2 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
52--let $assert_text= Assert that table db2.t1 has no rows after applying the sql file.
53--let $assert_cond= `SELECT COUNT(*)=1 from db2.t1`
54--source include/assert.inc
55
56--echo [CLEANUP]
57--remove_file $MYSQLTEST_VARDIR/tmp/row_event.sql
58--remove_file $MYSQLTEST_VARDIR/tmp/row_event_rewrite.sql
59
60DROP DATABASE db1;
61DROP DATABASE db2;
062
=== added file 'mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb-master.opt'
--- mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb-master.opt 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb-master.opt 2014-02-15 00:30:14 +0000
@@ -0,0 +1,1 @@
1--local-infile=1
02
=== added file 'mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb.test'
--- mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb.test 1970-01-01 00:00:00 +0000
+++ mysql-test/suite/binlog/t/percona_mysqlbinlog_rewritedb.test 2014-02-15 00:30:14 +0000
@@ -0,0 +1,80 @@
1--source include/have_log_bin.inc
2#
3# WL #36: http://askmonty.org/worklog/Server-Sprint/?tid=36
4# This is basic test for --rewrite-db option.
5# mysqlbinlog --rewrite-db="from->to" should rewrite database name
6#
7
8--disable_query_log
9
10# Because RBR event DB rewrite requires shifting of
11# Table_map_log_event contents around if the DB name length
12# changes, this case is tested for both shorter and longer
13# names.
14
15--let DB1=a
16--let DB2=bbbbbbbbbbbbbbbbbbbb
17--let DB3=cccccccccccccccc
18--let DB4=d
19
20eval CREATE DATABASE $DB1; eval USE $DB1; CREATE TABLE t1(f INT);
21eval CREATE DATABASE $DB2; eval USE $DB2; CREATE TABLE t1(f INT);
22eval CREATE DATABASE $DB3; eval USE $DB3; CREATE TABLE t1(f INT);
23eval CREATE DATABASE $DB4; eval USE $DB4; CREATE TABLE t1(f INT);
24
25RESET MASTER;
26--let MYSQLD_DATA_DIR=`select @@datadir`
27--let LOAD_DATA_FILE=$MYSQLD_DATA_DIR/table.values
28--let BIN_LOG_FILE_NAME=query_get_value(show master status, File, 1)
29--let BIN_LOG_START_POSITION=query_get_value(show master status, Position, 1)
30eval USE $DB1; INSERT INTO t1 VALUES(0); INSERT INTO t1 VALUES(0);
31eval USE $DB2; INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
32write_file $LOAD_DATA_FILE;
332
342
35EOF
36eval USE $DB3;
37--eval LOAD DATA INFILE "$LOAD_DATA_FILE" INTO TABLE t1
38--let BIN_LOG_STOP_POSITION=query_get_value(show master status, Position, 1)
39FLUSH LOGS;
40
41--let BIN_LOG_FULL_PATH=`SELECT CONCAT("$MYSQLD_DATA_DIR", "$BIN_LOG_FILE_NAME")`
42
43--let i=10
44
45while ($i)
46{
47# Test for different combinations of syntax and db name filtering and rewriting
48--let REWRITE=`SELECT CASE $i WHEN 10 THEN '' WHEN 9 THEN '--rewrite-db="$DB1->$DB2" --rewrite-db="$DB3->$DB4" --database="$DB4"' WHEN 8 THEN '--rewrite-db="$DB1->$DB2" --rewrite-db="$DB3->$DB4" --database="$DB3"' WHEN 7 THEN '--rewrite-db="$DB1->$DB2" --rewrite-db="$DB3->$DB4" --database="$DB2"' WHEN 6 THEN '--rewrite-db="$DB1->$DB2" --rewrite-db="$DB3->$DB4" --database="$DB1"' WHEN 5 THEN '--rewrite-db="$DB1->$DB2" --rewrite-db="$DB3->$DB4"' WHEN 4 THEN '--rewrite-db=" $DB1 -> $DB2 , $DB3 -> $DB4 "' WHEN 3 THEN '--rewrite-db="$DB1->$DB2,$DB3->$DB4"' WHEN 2 THEN '--rewrite-db="$DB1->$DB4"' WHEN 1 THEN '--rewrite-db="$DB1->$DB2"' END`
49
50eval USE $DB1; DELETE FROM t1;
51eval USE $DB2; DELETE FROM t1;
52eval USE $DB3; DELETE FROM t1;
53eval USE $DB4; DELETE FROM t1;
54
55--echo #
56--echo # Apply log with '$REWRITE'
57--echo #
58
59--exec $MYSQL_BINLOG $REWRITE --start-position=$BIN_LOG_START_POSITION --stop-position=$BIN_LOG_STOP_POSITION $BIN_LOG_FULL_PATH | $MYSQL --local-infile=1
60
61--echo # use $DB1
62eval USE $DB1; SELECT * FROM t1 ORDER BY f;
63--echo # use $DB2
64eval USE $DB2; SELECT * FROM t1 ORDER BY f;
65--echo # use $DB3
66eval USE $DB3; SELECT * FROM t1 ORDER BY f;
67--echo # use $DB4
68eval USE $DB4; SELECT * FROM t1 ORDER BY f;
69
70dec $i;
71}
72
73eval USE $DB1; DROP TABLE t1; eval DROP DATABASE $DB1;
74eval USE $DB2; DROP TABLE t1; eval DROP DATABASE $DB2;
75eval USE $DB3; DROP TABLE t1; eval DROP DATABASE $DB3;
76eval USE $DB4; DROP TABLE t1; eval DROP DATABASE $DB4;
77
78--remove_file $LOAD_DATA_FILE
79
80--enable_query_log
081
=== modified file 'sql/log_event.cc'
--- sql/log_event.cc 2013-12-16 08:45:31 +0000
+++ sql/log_event.cc 2014-02-15 00:30:14 +0000
@@ -11862,6 +11862,108 @@
11862 my_free(m_memory);11862 my_free(m_memory);
11863}11863}
1186411864
11865#ifdef MYSQL_CLIENT
11866
11867/*
11868 Rewrite database name for the event to name specified by new_db
11869 SYNOPSIS
11870 new_db Database name to change to
11871 new_len Length
11872 desc Event describing binlog that we're writing to.
11873
11874 DESCRIPTION
11875 Reset db name. This function assumes that temp_buf member contains event
11876 representation taken from a binary log. It resets m_dbnam and m_dblen and
11877 rewrites temp_buf with new db name.
11878
11879 RETURN
11880 0 - Success
11881 other - Error
11882*/
11883
11884int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
11885 const Format_description_log_event* desc)
11886{
11887 DBUG_ENTER("Table_map_log_event::rewrite_db");
11888 DBUG_ASSERT(temp_buf);
11889
11890 uint header_len= min((unsigned)desc->common_header_len,
11891 (unsigned)LOG_EVENT_MINIMAL_HEADER_LEN) + TABLE_MAP_HEADER_LEN;
11892 int len_diff;
11893
11894 if (!(len_diff= new_len - m_dblen))
11895 {
11896 memcpy((void*) (temp_buf + header_len + 1), new_db, m_dblen + 1);
11897 memcpy((void*) m_dbnam, new_db, m_dblen + 1);
11898 DBUG_RETURN(0);
11899 }
11900
11901 // Create new temp_buf
11902 ulong event_cur_len= uint4korr(temp_buf + EVENT_LEN_OFFSET);
11903 ulong event_new_len= event_cur_len + len_diff;
11904 char* new_temp_buf= (char*) my_malloc(event_new_len, MYF(MY_WME));
11905
11906 if (!new_temp_buf)
11907 {
11908 sql_print_error("Table_map_log_event::rewrite_db: "
11909 "failed to allocate new temp_buf (%d bytes required)",
11910 event_new_len);
11911 DBUG_RETURN(-1);
11912 }
11913
11914 // Rewrite temp_buf
11915 char* ptr= new_temp_buf;
11916 ulong cnt= 0;
11917
11918 // Copy header and change event length
11919 memcpy(ptr, temp_buf, header_len);
11920 int4store(ptr + EVENT_LEN_OFFSET, event_new_len);
11921 ptr += header_len;
11922 cnt += header_len;
11923
11924 // Write new db name length and new name
11925 *ptr++ = new_len;
11926 memcpy(ptr, new_db, new_len + 1);
11927 ptr += new_len + 1;
11928 cnt += m_dblen + 2;
11929
11930 // Copy rest part
11931 memcpy(ptr, temp_buf + cnt, event_cur_len - cnt);
11932
11933 // Reregister temp buf
11934 free_temp_buf();
11935 register_temp_buf(new_temp_buf);
11936
11937 // Reset m_dbnam and m_dblen members
11938 m_dblen= new_len;
11939
11940 // m_dbnam resides in m_memory together with m_tblnam and m_coltype
11941 uchar* memory= m_memory;
11942 char const* tblnam= m_tblnam;
11943 uchar* coltype= m_coltype;
11944
11945 m_memory= (uchar*) my_multi_malloc(MYF(MY_WME),
11946 &m_dbnam, (uint) m_dblen + 1,
11947 &m_tblnam, (uint) m_tbllen + 1,
11948 &m_coltype, (uint) m_colcnt,
11949 NullS);
11950
11951 if (!m_memory)
11952 {
11953 sql_print_error("Table_map_log_event::rewrite_db: "
11954 "failed to allocate new m_memory (%d + %d + %d bytes required)",
11955 m_dblen + 1, m_tbllen + 1, m_colcnt);
11956 DBUG_RETURN(-1);
11957 }
11958
11959 memcpy((void*)m_dbnam, new_db, m_dblen + 1);
11960 memcpy((void*)m_tblnam, tblnam, m_tbllen + 1);
11961 memcpy(m_coltype, coltype, m_colcnt);
11962
11963 my_free(memory);
11964 DBUG_RETURN(0);
11965}
11966#endif /* MYSQL_CLIENT */
11865/*11967/*
11866 Return value is an error code, one of:11968 Return value is an error code, one of:
1186711969
1186811970
=== modified file 'sql/log_event.h'
--- sql/log_event.h 2013-10-23 08:48:28 +0000
+++ sql/log_event.h 2014-02-15 00:30:14 +0000
@@ -3861,7 +3861,10 @@
3861 const Table_id& get_table_id() const { return m_table_id; }3861 const Table_id& get_table_id() const { return m_table_id; }
3862 const char *get_table_name() const { return m_tblnam; }3862 const char *get_table_name() const { return m_tblnam; }
3863 const char *get_db_name() const { return m_dbnam; }3863 const char *get_db_name() const { return m_dbnam; }
38643864#ifdef MYSQL_CLIENT
3865 int rewrite_db(const char* new_name, size_t new_name_len,
3866 const Format_description_log_event*);
3867#endif
3865 virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }3868 virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
3866 virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }3869 virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
38673870

Subscribers

People subscribed via source and target branches