summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-01-08 13:53:03 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-01-08 13:53:03 +0530
commit4032fc1d681f9398e181490ed6808bd0fe3af8ca (patch)
tree18ad58a28f82545381e875128abdffb0ffcb6183 /sql/sql_repl.cc
parentd2697dfbc63a44544c8fd8a80259d22366bf68b3 (diff)
parentb365b6e7d8499240133682827b077f230ed0bbfa (diff)
downloadmariadb-git-4032fc1d681f9398e181490ed6808bd0fe3af8ca.tar.gz
Merge branch '10.3' into 10.4
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 202cfaa9ea7..31304c60418 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3975,6 +3975,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;
@@ -4030,6 +4035,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;
@@ -4109,15 +4118,16 @@ bool mysql_show_binlog_events(THD* thd)
for (event_count = 0;
(ev = Log_event::read_log_event(&log,
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)
@@ -4143,10 +4153,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 (unlikely(event_count < limit_end && log.error))