[MDEV-21174] Refactor mlog_write_ulint, mlog_memset, mlog_write_string Created: 2019-11-28  Updated: 2023-09-19  Resolved: 2019-12-03

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.5.1

Type: Task Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance

Issue Links:
Blocks
blocks MDEV-12353 Efficient InnoDB redo log record format Closed
blocks MDEV-14462 Confusing error message: ib_logfiles ... Closed
Problem/Incident
causes MDEV-21205 Assertion failure in btr_sec_min_rec_... Closed
causes MDEV-21259 Assertion `w != NORMAL || mach_read_f... Closed
causes MDEV-22904 Compressed row format table tries to ... Closed
causes MDEV-30404 Inconsistent updates of PAGE_MAX_TRX_... Closed
Relates
relates to MDEV-26322 Last binlog file and position are "em... Closed

 Description   

The function mlog_write_ulint() writes 1, 2, 4, or 8 bytes to an index page and to the redo log buffer of a mini-transaction. The following interface ought to be more suitable for future refactoring:

  /** Write request types */
  enum write_type
  {
    /** the page is guaranteed to always change */
    NORMAL= 0,
    /** optional: the page contents might not change */
    OPT,
    /** force a write, even if the page contents is not changing */
    FORCED
  };
 
  /** Write 1, 2, 4, or 8 bytes to a file page.
  @param[in]      block   file page
  @param[in,out]  ptr     pointer in file page
  @param[in]      val     value to write
  @tparam l       number of bytes to write
  @tparam w       write request type
  @tparam V       type of val */
  template<unsigned l,write_type w= NORMAL,typename V>
  inline void write(const buf_block_t &block, byte *ptr, V val)
    MY_ATTRIBUTE((nonnull));

The write_type allows redundant writes to be optimized away. Passing buf_block_t will allow the function mlog_write_initial_log_record_fast() to be replaced with the even faster mlog_write_initial_log_record_low(), and it could also allow the mtr_t::m_memo and mtr_t::m_log to be replaced with a std::map<buf_block_t&,log_t>.



 Comments   
Comment by Marko Mäkelä [ 2019-12-03 ]

As part of this task, I replaced some more use of mlog_write_initial_log_record_fast() with the more efficient mlog_write_initial_log_record_low(), and replaced some page_get_page_no() calls with references to buf_page_t::id.

Generated at Thu Feb 08 09:05:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.