Commit 5294695e authored by Marko Mäkelä's avatar Marko Mäkelä

Clean up mtr_t

mtr_t::is_empty(): Replaces mtr_t::get_log() and mtr_t::get_memo().

mtr_t::get_log_size(): Replaces mtr_t::get_log().

mtr_t::print(): Remove, unused function.

ReleaseBlocks::ReleaseBlocks(): Remove an unused parameter.
parent 4b3c3e52
......@@ -1961,8 +1961,7 @@ fil_crypt_rotate_page(
/* If block read failed mtr memo and log should be empty. */
ut_ad(!mtr.has_modifications());
ut_ad(!mtr.is_dirty());
ut_ad(mtr.get_memo()->size() == 0);
ut_ad(mtr.get_log()->size() == 0);
ut_ad(mtr.is_empty());
mtr.commit();
}
......
......@@ -3676,7 +3676,7 @@ fil_names_clear(
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.named_spaces);
space != NULL; ) {
if (mtr.get_log()->size()
if (mtr.get_log_size()
+ strlen(space->chain.start->name)
>= RECV_SCAN_SIZE - (3 + 5 + 1)) {
/* Prevent log parse buffer overflow */
......
......@@ -54,13 +54,6 @@ savepoint. */
#define mtr_memo_release(m, o, t) \
(m)->memo_release((o), (t))
/** Print info of an mtr handle. */
#define mtr_print(m) (m)->print()
/** Return the log object of a mini-transaction buffer.
@return log */
#define mtr_get_log(m) (m)->get_log()
/** Push an object to an mtr memo stack. */
#define mtr_memo_push(m, o, t) (m)->memo_push(o, t)
......@@ -360,30 +353,13 @@ struct mtr_t {
const byte* ptr,
ulint flags) const;
/** Print info of an mtr handle. */
void print() const;
/** @return true if mini-transaction contains modifications. */
bool has_modifications() const { return m_modifications; }
/** @return the memo stack */
const mtr_buf_t* get_memo() const { return &m_memo; }
/** @return the memo stack */
mtr_buf_t* get_memo() { return &m_memo; }
#endif /* UNIV_DEBUG */
/** @return true if a record was added to the mini-transaction */
bool is_dirty() const { return m_made_dirty; }
/** Get the buffered redo log of this mini-transaction.
@return redo log */
const mtr_buf_t* get_log() const { return &m_log; }
/** Get the buffered redo log of this mini-transaction.
@return redo log */
mtr_buf_t* get_log() { return &m_log; }
/** Push an object to an mtr memo stack.
@param object object
@param type object type: MTR_MEMO_S_LOCK, ... */
......@@ -395,6 +371,11 @@ struct mtr_t {
static inline bool is_block_dirtied(const buf_block_t* block)
MY_ATTRIBUTE((warn_unused_result));
/** @return the size of the log is empty */
size_t get_log_size() const { return m_log.size(); }
/** @return whether the log and memo are empty */
bool is_empty() const { return m_memo.size() == 0 && m_log.size() == 0; }
/** Write request types */
enum write_type
{
......
......@@ -360,22 +360,10 @@ struct DebugCheck {
struct ReleaseBlocks
{
const lsn_t start, end;
#ifdef UNIV_DEBUG
const mtr_buf_t &memo;
ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t &memo) :
start(start), end(end), memo(memo)
#else /* UNIV_DEBUG */
ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t&) :
start(start), end(end)
#endif /* UNIV_DEBUG */
{
ut_ad(start);
ut_ad(end);
}
ReleaseBlocks(lsn_t start, lsn_t end) : start(start), end(end) {}
/** @return true always */
bool operator()(mtr_memo_slot_t* slot) const
bool operator()(mtr_memo_slot_t *slot) const
{
if (!slot->object)
return true;
......@@ -492,9 +480,8 @@ void mtr_t::commit()
else
ut_ad(!m_freed_space);
m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks>
(ReleaseBlocks(lsns.first, m_commit_lsn,
m_memo)));
m_memo.for_each_block_in_reverse
(CIterate<const ReleaseBlocks>(ReleaseBlocks(lsns.first, m_commit_lsn)));
if (m_made_dirty)
mysql_mutex_unlock(&log_sys.flush_order_mutex);
......@@ -615,8 +602,7 @@ void mtr_t::commit_shrink(fil_space_t &space)
m_memo.for_each_block_in_reverse(CIterate<Shrink>{space});
m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks>
(ReleaseBlocks(start_lsn, m_commit_lsn,
m_memo)));
(ReleaseBlocks(start_lsn, m_commit_lsn)));
mysql_mutex_unlock(&log_sys.flush_order_mutex);
mutex_enter(&fil_system.mutex);
......@@ -1238,16 +1224,6 @@ mtr_t::memo_contains_page_flagged(
return m_memo.for_each_block_in_reverse(iteration)
? NULL : iteration.functor.get_block();
}
/** Print info of an mtr handle. */
void
mtr_t::print() const
{
ib::info() << "Mini-transaction handle: memo size "
<< m_memo.size() << " bytes log size "
<< get_log()->size() << " bytes";
}
#endif /* UNIV_DEBUG */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment