-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 733d85c
Showing
3 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Copyright (c) 2013, Heng.Wang. All rights reserved. | ||
## | ||
## MySQL patch. | ||
## | ||
## @Author: Heng.Wang | ||
## @Date : 08/05/2013 | ||
## @Email : [email protected] | ||
## [email protected] | ||
## [email protected] | ||
## @Github: https://github.com/HengWang/ | ||
## @Blog : http://hengwang.blog.chinaunix.net | ||
|
||
All of the patches in this project is based on Oracle mysql version, and the details | ||
of each patch is in the same name .txt file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
diff -uNr a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc | ||
--- a/client/mysqlbinlog.cc 2013-08-05 18:03:37.017778872 +0800 | ||
+++ b/client/mysqlbinlog.cc 2011-11-14 07:47:11.000000000 +0800 | ||
@@ -83,11 +83,6 @@ | ||
static const char* sock= 0; | ||
static char *opt_plugin_dir= 0, *opt_default_auth= 0; | ||
|
||
-/* One table to filter out. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
-static bool one_table=0; | ||
-static char* table_name = 0; | ||
- | ||
#ifdef HAVE_SMEM | ||
static char *shared_memory_base_name= 0; | ||
#endif | ||
@@ -635,24 +630,6 @@ | ||
} | ||
|
||
|
||
-/* | ||
- * Check the given table should be filtered out, according to the --table=X option | ||
- * @param | ||
- * log_tbname: Name of table. | ||
- * @return | ||
- * 0 : Skip. | ||
- * N : Filtered out. | ||
- * @author: wangheng | ||
- * @email : [email protected] | ||
- */ | ||
-static bool shall_skip_table(const char *log_tbname) | ||
-{ | ||
- return one_table && | ||
- (log_tbname != NULL) && | ||
- strcmp(log_tbname, table_name); | ||
-} | ||
- | ||
- | ||
/** | ||
Prints the given event in base64 format. | ||
|
||
@@ -795,10 +772,7 @@ | ||
related Append_block and Exec_load. | ||
Note that Load event from 3.23 is not tested. | ||
*/ | ||
- if (shall_skip_database(ce->db) | ||
- /* Filtered out the events of given table. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
- || shall_skip_table(ce->table_name)) | ||
+ if (shall_skip_database(ce->db)) | ||
goto end; // Next event | ||
/* | ||
We print the event, but with a leading '#': this is just to inform | ||
@@ -932,10 +906,7 @@ | ||
case TABLE_MAP_EVENT: | ||
{ | ||
Table_map_log_event *map= ((Table_map_log_event *)ev); | ||
- if (shall_skip_database(map->get_db_name()) | ||
- /* Filtered out the events of given table. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
- || shall_skip_table(map->get_table_name())) | ||
+ if (shall_skip_database(map->get_db_name())) | ||
{ | ||
print_event_info->m_table_map_ignored.set_table(map->get_table_id(), map); | ||
destroy_evt= FALSE; | ||
@@ -1180,12 +1151,6 @@ | ||
&stop_position, &stop_position, 0, GET_ULL, | ||
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE, | ||
(ulonglong)(~(my_off_t)0), 0, 0, 0}, | ||
- /* Add the -t/--table option. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
- {"table", 'T', "List entries for just this table in given database of" | ||
- " -d/--database option. (row mode only).", | ||
- &table_name, &table_name, 0, GET_STR_ALLOC, REQUIRED_ARG, | ||
- 0, 0, 0, 0, 0, 0}, | ||
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \ | ||
requested binlog but rather continue printing until the end of the last \ | ||
binlog of the MySQL server. If you send the output to the same MySQL server, \ | ||
@@ -1277,9 +1242,6 @@ | ||
{ | ||
my_free(pass); | ||
my_free(database); | ||
- /* Free the table name. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
- my_free(table_name); | ||
my_free(host); | ||
my_free(user); | ||
my_free(dirname_for_local_load); | ||
@@ -1346,11 +1308,6 @@ | ||
case 'd': | ||
one_database = 1; | ||
break; | ||
- /* Set the table filter flag. | ||
- * (Added by wangheng, email to [email protected]) */ | ||
- case 't': | ||
- one_table = 1; | ||
- break; | ||
case 'p': | ||
if (argument == disabled_my_option) | ||
argument= (char*) ""; // Don't require password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Copyright (c) 2013, Heng.Wang. All rights reserved. | ||
## | ||
## mysqlbinlog toolkit patch, add --table/-t option. | ||
## | ||
## @Author: Heng.Wang | ||
## @Date : 08/05/2013 | ||
## @Email : [email protected] | ||
## [email protected] | ||
## [email protected] | ||
## @Github: https://github.com/HengWang/ | ||
## @Blog : http://hengwang.blog.chinaunix.net | ||
|
||
Function: | ||
Add -T/--table option to filter out the given table events | ||
in given database of -d/--database option. The function | ||
just valid in Row mode of binlog and load data scenes. | ||
If not Row mode, the table of -T/--table option will be | ||
ignore and printing the events of given database. Because | ||
the Query_log_event has not tables variable to check, in | ||
order not to pull in new problem, I modify the structure | ||
of Query_log_event nothing. | ||
Also in load data process scenes, -T/--table option is | ||
useful to filter out the given table events. | ||
|
||
Usage: | ||
compile: | ||
The source is based on mysql-5.5.18. | ||
patch -p1 -R < mysqlbinlog_table_option.diff | ||
application: | ||
mysqlbinlog --help to show the help information. | ||
mysqlbinlog -v -v -v --database=test --table=test | ||
mysql-bin.XXXXXX | ||
mysqlbinlog -v -v -v -d test -T test mysql-bin.XXXXXX |