Bug #113658 Avoid unnecessary copy operations with std::move()

Submitted: 17 Jan 2024 5:55 Modified: 17 Jan 2024 6:31
Reporter: alex xing (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[17 Jan 2024 5:55] alex xing
Description:
Avoid unnecessary copy operations with std::move() for trx_rseg_mem_create
and other code logic can take a similar approach

How to repeat:
just read the code

Suggested fix:
    code in trx_rseg_mem_create

     if (rseg->last_page_no != FIL_NULL) {
      /* The only time an rseg is added that has existing
      undo is when the server is being started. So no
      mutex is needed here. */
      ut_ad(srv_is_being_started);

      ut_ad(space_id == TRX_SYS_SPACE ||
            (srv_is_upgrade_mode != undo::is_reserved(space_id)));
      //modify this line
      purge_queue->push(std::move(elem));
    }
[17 Jan 2024 5:56] alex xing
a simple patch to describe the optimization based on 8.0.32

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

Contribution: optimize.patch (text/plain), 9.58 KiB.

[17 Jan 2024 6:31] MySQL Verification Team
Hello Alex Xing,

Thank you for the report and contribution.

regards,
umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.