Bug #103871 No need to memory copy
Submitted: 1 Jun 2021 7:28 Modified: 1 Jun 2021 13:42
Reporter: alex xing (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[1 Jun 2021 7:28] alex xing
Description:
In function recv_recover_page_func,it is no need to copy memory if not met to redo apply condition.
It is better to maintain "byte *buf" if  redo apply condition is met.

How to repeat:
read the code

Suggested fix:
do memory copy and momory free if redo apply condition is met.
[1 Jun 2021 8:07] alex xing
a simple patch to describe the optimization

Attachment: commit.patch (text/plain), 2.17 KiB.

[1 Jun 2021 8:19] alex xing
During crash recovery, redo apply is required only if the redo meets certain conditions:recv->start_lsn >= page_lsn and the space is active.
However, MySQL do  memory copy before determining the above conditions.In fact, if this condition is not met, there is no need to copy memory ahead of time.
[1 Jun 2021 13:27] alex xing
a simple patch to describe the optimization

Attachment: commit.patch (text/plain), 2.17 KiB.

[1 Jun 2021 13:42] MySQL Verification Team
Hi Mr. xing,

Thank you for your performance improvement report.

We fully understand and approve your reasoning.

We are also very grateful for your patch.

Verified as reported.
[7 Jun 2021 13:32] alex xing
It's the same file as before,just retry for OCA

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

Contribution: commit.patch (text/plain), 2.17 KiB.

[7 Jun 2021 15:08] MySQL Verification Team
Hi Mr. xing,

Thank you very much for your contribution.