diff options
author | unknown <knielsen@knielsen-hq.org> | 2012-03-01 12:41:49 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2012-03-01 12:41:49 +0100 |
commit | 22a504f89794f6517bc091b8d1f945b9aece7c18 (patch) | |
tree | 6c2bb074e63c752293c83176d894bfc3d57fb3b9 /client | |
parent | 4e8bb265fef04c0e331dc78bdfdda6b41e918dfd (diff) | |
parent | 9313032283f1650d11fb36066f31d966e8492bdc (diff) | |
download | mariadb-git-22a504f89794f6517bc091b8d1f945b9aece7c18.tar.gz |
Merge MWL#234: @@skip_replication feature to MariaDB 5.5.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlbinlog.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 5ffde0cf1b0..ccbd2fb4d22 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -751,6 +751,31 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev) /** + Print "SET skip_replication=..." statement when needed. + + Not all servers support this (only MariaDB from some version on). So we + mark the SET to only execute from the version of MariaDB that supports it, + and also only output it if we actually see events with the flag set, to not + get spurious errors on MySQL@Oracle servers of higher version that do not + support the flag. + + So we start out assuming @@skip_replication is 0, and only output a SET + statement when it changes. +*/ +static void +print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev) +{ + int cur_val; + + cur_val= (ev->flags & LOG_EVENT_SKIP_REPLICATION_F) != 0; + if (cur_val == pinfo->skip_replication) + return; /* Not changed. */ + fprintf(result_file, "/*!50521 SET skip_replication=%d*/%s\n", + cur_val, pinfo->delimiter); + pinfo->skip_replication= cur_val; +} + +/** Prints the given event in base64 format. The header is printed to the head cache and the body is printed to @@ -893,7 +918,10 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, goto end; } else + { + print_skip_replication_statement(print_event_info, ev); ev->print(result_file, print_event_info); + } break; } @@ -923,7 +951,10 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, goto end; } else + { + print_skip_replication_statement(print_event_info, ev); ce->print(result_file, print_event_info, TRUE); + } // If this binlog is not 3.23 ; why this test?? if (glob_description_event->binlog_version >= 3) @@ -1027,6 +1058,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, if (fname) { convert_path_to_forward_slashes(fname); + print_skip_replication_statement(print_event_info, ev); exlq->print(result_file, print_event_info, fname); } else @@ -1156,6 +1188,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, /* FALL THROUGH */ } default: + print_skip_replication_statement(print_event_info, ev); ev->print(result_file, print_event_info); } } |