• Marko Mäkelä's avatar
    Bug #55284 Double BLOB free due to lock wait while updating PRIMARY KEY · 721a890e
    Marko Mäkelä authored
    This bug fix requires that Bug #58912 be fixed as well (bzr revision id
    marko.makela@oracle.com-20101221093919-mcmmgd4zpse9567d). Otherwise,
    another double BLOB free could occur when InnoDB would try to perform
    an update-in-place as delete-and-insert-by-update-in-place.
    
    row_upd_clust_rec_by_insert(): Do not disown the externally stored
    columns from the old record (btr_cur_mark_extern_inherited_fields())
    until after checking the foreign key constraints and successfully
    inserting the updated record. If a lock wait timeout occurs between
    the delete-marking of the old record and the insertion of the updated
    record, mark the columns inherited before retrying the insert.
    Distinguish the state UPD_NODE_INSERT_BLOB from
    UPD_NODE_INSERT_CLUSTERED.
    
    btr_cur_del_mark_set_clust_rec(): Replace the cursor with
    block,rec,index,offsets so that the offsets need not be recalculated.
    Assert that rec is on a clustered index leaf page.
    
    btr_cur_disown_inherited_fields(): Renamed from
    btr_cur_mark_extern_inherited_fields(). Use
    upd_get_field_by_field_no(). Assert that there are externally stored
    columns. Assert that a mini-transaction is passed. Remove the return
    status. (The only caller, row_upd_clust_rec_by_insert(), will have
    determined that some fields have changed ownership.)
    
    btr_cur_mark_dtuple_inherited_extern(): Rename to
    row_upd_clust_rec_by_insert_inherit_func() and declare as static. Add
    the debug parameters rec, offsets. When rec is given, assert that the
    off-page columns match those in the inesrt tuple and that the off-page
    columns are owned by the record. Assert that the non-updated off-page
    columns in the insert tuple are owned, and mark them inherited.
    
    row_upd_clust_rec_by_insert_inherit(): A wrapper macro for
    row_upd_clust_rec_by_insert_inherit_func().
    
    row_undo_mod_upd_exist_sec(): Adjust a comment about
    row_upd_clust_rec_by_insert().
    
    rb:508 approved by Jimmy Yang
    721a890e
btr0cur.c 133 KB