mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Cleanup: Recude sizeof(mtr_t)
Use bit-fields for some mtr_t members to improve locality of reference. Because mtr_t is never shared between threads, there are no considerations regarding concurrent access.
This commit is contained in:
parent
8b6cfda631
commit
9a999469f7
2 changed files with 51 additions and 66 deletions
|
@ -161,10 +161,13 @@ struct mtr_t {
|
|||
/** X-latch a not yet latched block after a savepoint. */
|
||||
inline void x_latch_at_savepoint(ulint savepoint, buf_block_t* block);
|
||||
|
||||
/** Get the logging mode.
|
||||
@return logging mode */
|
||||
inline mtr_log_t get_log_mode() const
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
/** @return the logging mode */
|
||||
mtr_log_t get_log_mode() const
|
||||
{
|
||||
ut_ad(m_log_mode >= MTR_LOG_ALL);
|
||||
ut_ad(m_log_mode <= MTR_LOG_SHORT_INSERTS);
|
||||
return static_cast<mtr_log_t>(m_log_mode);
|
||||
}
|
||||
|
||||
/** Change the logging mode.
|
||||
@param mode logging mode
|
||||
|
@ -302,31 +305,26 @@ struct mtr_t {
|
|||
@param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */
|
||||
void release_page(const void* ptr, mtr_memo_type_t type);
|
||||
|
||||
/** Note that the mini-transaction has modified data. */
|
||||
void set_modified() { m_modifications = true; }
|
||||
/** Note that the mini-transaction has modified data. */
|
||||
void set_modified() { m_modifications = true; }
|
||||
|
||||
/** Set the state to not-modified. This will not log the
|
||||
changes. This is only used during redo log apply, to avoid
|
||||
logging the changes. */
|
||||
void discard_modifications() { m_modifications = false; }
|
||||
/** Set the state to not-modified. This will not log the changes.
|
||||
This is only used during redo log apply, to avoid logging the changes. */
|
||||
void discard_modifications() { m_modifications = false; }
|
||||
|
||||
/** Get the LSN of commit().
|
||||
@return the commit LSN
|
||||
@retval 0 if the transaction only modified temporary tablespaces */
|
||||
lsn_t commit_lsn() const
|
||||
{
|
||||
ut_ad(has_committed());
|
||||
return(m_commit_lsn);
|
||||
}
|
||||
/** Get the LSN of commit().
|
||||
@return the commit LSN
|
||||
@retval 0 if the transaction only modified temporary tablespaces */
|
||||
lsn_t commit_lsn() const { ut_ad(has_committed()); return m_commit_lsn; }
|
||||
|
||||
/** Note that we are inside the change buffer code. */
|
||||
void enter_ibuf() { m_inside_ibuf = true; }
|
||||
/** Note that we are inside the change buffer code. */
|
||||
void enter_ibuf() { m_inside_ibuf= true; }
|
||||
|
||||
/** Note that we have exited from the change buffer code. */
|
||||
void exit_ibuf() { m_inside_ibuf = false; }
|
||||
/** Note that we have exited from the change buffer code. */
|
||||
void exit_ibuf() { m_inside_ibuf= false; }
|
||||
|
||||
/** @return true if we are inside the change buffer code */
|
||||
bool is_inside_ibuf() const { return m_inside_ibuf; }
|
||||
/** @return true if we are inside the change buffer code */
|
||||
bool is_inside_ibuf() const { return m_inside_ibuf; }
|
||||
|
||||
/** Get flush observer
|
||||
@return flush observer */
|
||||
|
@ -500,41 +498,41 @@ private:
|
|||
bool m_commit= false;
|
||||
#endif
|
||||
|
||||
/** memo stack for locks etc. */
|
||||
mtr_buf_t m_memo;
|
||||
/** specifies which operations should be logged; default MTR_LOG_ALL */
|
||||
uint16_t m_log_mode:2;
|
||||
|
||||
/** mini-transaction log */
|
||||
mtr_buf_t m_log;
|
||||
/** whether at least one buffer pool page was written to */
|
||||
uint16_t m_modifications:1;
|
||||
|
||||
/** true if mtr has made at least one buffer pool page dirty */
|
||||
bool m_made_dirty;
|
||||
/** whether at least one previously clean buffer pool page was written to */
|
||||
uint16_t m_made_dirty:1;
|
||||
|
||||
/** true if inside ibuf changes */
|
||||
bool m_inside_ibuf;
|
||||
/** whether change buffer is latched; only needed in non-debug builds
|
||||
to suppress some read-ahead operations, @see ibuf_inside() */
|
||||
uint16_t m_inside_ibuf:1;
|
||||
|
||||
/** true if the mini-transaction modified buffer pool pages */
|
||||
bool m_modifications;
|
||||
|
||||
/** Count of how many page initial log records have been
|
||||
written to the mtr log */
|
||||
ib_uint32_t m_n_log_recs;
|
||||
|
||||
/** specifies which operations should be logged; default
|
||||
value MTR_LOG_ALL */
|
||||
mtr_log_t m_log_mode;
|
||||
/** number of m_log records */
|
||||
uint16_t m_n_log_recs:13;
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Persistent user tablespace associated with the
|
||||
mini-transaction, or 0 (TRX_SYS_SPACE) if none yet */
|
||||
ulint m_user_space_id;
|
||||
/** Persistent user tablespace associated with the
|
||||
mini-transaction, or 0 (TRX_SYS_SPACE) if none yet */
|
||||
uint32_t m_user_space_id;
|
||||
#endif /* UNIV_DEBUG */
|
||||
/** User tablespace that is being modified by the mini-transaction */
|
||||
fil_space_t* m_user_space;
|
||||
|
||||
/** Flush Observer */
|
||||
FlushObserver* m_flush_observer;
|
||||
/** acquired dict_index_t::lock, fil_space_t::latch, buf_block_t */
|
||||
mtr_buf_t m_memo;
|
||||
|
||||
/** LSN at commit time */
|
||||
lsn_t m_commit_lsn;
|
||||
/** mini-transaction log */
|
||||
mtr_buf_t m_log;
|
||||
|
||||
/** user tablespace that is being modified by the mini-transaction */
|
||||
fil_space_t* m_user_space;
|
||||
|
||||
/** page flush observer for innodb_log_optimize_ddl=ON */
|
||||
FlushObserver *m_flush_observer;
|
||||
|
||||
/** LSN at commit time */
|
||||
lsn_t m_commit_lsn;
|
||||
};
|
||||
|
||||
#include "mtr0mtr.ic"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -177,19 +177,6 @@ mtr_t::release_block_at_savepoint(
|
|||
slot->object = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Gets the logging mode of a mini-transaction.
|
||||
@return logging mode: MTR_LOG_NONE, ... */
|
||||
|
||||
mtr_log_t
|
||||
mtr_t::get_log_mode() const
|
||||
{
|
||||
ut_ad(m_log_mode >= MTR_LOG_ALL);
|
||||
ut_ad(m_log_mode <= MTR_LOG_SHORT_INSERTS);
|
||||
|
||||
return m_log_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
Changes the logging mode of a mini-transaction.
|
||||
@return old mode */
|
||||
|
@ -200,7 +187,7 @@ mtr_t::set_log_mode(mtr_log_t mode)
|
|||
ut_ad(mode >= MTR_LOG_ALL);
|
||||
ut_ad(mode <= MTR_LOG_SHORT_INSERTS);
|
||||
|
||||
const mtr_log_t old_mode = m_log_mode;
|
||||
const mtr_log_t old_mode = get_log_mode();
|
||||
|
||||
switch (old_mode) {
|
||||
case MTR_LOG_NO_REDO:
|
||||
|
|
Loading…
Add table
Reference in a new issue