Bug #109012 it is better to delete the recv_addr_t::space_id to save some memory
Submitted: 5 Nov 2022 14:13 Modified: 7 Nov 2022 13:26
Reporter: alex xing (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.31 OS:Any
Assigned to: CPU Architecture:Any

[5 Nov 2022 14:13] alex xing
Description:
space_id saved in recv_addr_t is redundant, it is just the key of unordered_map(recv_sys_t::Spaces), and we can get space_id from the key.
So it is better to  delete the recv_addr_t::space_id to  save some memory

How to repeat:
just read the code

Suggested fix:
How to get the space_id in two apply scenarios
1) if page in buffer pool:(log0recv.cc:1266) 
change recv_apply_log_rec(pages.second); to recv_apply_log_rec(pages.second, space.first);
2) if apply from disk: (log0recv.cc:2823)
in recv_recover_page_func
change   recv_parse_or_apply_log_rec_body(recv->type, buf, buf_end,
                                                     recv_addr->space, 
                                                     recv_addr->page_no,
                                                     block, &mtr, 
                                                     ULINT_UNDEFINED, LSN_MAX)
to   
         recv_parse_or_apply_log_rec_body(recv->type, buf, buf_end,
                                                     block->page.id.space(), 
                                                     recv_addr->page_no,
                                                     block, &mtr, 
                                                     ULINT_UNDEFINED, LSN_MAX)
[7 Nov 2022 13:26] MySQL Verification Team
Hi Mr. xing,

Thank you for your bug report.

However, this field, as some others, are there for better performance and future enhancements.