Bug #109260 optimize for innodb recovery
Submitted: 1 Dec 2022 12:20 Modified: 3 Jan 2023 12:51
Reporter: alex xing (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.31 OS:Any
Assigned to: CPU Architecture:Any

[1 Dec 2022 12:20] alex xing
Description:
 As we all kown,Using a pointer as a map value reduces the overhead of copy constructor calls than using an object.
 And crash recovery code can be optimized with this in mind.
 In recv_sys_t(log0recv.h) we define :
   using Spaces = std::unordered_map<space_id_t, Space, std::hash<space_id_t>,
                                    std::equal_to<space_id_t>>;
								
 when we maintain the hash in recv_get_page_map(log0recv.cc),Some copy constructors will be generated:
     auto where = recv_sys->spaces->insert(it, Value{space_id, Space(heap)});
 
So I think we can optimize here:
     using Spaces = std::unordered_map<space_id_t, std::unique_ptr<Space>, std::hash<space_id_t>, std::equal_to<space_id_t>>;
								   
 Of course, other areas need to be modified in log0recv.cc , and if this optimization works, I can adapt it to other areas as well.

How to repeat:
just read the code

Suggested fix:
Use smart pointer as the value of std::unordered_map
[1 Dec 2022 12:54] MySQL Verification Team
Hi Mr. xing,

Thank you for your bug report.

Would you be so kind as to provide several patches which would demonstrate the optimisation.

Next, have you measured the speed improvements with these changes ???

We are waiting on your feedback.
[1 Dec 2022 13:01] alex xing
My current work just involves this part, so I pay attention to this code. If necessary, I can supplement the patch and test, but it needs to wait for some time, because I am busy  for kpi recently
[1 Dec 2022 13:06] MySQL Verification Team
Hi Mr. xing,

It is OK, we can wait .....
[2 Jan 2023 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".