| Bug #118695 | This if condition seems to be useless in btr0cur.cc:1398 | ||
|---|---|---|---|
| Submitted: | 22 Jul 7:11 | Modified: | 23 Jul 7:33 |
| Reporter: | jie xu | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[22 Jul 9:27]
jie xu
```
/* If the first or the last record of the page
or the same key value to the first record or last record,
the another page might be choosen when BTR_CONT_MODIFY_TREE.
So, the parent page should not released to avoiding deadlock
with blocking the another search with the same key value. */
if (!detected_same_key_root && lock_intention == BTR_INTENTION_BOTH &&
!dict_index_is_unique(index) && latch_mode == BTR_MODIFY_TREE &&
(up_match >= rec_offs_n_fields(offsets) - 1 ||
low_match >= rec_offs_n_fields(offsets) - 1)) {
```
Those code was originally added by wl6326. I commented out the entire if condition, and run the test case ./mtr innodb.innodb_wl6326 still passed successfully.
[23 Jul 5:12]
MySQL Verification Team
Hello jie xu, Thank you for the report and feedback. I'm verifying this report so that development can take a call on this. Did you use innodb_wl6326.test from 5.7 build? I'm unable to locate in 8.0+ builds. Thank you regards, Umesh
[23 Jul 7:33]
jie xu
yes, I move innodb_wl6326.test from 5.7 build to 8.0 build. and run it

Description: ``` /* If the first or the last record of the page or the same key value to the first record or last record, the another page might be chosen when BTR_CONT_MODIFY_TREE. So, the parent page should not released to avoiding deadlock with blocking the another search with the same key value. */ if (!detected_same_key_root && lock_intention == BTR_INTENTION_BOTH && !dict_index_is_unique(index) && latch_mode == BTR_MODIFY_TREE && (up_match >= rec_offs_n_fields(offsets) - 1 || low_match >= rec_offs_n_fields(offsets) - 1)) { ``` This conditional check seems to be unnecessary, because for a secondary index (non-unique index), the comparison on non-leaf pages includes both the index columns and the primary key. Since the primary key already guarantees uniqueness, there cannot be key values with the exact same index key. How to repeat: Read the latest code Suggested fix: remove this useless code.