|
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>.
|