From 47d84cab8157cf88faabb01c06acce71274a2843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Jun 2018 21:23:54 +0300 Subject: [PATCH] Fix annotate_rows and binlog name processing The four extra bytes added by the binlog checksums weren't ignored. This caused the info messages to display the binary data of the checksum. --- server/modules/routing/avrorouter/avro_file.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_file.cc b/server/modules/routing/avrorouter/avro_file.cc index c2c60b777..2a9913e00 100644 --- a/server/modules/routing/avrorouter/avro_file.cc +++ b/server/modules/routing/avrorouter/avro_file.cc @@ -614,7 +614,7 @@ avro_binlog_end_t avro_read_all_events(Avro *router) { int len = hdr.event_size - BINLOG_EVENT_HDR_LEN - 8; - if (found_chksum) + if (found_chksum || router->binlog_checksum) { len -= 4; } @@ -634,7 +634,8 @@ avro_binlog_end_t avro_read_all_events(Avro *router) else if (hdr.event_type == MARIADB_ANNOTATE_ROWS_EVENT) { // This appears to need special handling - MXS_INFO("Annotate_rows_event: %.*s", hdr.event_size - BINLOG_EVENT_HDR_LEN, ptr); + int annotate_len = hdr.event_size - BINLOG_EVENT_HDR_LEN - (found_chksum || router->binlog_checksum ? 4 : 0); + MXS_INFO("Annotate_rows_event: %.*s", annotate_len, ptr); pos += hdr.event_size; router->current_pos = pos; gwbuf_free(result);