[MDEV-21351] Replace recv_sys.heap with list of buf_block_t* Created: 2019-12-18 Updated: 2022-03-17 Resolved: 2020-01-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.5.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Thirunarayanan Balathandayuthapani | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance, recovery | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
The following suggestion was given to reduce the memory usage during recovery. But I would like to do (2) alone. It doesn't make sense to remove recv_sys.buf completely. |
| Comments |
| Comment by Marko Mäkelä [ 2020-01-02 ] | ||||||||||||||||||
|
This was originally filed as I think that we must do the following as part of this task:
The following are not strictly necessary at this point:
thiru, while I agree that it is not strictly necessary to remove recv_sys.buf as part of this task, I would appreciate more detailed reasoning for keeping it. | ||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-01-02 ] | ||||||||||||||||||
|
Regarding the removal of RECV_DATA_BLOCK_SIZE, we should guarantee that the size of an individual log record never exceeds innodb_page_size. In the pre- The maximum size of MLOG_UNDO_INSERT is innodb_page_size+11+13-56 bytes or less. No problem there. For MLOG_COMP_REC_UPDATE_IN_PLACE, the maximum-size record ought to be 11+2*n_fields+1+1+7+7+2+n_updated_fields*(2+2+len)+1+2 bytes. The worst case must necessarily be a clustered index record. Because the maximum number of columns in a key is 16, a secondary index record can have at most 32+1 fields (1 field for the child page number in a node pointer). The minimum size of a clustered index record in ROW_FORMAT≠REDUNDANT is 5+6+7=18 bytes (at least 5 bytes of header and 6+7 bytes for DB_TRX_ID,DB_ROLL_PTR). The 13 bytes of the system columns are logged separately in the redo log record. So, the maximum log record size can be simplified to 19+n_fields*2+n_updated_fields*4+len bytes. An index page must hold at least 2 records, so the maximum record size is (innodb_page_size-120-8-2*2)/2 bytes, or innodb_page_size/2-66 bytes, including the record header. The minimum record header size of 5 bytes occurs when all columns are fixed-length and NOT NULL. Assuming that, we will get the following limits:
With innodb_page_size<16k it is possible that the MLOG_COMP_REC_UPDATE_IN_PLACE record is longer than a single page, and hence we cannot remove RECV_DATA_BLOCK_SIZE as part of this task. The worst-case overhead factor ranges from 37% to 309%. | ||||||||||||||||||
| Comment by Matthias Leich [ 2020-01-15 ] | ||||||||||||||||||
|
| ||||||||||||||||||
| Comment by Matthias Leich [ 2020-01-28 ] | ||||||||||||||||||
|
| ||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-02-03 ] | ||||||||||||||||||
|
I pushed a follow-up improvement that frees the blocks that store redo log records as soon as the records have been processed. It also implements ASAN and Valgrind instrumentation to catch out-of-bounds access. |