MDEV-23072 Diskspace not reused for Blob in data file

- This issue is caused by commit a4948daf.
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ä
parent 00bf4882
...@@ -5469,7 +5469,6 @@ btr_cur_optimistic_delete_func( ...@@ -5469,7 +5469,6 @@ btr_cur_optimistic_delete_func(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_; rec_offs* offsets = offsets_;
ibool no_compress_needed;
rec_offs_init(offsets_); rec_offs_init(offsets_);
ut_ad(flags == 0 || flags == BTR_CREATE_FLAG); ut_ad(flags == 0 || flags == BTR_CREATE_FLAG);
...@@ -5490,6 +5489,20 @@ btr_cur_optimistic_delete_func( ...@@ -5490,6 +5489,20 @@ btr_cur_optimistic_delete_func(
rec = btr_cur_get_rec(cursor); 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 if (UNIV_UNLIKELY(block->page.id.page_no() == cursor->index->page
&& page_get_n_recs(block->frame) == 1 && page_get_n_recs(block->frame) == 1
+ (cursor->index->is_instant() + (cursor->index->is_instant()
...@@ -5528,18 +5541,10 @@ btr_cur_optimistic_delete_func( ...@@ -5528,18 +5541,10 @@ btr_cur_optimistic_delete_func(
index->remove_instant(); 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_t* page = buf_block_get_frame(block);
page_zip_des_t* page_zip= buf_block_get_page_zip(block); page_zip_des_t* page_zip= buf_block_get_page_zip(block);
...@@ -5599,10 +5604,6 @@ btr_cur_optimistic_delete_func( ...@@ -5599,10 +5604,6 @@ btr_cur_optimistic_delete_func(
ibuf_update_free_bits_low(block, max_ins, mtr); 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: func_exit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment