diff options
author | Oleg Smirnov <olernov@gmail.com> | 2022-06-04 10:16:15 +0400 |
---|---|---|
committer | Oleg Smirnov <olernov@gmail.com> | 2022-06-08 16:23:20 +0400 |
commit | 5efadf8d8c6076bbee73e45afe050ab62c517f3c (patch) | |
tree | 479dcc4c7b1a7252b3c4b6b7b380bd3d10145263 | |
parent | 09177eadc39ae1e777ad473970456cb9dd9c3993 (diff) | |
download | mariadb-git-5efadf8d8c6076bbee73e45afe050ab62c517f3c.tar.gz |
MDEV-28747 Index condition pushdown may be configured incorrectly
ha_innobase::build_template may initialize m_prebuilt->idx_cond
even if there is no valid pushed_idx_cond_keyno.
This potentially problematic piece of code was found while
working on MDEV-27366
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c8fc060ffeb..21da59d309d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7718,9 +7718,12 @@ ha_innobase::build_template( ulint num_v = 0; - if ((active_index != MAX_KEY - && active_index == pushed_idx_cond_keyno) - || (pushed_rowid_filter && rowid_filter_is_active)) { + if (active_index != MAX_KEY + && active_index == pushed_idx_cond_keyno) { + m_prebuilt->idx_cond = this; + goto icp; + } else if (pushed_rowid_filter && rowid_filter_is_active) { +icp: /* Push down an index condition or an end_range check. */ for (ulint i = 0; i < n_fields; i++) { const Field* field = table->field[i]; @@ -7901,9 +7904,6 @@ ha_innobase::build_template( } } } - if (active_index == pushed_idx_cond_keyno) { - m_prebuilt->idx_cond = this; - } } else { no_icp: /* No index condition pushdown */ |