summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-01-07 21:17:21 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-01-07 21:29:07 +0530
commit8317f77ccc490c94f2f43d2e6d4104c87f232563 (patch)
tree2d0368127f1b5fe80441fd02569e364c91f3121e /sql/sql_repl.cc
parent0b4ae6724f2707841c50f88d8c8598f2a0cdef4a (diff)
parentcb204e11eaf4c473ce5d5a10a21de147430057dc (diff)
downloadmariadb-git-8317f77ccc490c94f2f43d2e6d4104c87f232563.tar.gz
Merge branch '10.1' into 10.2
MDEV-18046: Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events Problem: ======== SHOW BINLOG EVENTS FROM <pos> reports following assert when ASAN is enabled. uint32 binlog_get_uncompress_len(const char*): Assertion `(buf[0] & 0xe0) == 0x80' failed Fix: === **Part11: Converted debug assert to error handler code**
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 294dcc61713..a1ff4affd50 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3860,6 +3860,11 @@ bool mysql_show_binlog_events(THD* thd)
List<Item> field_list;
const char *errmsg = 0;
bool ret = TRUE;
+ /*
+ Using checksum validate the correctness of event pos specified in show
+ binlog events command.
+ */
+ bool verify_checksum_once= false;
IO_CACHE log;
File file = -1;
MYSQL_BIN_LOG *binary_log= NULL;
@@ -3915,6 +3920,10 @@ bool mysql_show_binlog_events(THD* thd)
mi= 0;
}
+ /* Validate user given position using checksum */
+ if (lex_mi->pos == pos && !opt_master_verify_checksum)
+ verify_checksum_once= true;
+
unit->set_limit(thd->lex->current_select);
limit_start= unit->offset_limit_cnt;
limit_end= unit->select_limit_cnt;
@@ -3994,15 +4003,16 @@ bool mysql_show_binlog_events(THD* thd)
for (event_count = 0;
(ev = Log_event::read_log_event(&log, (mysql_mutex_t*) 0,
description_event,
- opt_master_verify_checksum)); )
+ (opt_master_verify_checksum ||
+ verify_checksum_once))); )
{
if (event_count >= limit_start &&
- ev->net_send(protocol, linfo.log_file_name, pos))
+ ev->net_send(protocol, linfo.log_file_name, pos))
{
- errmsg = "Net error";
- delete ev;
+ errmsg = "Net error";
+ delete ev;
mysql_mutex_unlock(log_lock);
- goto err;
+ goto err;
}
if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
@@ -4028,10 +4038,11 @@ bool mysql_show_binlog_events(THD* thd)
delete ev;
}
+ verify_checksum_once= false;
pos = my_b_tell(&log);
if (++event_count >= limit_end)
- break;
+ break;
}
if (event_count < limit_end && log.error)