diff options
author | unknown <marko@hundin.mysql.fi> | 2005-03-01 13:54:48 +0200 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2005-03-01 13:54:48 +0200 |
commit | b9b69440c10296bce67bbdaab2c4dbc0d9ba9243 (patch) | |
tree | e9beb9a3927aeb8ca7ad47994c4a5841947c0589 /innobase/btr/btr0cur.c | |
parent | 679088a2ae1353f14a970182fa64f58170e81b72 (diff) | |
download | mariadb-git-b9b69440c10296bce67bbdaab2c4dbc0d9ba9243.tar.gz |
InnoDB: Zero fill newly created pages and deleted records to
remove old junk and to improve compression ratio.
InnoDB: Make implicit type conversions explicit. (Bug #8826)
innobase/btr/btr0cur.c:
Add "offsets" parameter to page_cur_delete_rec() calls
btr_cur_optimistic_delete(): Simplify the logic with a flag variable
btr_cur_pessimistic_delete(): Compute "offsets" earlier
innobase/include/page0cur.h:
page_cur_delete_rec(): Add parameter "offsets"
innobase/include/page0page.h:
page_mem_free(): Replace parameter "index" with "offsets"
innobase/include/page0page.ic:
page_mem_free(): Replace parameter "index" with "offsets".
Clear the data bytes of the freed record.
(The "extra" bytes will be needed by free space management.)
innobase/include/rem0rec.h:
Remove unnecessary function rec_get_size()
innobase/log/log0recv.c:
Remove function rec_apply_log_recs_for_backup()
unless #ifdef UNIV_HOTBACKUP.
innobase/page/page0cur.c:
Add parameter "offsets" to page_cur_delete_rec().
innobase/page/page0page.c:
page_create(): Zero fill the data area.
page_delete_rec_list_start(): Add parameter "offsets"
to page_cur_delete_rec().
innobase/rem/rem0rec.c:
Remove unnecessary function rec_get_size().
Fix compiler warnings about implicit type conversions. (Bug #8826)
innobase/srv/srv0srv.c:
Fix compiler warnings about implicit type conversions. (Bug #8826)
innobase/sync/sync0sync.c:
Fix compiler warnings about implicit type conversions. (Bug #8826)
Diffstat (limited to 'innobase/btr/btr0cur.c')
-rw-r--r-- | innobase/btr/btr0cur.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 8559df16d08..91ba47224ef 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -1642,7 +1642,7 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); - page_cur_delete_rec(page_cursor, index, mtr); + page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); @@ -1885,7 +1885,7 @@ btr_cur_pessimistic_update( btr_search_update_hash_on_delete(cursor); - page_cur_delete_rec(page_cursor, index, mtr); + page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); @@ -2401,6 +2401,7 @@ btr_cur_optimistic_delete( mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; ulint* offsets = offsets_; + ibool no_compress_needed; ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); @@ -2414,9 +2415,11 @@ btr_cur_optimistic_delete( offsets = rec_get_offsets(rec, cursor->index, offsets, ULINT_UNDEFINED, &heap); - if (!rec_offs_any_extern(offsets) + no_compress_needed = !rec_offs_any_extern(offsets) && btr_cur_can_delete_without_compress( - cursor, rec_offs_size(offsets), mtr)) { + cursor, rec_offs_size(offsets), mtr); + + if (no_compress_needed) { lock_update_delete(rec); @@ -2425,20 +2428,17 @@ btr_cur_optimistic_delete( max_ins_size = page_get_max_insert_size_after_reorganize(page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), - cursor->index, mtr); + cursor->index, offsets, mtr); ibuf_update_free_bits_low(cursor->index, page, max_ins_size, mtr); - if (heap) { - mem_heap_free(heap); - } - return(TRUE); } if (heap) { mem_heap_free(heap); } - return(FALSE); + + return(no_compress_needed); } /***************************************************************** @@ -2478,6 +2478,7 @@ btr_cur_pessimistic_delete( ibool success; ibool ret = FALSE; mem_heap_t* heap; + ulint* offsets; page = btr_cur_get_page(cursor); tree = btr_cur_get_tree(cursor); @@ -2503,20 +2504,20 @@ btr_cur_pessimistic_delete( } } - heap = mem_heap_create(256); + heap = mem_heap_create(1024); rec = btr_cur_get_rec(cursor); + offsets = rec_get_offsets(rec, cursor->index, + NULL, ULINT_UNDEFINED, &heap); + /* Free externally stored fields if the record is neither a node pointer nor in two-byte format. - This avoids unnecessary calls to rec_get_offsets(). */ + This avoids an unnecessary loop. */ if (cursor->index->table->comp ? !rec_get_node_ptr_flag(rec) : !rec_get_1byte_offs_flag(rec)) { btr_rec_free_externally_stored_fields(cursor->index, - rec, rec_get_offsets(rec, cursor->index, - NULL, ULINT_UNDEFINED, &heap), - in_rollback, mtr); - mem_heap_empty(heap); + rec, offsets, in_rollback, mtr); } if ((page_get_n_recs(page) < 2) @@ -2568,7 +2569,8 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); - page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); + page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, + offsets, mtr); ut_ad(btr_check_node_ptr(tree, page, mtr)); |