From e6d1aa27f4a81da1a6725a4209bc09ad334d664b Mon Sep 17 00:00:00 2001 From: Roman Nozdrin Date: Wed, 8 Apr 2020 13:41:30 +0000 Subject: [PATCH] MCOL-3903 10.5 allows engines to process LIMIT and OFFSET on their own. --- dbcon/mysql/ha_mcs_execplan.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index eca370187..d75137728 100755 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -6617,7 +6617,6 @@ int processLimitAndOffset( if (select_lex.join) { JOIN* join = select_lex.join; -#if MYSQL_VERSION_ID >= 50172 // @bug5729. After upgrade, join->unit sometimes is uninitialized pointer // (not null though) and will cause seg fault. Prefer checking @@ -6633,14 +6632,9 @@ int processLimitAndOffset( } else if (join->unit) { - limitOffset = join->unit->offset_limit_cnt; - limitNum = join->unit->select_limit_cnt - limitOffset; + limitOffset = join->unit->lim.get_offset_limit(); + limitNum = join->unit->lim.get_select_limit() - limitOffset; } - -#else - limitOffset = (join->unit)->offset_limit_cnt; - limitNum = (join->unit)->select_limit_cnt - (join->unit)->offset_limit_cnt; -#endif } else { @@ -6675,23 +6669,6 @@ int processLimitAndOffset( return ER_CHECK_NOT_IMPLEMENTED; } - // MDB applies OFFSET on its own for SH processing. - // See related MDEV-16327 for details. - if (isSelectHandlerTop && csep->limitStart()) - { - if (std::numeric_limits::max()-csep->limitStart() - < csep->limitNum()) - { - csep->limitNum(std::numeric_limits::max()); - csep->limitStart(0); - } - else - { - csep->limitNum(csep->limitNum()+csep->limitStart()); - csep->limitStart(0); - } - } - return 0; }