Bug #117259 Bugfix of Bug#37318367 in 8.0.41 contains an obvious logical issue
Submitted: 22 Jan 7:17 Modified: 22 Jan 7:51
Reporter: Yichang SONG (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0.41 OS:Any
Assigned to: CPU Architecture:Any

[22 Jan 7:17] Yichang SONG
Description:
The bugfix f682827fe91bf2b61ca91b26da20dddf50f756ef
```
Bug#37318367 Inplace ALTER on table with spatial idx might cause lost rows if concurrent purge
```

add a new restore API restore_to_first_unprocessed().

For function btr_pcur_t::is_after_last_on_page() and btr_pcur_t::move_to_next_on_page(),the assertion 
```
ut_ad(m_pos_state == BTR_PCUR_IS_POSITIONED) 
```
requires the m_pos_state to be BTR_PCUR_IS_POSITIONED.

At storage/innobase/row/row0pread.cc:446, the code attempts to execute operations (is_after_last_on_page() and move_to_next_on_page()) that are strictly permitted only in BTR_PCUR_IS_POSITIONED state, while the cursor is actually in BTR_PCUR_IS_POSITIONED_OPTIMISTIC state. This violates will trigger assertion failures in debug builds.

How to repeat:
This logical issue is visible even to the naked eye.
[22 Jan 7:51] MySQL Verification Team
Hello Yichang Song,

Thank you for the report and feedback.

regards,
Umesh