mariadb/storage/heap
Aleksey Midenkov ab90eaad79 MDEV-22695 Server crashes in heap_rnext upon DELETE from a HEAP table
Quick read record uses different handler (H1) for finding records. It
cannot use ha_delete_row() handler (H2) as it is different search
mode: inited == INDEX for H1, inited == RND for H2. So, read handler
H1 uses index while write handler H2 uses random access.

For going next record in H1 there is info->last_pos optimization for
stepping index via tree_search_next(). This optimization can work with
deleted rows only if delete is conducted in the same handler, there
is:

67      int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
68                         const uchar *record, uchar *recpos, int flag)
69      {
...
74        if (flag)
75          info->last_pos= NULL; /* For heap_rnext/heap_rprev */

But this cannot work for different handler. So, last_pos in H1 after
delete in H2 contains stale info->parents array and last_pos points
into that parents. In the specific test case last_pos' parent is
already freed node and tree_search_next() steps into it.

The fix invalidates local savings of info->parents and info->last_pos
based on key_version. Record deletion increments share->key_version in
H2, so in H1 we know the tree might be changed.

Another good measure would be to use H1 for delete. But this is bigger
refactoring than just bug fixing.
2025-01-14 18:56:13 +03:00
..
mysql-test/mtr2 overlay support for mysql-test-run and mysqltest 2012-02-23 07:50:11 +01:00
_check.c Merge 5.5 into 10.1 2019-11-06 08:17:03 +02:00
_rectest.c Update FSF Address 2019-05-11 21:29:06 +03:00
ChangeLog Fix various spelling errors still found in code 2021-03-22 18:10:39 +11:00
CMakeLists.txt Add -berok for head test on AIX 2020-12-16 08:07:04 +11:00
ha_heap.cc MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS 2024-05-06 17:16:10 +02:00
ha_heap.h MDEV-33746 Supply missing override markings 2024-06-20 11:32:13 -04:00
heapdef.h cleanup, less #ifdef's 2020-07-04 01:44:46 +02:00
hp_block.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_clear.c Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
hp_close.c MDEV-18783 - Server crash in hp_rb_make_key 2019-10-30 12:52:19 +04:00
hp_create.c MDEV-34348: Consolidate cmp function declarations 2024-11-23 08:14:22 -07:00
hp_delete.c Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
hp_extra.c Update FSF Address 2019-05-11 21:29:06 +03:00
hp_hash.c Added page_range to records_in_range() to improve range statistics 2020-03-27 03:54:45 +02:00
hp_info.c MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO 2024-05-22 09:18:09 +10:00
hp_open.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_panic.c Update FSF Address 2019-05-11 21:29:06 +03:00
hp_rename.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_rfirst.c Update FSF Address 2019-05-11 21:29:06 +03:00
hp_rkey.c Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
hp_rlast.c Update FSF Address 2019-05-11 21:29:06 +03:00
hp_rnext.c MDEV-22695 Server crashes in heap_rnext upon DELETE from a HEAP table 2025-01-14 18:56:13 +03:00
hp_rprev.c MDEV-22695 Server crashes in heap_rnext upon DELETE from a HEAP table 2025-01-14 18:56:13 +03:00
hp_rrnd.c Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
hp_rsame.c Update FSF Address 2019-05-11 21:29:06 +03:00
hp_scan.c MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING 2019-08-20 15:37:08 +02:00
hp_static.c perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
hp_test1.c Fix clang -Wunused-but-set-variable in unit tests 2022-07-26 08:18:36 +03:00
hp_test2.c Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
hp_update.c MDEV-35343 ha_heap: recover the cursor after failed ha_update_row 2025-01-14 18:56:13 +03:00
hp_write.c MDEV-18844 Implement EXCEPT ALL and INTERSECT ALL operations 2019-08-24 21:44:41 +08:00