mirror of
https://github.com/MariaDB/server.git
synced 2025-03-25 16:38:43 +01:00
![]() 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. |
||
---|---|---|
.. | ||
mysql-test/mtr2 | ||
_check.c | ||
_rectest.c | ||
ChangeLog | ||
CMakeLists.txt | ||
ha_heap.cc | ||
ha_heap.h | ||
heapdef.h | ||
hp_block.c | ||
hp_clear.c | ||
hp_close.c | ||
hp_create.c | ||
hp_delete.c | ||
hp_extra.c | ||
hp_hash.c | ||
hp_info.c | ||
hp_open.c | ||
hp_panic.c | ||
hp_rename.c | ||
hp_rfirst.c | ||
hp_rkey.c | ||
hp_rlast.c | ||
hp_rnext.c | ||
hp_rprev.c | ||
hp_rrnd.c | ||
hp_rsame.c | ||
hp_scan.c | ||
hp_static.c | ||
hp_test1.c | ||
hp_test2.c | ||
hp_update.c | ||
hp_write.c |