Bug #116489 no need to check log_upgrade when recv_apply_hashed_log_recs
Submitted: 28 Oct 2024 10:59 Modified: 28 Oct 2024 12:19
Reporter: Zihao Wang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.30 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[28 Oct 2024 10:59] Zihao Wang
Description:
Since commit b1c37b4c9bfc3b249e8bf1affc5c1413192f1d0f only do log_upgrade from a clean shutdown, and will call recreate_redo_files() before the last call to recv_apply_hashed_log_recs, it is impossible to have redo to write when log_upgrade = TRUE, and it is no need to check log_upgrade when recv_apply_hashed_log_recs.

Actually the author of commit b1c37b4c9bfc3b249e8bf1affc5c1413192f1d0f does change in srv0start.cc:

```
---const bool redo_writes_allowed = !srv_read_only_mode && !log_upgrade;
+++const bool redo_writes_allowed = !srv_read_only_mode;
```

Which proves that there will be no redo_writes when log_upgrade = TRUE.

Though the code won't cause any problem, it is better to remove the `!log_upgrade` check when giving value to `allow_ibuf` in `recv_apply_hashed_log_recs` to improve code readability.

How to repeat:
Just read the cord:
```
      /* Don't allow IBUF operations for cloned database
      recovery as it would add extra redo log and we may
      not have enough margin.

      Don't allow IBUF operations when redo is written
      in the older format than the current, because we
      would write new redo records in the current fmt,
      and end up with file in both formats = invalid. */

      err = recv_apply_hashed_log_recs(*log_sys,
                                       !recv_sys->is_cloned_db && !log_upgrade);
```

Suggested fix:
remove ` && !log_upgrade` in `err = recv_apply_hashed_log_recs(*log_sys, 
 !recv_sys->is_cloned_db && !log_upgrade);`
[28 Oct 2024 11:02] Zihao Wang
This is my fix code.

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: Bug#116489.diff (application/octet-stream, text), 936 bytes.

[28 Oct 2024 12:19] MySQL Verification Team
Hello Zihao Wang,

Thank you for the report and contribution.

regards,
Umesh