Skip to content
Permalink
Browse files
MDEV-13942 InnoDB SPATIAL INDEX corruption during root page split
The problem is in rtr_adjust_upper_level(), which allocates node_ptr
from heap, and then passes the same heap to btr_cur_pessimistic_insert().
The documentation of btr_cur_pessimistic_insert() says that the heap can
be emptied. If the heap is emptied and something else is allocated from
the heap, the node_ptr can become corrupted.
  • Loading branch information
madcrab2021 authored and dr-m committed May 7, 2019
1 parent a5cfa41 commit 1214674
Showing 1 changed file with 8 additions and 1 deletion.
@@ -728,15 +728,22 @@ rtr_adjust_upper_level(
cursor.rtr_info = sea_cur->rtr_info;
cursor.tree_height = sea_cur->tree_height;

/* Recreate a memory heap as input parameter for
btr_cur_pessimistic_insert(), because the heap may be
emptied in btr_cur_pessimistic_insert(). */
mem_heap_t* new_heap = mem_heap_create(1024);

err = btr_cur_pessimistic_insert(flags
| BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG
| BTR_NO_UNDO_LOG_FLAG,
&cursor, &offsets, &heap,
&cursor, &offsets, &new_heap,
node_ptr_upper, &rec,
&dummy_big_rec, 0, NULL, mtr);
cursor.rtr_info = NULL;
ut_a(err == DB_SUCCESS);

mem_heap_free(new_heap);
}

prdt.data = static_cast<void*>(mbr);

0 comments on commit 1214674

Please sign in to comment.