Commit 0da0bf2
committed
MDEV-37294 segv in flst::remove_complete(buf_block_t*, unsigned short, unsigned char*, mtr_t*)
Problem:
=======
During system tablespace defragmentation, extent movement occurs
in two phases: prepare and complete.
1) prepare phase validates involved pages and acquires necessary
resources.
2) complete phase performs the actual data copy.
Prepare phase fails to check whether allocating a page will
make the extent FULL. When an extent has exactly (extent_size - 1)
pages used, the prepare phase returns early without latching
the prev/next extent descriptors needed for list manipulation.
Complete phase then allocates the final page, making the
extent full, and attempts to move it from
FSEG_NOT_FULL/FSP_FREE_FRAG to FSEG_FULL/FSP_FULL_FRAG list.
This fails with an assertion because the required blocks were
never latched, causing a crash in flst::remove_complete().
Solution:
========
alloc_from_fseg_prepare(), alloc_from_free_frag_prepare():
call these function only if the extent will be full after
allocation. This makes the
prepare phase to acquire the necessary pages for FSP list manipulation
find_new_extents(): Print more revised information about moving
of extent data and destination extent also.
defragment_level(): Move get_child_pages(new_block) before committing
changes to enable proper rollback on failure. Well, this failure
is theoretically impossible (new block is exact copy of
validated old block).1 parent 39edbba commit 0da0bf2
1 file changed
+36
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4610 | 4610 | | |
4611 | 4611 | | |
4612 | 4612 | | |
4613 | | - | |
4614 | | - | |
4615 | | - | |
4616 | | - | |
4617 | | - | |
4618 | | - | |
4619 | | - | |
4620 | 4613 | | |
4621 | 4614 | | |
4622 | 4615 | | |
| |||
4683 | 4676 | | |
4684 | 4677 | | |
4685 | 4678 | | |
4686 | | - | |
4687 | | - | |
4688 | | - | |
4689 | | - | |
4690 | | - | |
4691 | | - | |
4692 | | - | |
4693 | 4679 | | |
4694 | 4680 | | |
4695 | 4681 | | |
| |||
5085 | 5071 | | |
5086 | 5072 | | |
5087 | 5073 | | |
5088 | | - | |
5089 | | - | |
5090 | | - | |
| 5074 | + | |
| 5075 | + | |
| 5076 | + | |
| 5077 | + | |
| 5078 | + | |
5091 | 5079 | | |
5092 | | - | |
5093 | 5080 | | |
5094 | 5081 | | |
5095 | | - | |
| 5082 | + | |
5096 | 5083 | | |
5097 | 5084 | | |
5098 | 5085 | | |
| |||
5376 | 5363 | | |
5377 | 5364 | | |
5378 | 5365 | | |
5379 | | - | |
5380 | | - | |
5381 | | - | |
5382 | | - | |
| 5366 | + | |
| 5367 | + | |
| 5368 | + | |
| 5369 | + | |
| 5370 | + | |
| 5371 | + | |
| 5372 | + | |
| 5373 | + | |
| 5374 | + | |
| 5375 | + | |
| 5376 | + | |
| 5377 | + | |
| 5378 | + | |
| 5379 | + | |
| 5380 | + | |
| 5381 | + | |
| 5382 | + | |
| 5383 | + | |
| 5384 | + | |
| 5385 | + | |
| 5386 | + | |
| 5387 | + | |
| 5388 | + | |
| 5389 | + | |
5383 | 5390 | | |
5384 | 5391 | | |
5385 | 5392 | | |
| |||
5626 | 5633 | | |
5627 | 5634 | | |
5628 | 5635 | | |
| 5636 | + | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
5629 | 5642 | | |
5630 | 5643 | | |
5631 | 5644 | | |
| |||
5635 | 5648 | | |
5636 | 5649 | | |
5637 | 5650 | | |
5638 | | - | |
5639 | | - | |
5640 | | - | |
5641 | | - | |
5642 | | - | |
5643 | 5651 | | |
5644 | 5652 | | |
5645 | 5653 | | |
| |||
0 commit comments