summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2020-08-11 21:45:09 +0300
committerAndrei Elkin <andrei.elkin@mariadb.com>2020-08-31 18:37:44 +0300
commit6112a0f93d137b9754bc04449873311784e0edd9 (patch)
treedc038437c44d0397460a3acf624163c370d86b81 /sql/log_event.h
parent9bb17ecf4352e0ba009d6afb9260d291ed70fa4c (diff)
downloadmariadb-git-6112a0f93d137b9754bc04449873311784e0edd9.tar.gz
MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log via mysqlbinlog --verbose
(This commit is exclusively for 10.2 branch. Do not merge it to 10.3) In case of a pattern of non-STMT_END-marked Rows-log-event (A) followed by a STMT_END marked one (B) mysqlbinlog mixes up the base64 encoded rows events with their pseudo sql representation produced by the verbose option: BINLOG ' base64 encoded data for A ### verbose section for A base64 encoded data for B ### verbose section for B '/*!*/; In effect the produced BINLOG '...' query is not valid and is rejected with the error. Examples of this way malformed BINLOG could have been found in binlog_row_annotate.result that gets corrected with the patch. The issue is fixed with introduction an auxiliary IO_CACHE to hold on the verbose comments until the terminal STMT_END event is found. The new cache is emptied out after two pre-existing ones are done at that time. The correctly produced output now for the above case is as the following: BINLOG ' base64 encoded data for A base64 encoded data for B '/*!*/; ### verbose section for A ### verbose section for B Thanks to Alexey Midenkov for the problem recognition and attempt to tackle, and to Venkatesh Duggirala who produced a patch for the upstream whose idea is exploited here, as well as to MDEV-23077 reporter LukeXwang who also contributed a piece of a patch aiming at this issue.
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 1fae201057f..3fc44a9669f 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -848,18 +848,19 @@ typedef struct st_print_event_info
~st_print_event_info() {
close_cached_file(&head_cache);
close_cached_file(&body_cache);
+ close_cached_file(&tail_cache);
#ifdef WHEN_FLASHBACK_REVIEW_READY
close_cached_file(&review_sql_cache);
#endif
}
bool init_ok() /* tells if construction was successful */
- { return my_b_inited(&head_cache) && my_b_inited(&body_cache)
+ { return my_b_inited(&head_cache) && my_b_inited(&body_cache) &&
+ my_b_inited(&tail_cache)
#ifdef WHEN_FLASHBACK_REVIEW_READY
&& my_b_inited(&review_sql_cache)
#endif
; }
-
/* Settings on how to print the events */
bool short_form;
enum_base64_output_mode base64_output_mode;
@@ -885,6 +886,7 @@ typedef struct st_print_event_info
*/
IO_CACHE head_cache;
IO_CACHE body_cache;
+ IO_CACHE tail_cache;
#ifdef WHEN_FLASHBACK_REVIEW_READY
/* Storing the SQL for reviewing */
IO_CACHE review_sql_cache;