summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-09-26 09:49:50 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-10-13 09:40:41 +0200
commiteb0804ef5e7eeb059bb193c3c6787e8a4188d34d (patch)
tree7a159b51f5ddd8d936185cb61b66a3c1c535e2d0 /sql/sql_repl.cc
parent833637144178dcae60e7bb732dd373679f32d853 (diff)
downloadmariadb-git-eb0804ef5e7eeb059bb193c3c6787e8a4188d34d.tar.gz
MDEV-18553: MDEV-16327 pre-requisits part 1: isolation of LIMIT/OFFSET handling
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a0f952955d5..82d105a869f 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -4013,7 +4013,7 @@ bool mysql_show_binlog_events(THD* thd)
if (binary_log->is_open())
{
SELECT_LEX_UNIT *unit= &thd->lex->unit;
- ha_rows event_count, limit_start, limit_end;
+ ha_rows event_count;
my_off_t pos = MY_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
char search_file_name[FN_REFLEN], *name;
const char *log_file_name = lex_mi->log_file_name;
@@ -4028,8 +4028,6 @@ bool mysql_show_binlog_events(THD* thd)
}
unit->set_limit(thd->lex->current_select);
- limit_start= unit->offset_limit_cnt;
- limit_end= unit->select_limit_cnt;
name= search_file_name;
if (log_file_name)
@@ -4108,7 +4106,7 @@ bool mysql_show_binlog_events(THD* thd)
description_event,
opt_master_verify_checksum)); )
{
- if (event_count >= limit_start &&
+ if (!unit->lim.check_and_move_offset() &&
ev->net_send(protocol, linfo.log_file_name, pos))
{
errmsg = "Net error";
@@ -4142,11 +4140,11 @@ bool mysql_show_binlog_events(THD* thd)
pos = my_b_tell(&log);
- if (++event_count >= limit_end)
+ if (++event_count >= unit->lim.get_select_limit())
break;
}
- if (unlikely(event_count < limit_end && log.error))
+ if (unlikely(event_count < unit->lim.get_select_limit() && log.error))
{
errmsg = "Wrong offset or I/O error";
mysql_mutex_unlock(log_lock);