From 36f5ea8b1092099e7ad96251bdefd43142bbe6c3 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 15 Oct 2020 13:26:18 +0530 Subject: MDEV-23072 Diskspace not reused for Blob in data file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - This issue is caused by commit a4948dafcd7eee65f16d848bdc6562fc49ef8916. Purge doesn't free the externally stored page associated with the last record of the root page. In that case, purge thread does empty the root page and leads to more orphaned blob page in the tablespace. Purge thread should free the blob even for the last record of the root page. Reviewed-by: Marko Mäkelä --- storage/innobase/btr/btr0cur.cc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index a68bc6550d7..a682148a482 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -5469,7 +5469,6 @@ btr_cur_optimistic_delete_func( mem_heap_t* heap = NULL; rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs* offsets = offsets_; - ibool no_compress_needed; rec_offs_init(offsets_); ut_ad(flags == 0 || flags == BTR_CREATE_FLAG); @@ -5490,6 +5489,20 @@ btr_cur_optimistic_delete_func( rec = btr_cur_get_rec(cursor); + offsets = rec_get_offsets(rec, cursor->index, offsets, true, + ULINT_UNDEFINED, &heap); + + const ibool no_compress_needed = !rec_offs_any_extern(offsets) + && btr_cur_can_delete_without_compress( + cursor, rec_offs_size(offsets), mtr); + + if (!no_compress_needed) { + /* prefetch siblings of the leaf for the pessimistic + operation. */ + btr_cur_prefetch_siblings(block); + goto func_exit; + } + if (UNIV_UNLIKELY(block->page.id.page_no() == cursor->index->page && page_get_n_recs(block->frame) == 1 + (cursor->index->is_instant() @@ -5528,18 +5541,10 @@ btr_cur_optimistic_delete_func( index->remove_instant(); } - return true; + goto func_exit; } - offsets = rec_get_offsets(rec, cursor->index, offsets, true, - ULINT_UNDEFINED, &heap); - - no_compress_needed = !rec_offs_any_extern(offsets) - && btr_cur_can_delete_without_compress( - cursor, rec_offs_size(offsets), mtr); - - if (no_compress_needed) { - + { page_t* page = buf_block_get_frame(block); page_zip_des_t* page_zip= buf_block_get_page_zip(block); @@ -5599,10 +5604,6 @@ btr_cur_optimistic_delete_func( ibuf_update_free_bits_low(block, max_ins, mtr); } } - } else { - /* prefetch siblings of the leaf for the pessimistic - operation. */ - btr_cur_prefetch_siblings(block); } func_exit: -- cgit v1.2.1