From 880a55f77962ad240e9537dd7a2d694674a1111a Mon Sep 17 00:00:00 2001 From: marko Date: Tue, 16 Dec 2008 13:56:48 +0000 Subject: [PATCH] branches/innodb+: Merge revisions 3541:3544 from branches/zip: ------------------------------------------------------------------------ r3541 | marko | 2008-12-16 12:14:58 +0200 (Tue, 16 Dec 2008) | 3 lines branches/zip: btr_cur_optimistic_delete(): Note that no further pages must be latched before calling mtr_commit(mtr) if the function returns TRUE. ------------------------------------------------------------------------ r3544 | marko | 2008-12-16 15:52:36 +0200 (Tue, 16 Dec 2008) | 20 lines branches/zip: Do not update the free bits in the insert buffer bitmap when inserting or deleting from the insert buffer B-tree. Assert that records in the insert buffer B-tree are never updated. This could cure Issue #135. btr_cur_optimistic_insert(): Do not update the insert buffer bitmap when inserting to the insert buffer tree. btr_cur_optimistic_delete(): Do not update the insert buffer bitmap when deleting from the insert buffer tree. This could be the cause of the assertion failure that was reported in Issue #135. btr_cur_update_alloc_zip(): Assert that the index is not the insert buffer. The insert buffer will never be stored in compressed format. btr_cur_update_in_place(), btr_cur_optimistic_update(), btr_cur_pessimistic_update(): Assert that these functions are never invoked on the insert buffer tree. The insert buffer only supports the insertion and deletion of records. ------------------------------------------------------------------------ --- btr/btr0cur.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/btr/btr0cur.c b/btr/btr0cur.c index 3fe1bf1713b..cf7db3faf25 100644 --- a/btr/btr0cur.c +++ b/btr/btr0cur.c @@ -1357,7 +1357,9 @@ fail_err: buf_block_get_page_no(block), max_size, rec_size + PAGE_DIR_SLOT_SIZE, index->type); #endif - if (!dict_index_is_clust(index) && leaf) { + if (leaf + && !dict_index_is_clust(index) + && !dict_index_is_ibuf(index)) { /* Update the free bits of the B-tree page in the insert buffer bitmap. */ @@ -1738,6 +1740,7 @@ btr_cur_update_alloc_zip( { ut_a(page_zip == buf_block_get_page_zip(block)); ut_ad(page_zip); + ut_ad(!dict_index_is_ibuf(index)); if (page_zip_available(page_zip, dict_index_is_clust(index), length, 0)) { @@ -1814,6 +1817,9 @@ btr_cur_update_in_place( rec = btr_cur_get_rec(cursor); index = cursor->index; ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); + /* The insert buffer tree should never be updated in place. */ + ut_ad(!dict_index_is_ibuf(index)); + trx = thr_get_trx(thr); offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); #ifdef UNIV_DEBUG @@ -1950,6 +1956,8 @@ btr_cur_optimistic_update( index = cursor->index; ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); + /* The insert buffer tree should never be updated in place. */ + ut_ad(!dict_index_is_ibuf(index)); heap = mem_heap_create(1024); offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); @@ -2213,6 +2221,8 @@ btr_cur_pessimistic_update( #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page)); #endif /* UNIV_ZIP_DEBUG */ + /* The insert buffer tree should never be updated in place. */ + ut_ad(!dict_index_is_ibuf(index)); optim_err = btr_cur_optimistic_update(flags, cursor, update, cmpl_info, thr, mtr); @@ -2916,10 +2926,12 @@ btr_cur_optimistic_delete( #endif /* UNIV_ZIP_DEBUG */ if (dict_index_is_clust(cursor->index) + || dict_index_is_ibuf(cursor->index) || !page_is_leaf(page)) { /* The insert buffer does not handle - inserts to clustered indexes or to non-leaf - pages of secondary index B-trees. */ + inserts to clustered indexes, to + non-leaf pages of secondary index B-trees, + or to the insert buffer. */ } else if (page_zip) { ibuf_update_free_bits_zip(block, mtr); } else {