From 1a9011d273e0330c8242ad8857f0519bf0aa2ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 29 Nov 2024 15:12:20 +0200 Subject: [PATCH] MDEV-35525: Index corruption in reverse scans btr_cur_t::search_leaf(): In the BTR_SEARCH_PREV and BTR_MODIFY_PREV modes, reset the previous search status before invoking page_cur_search_with_match(). Otherwise, we the search could invoke in a totally wrong subtree. This fixes a regression that was introduced in commit de4030e4d49805a7ded5c0bfee01cc3fd7623522 (MDEV-30400). --- storage/innobase/btr/btr0cur.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index a5ffc825c20..6a57f2dc307 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1660,6 +1660,7 @@ release_tree: ut_ad(block_savepoint + 2 == mtr->get_savepoint()); if (ret < 0) { + up_match= 0, low_match= 0, up_bytes= 0, low_bytes= 0; /* While our latch on the level-2 page prevents splits or merges of this level-1 block, other threads may have modified it due to splitting or merging some level-0 (leaf)