MySQL 8.0.40
Source Code Documentation
mtr0mtr.h File Reference

Mini-transaction buffer. More...

#include <stddef.h>
#include "univ.i"
#include "buf0types.h"
#include "dyn0buf.h"
#include "fil0fil.h"
#include "mtr0types.h"
#include "srv0srv.h"
#include "trx0types.h"
#include "mtr0mtr.ic"

Go to the source code of this file.

Classes

struct  mtr_memo_slot_t
 Mini-transaction memo stack slot. More...
 
struct  mtr_t
 Mini-transaction handle and buffer. More...
 
struct  mtr_t::Impl
 State variables of the mtr. More...
 
class  mtr_t::Logging
 mtr global logging More...
 

Macros

#define mtr_start(m)   (m)->start()
 Start a mini-transaction. More...
 
#define mtr_start_sync(m)   (m)->start(true)
 Start a synchronous mini-transaction. More...
 
#define mtr_start_ro(m)   (m)->start(true, true)
 Start an asynchronous read-only mini-transaction. More...
 
#define mtr_commit(m)   (m)->commit()
 Commit a mini-transaction. More...
 
#define mtr_set_savepoint(m)   (m)->get_savepoint()
 Set and return a savepoint in mtr. More...
 
#define mtr_release_s_latch_at_savepoint(m, s, l)    (m)->release_s_latch_at_savepoint((s), (l))
 Release the (index tree) s-latch stored in an mtr memo after a savepoint. More...
 
#define mtr_get_log_mode(m)   (m)->get_log_mode()
 Get the logging mode of a mini-transaction. More...
 
#define mtr_set_log_mode(m, d)   (m)->set_log_mode((d))
 Change the logging mode of a mini-transaction. More...
 
#define mtr_get_flush_observer(m)   (m)->get_flush_observer()
 Get the flush observer of a mini-transaction. More...
 
#define mtr_set_flush_observer(m, d)   (m)->set_flush_observer((d))
 Set the flush observer of a mini-transaction. More...
 
#define mtr_read_ulint(p, t, m)   (m)->read_ulint((p), (t))
 Read 1 - 4 bytes from a file page buffered in the buffer pool. More...
 
#define mtr_memo_release(m, o, t)   (m)->memo_release((o), (t))
 Release an object in the memo stack. More...
 
#define mtr_is_block_fix(m, o, t, table)    (mtr_memo_contains(m, o, t) || table->is_intrinsic())
 Check if memo contains the given item ignore if table is intrinsic. More...
 
#define mtr_is_page_fix(m, p, t, table)    (mtr_memo_contains_page(m, p, t) || table->is_intrinsic())
 Check if memo contains the given page ignore if table is intrinsic. More...
 
#define mtr_memo_contains(m, o, t)   (m)->memo_contains((m)->get_memo(), (o), (t))
 Check if memo contains the given item. More...
 
#define mtr_memo_contains_page(m, p, t)    (m)->memo_contains_page_flagged((p), (t))
 Check if memo contains the given page. More...
 
#define mtr_print(m)   (m)->print()
 Print info of an mtr handle. More...
 
#define mtr_get_log(m)   (m)->get_log()
 Return the log object of a mini-transaction buffer. More...
 
#define mtr_memo_push(m, o, t)   (m)->memo_push(o, t)
 Push an object to an mtr memo stack. More...
 
#define mtr_s_lock(l, m, loc)   (m)->s_lock((l), loc)
 Lock an rw-lock in s-mode. More...
 
#define mtr_x_lock(l, m, loc)   (m)->x_lock((l), loc)
 Lock an rw-lock in x-mode. More...
 
#define mtr_x_lock_space(s, m)   (m)->x_lock_space((s), UT_LOCATION_HERE)
 Lock a tablespace in x-mode. More...
 
#define mtr_sx_lock(l, m, loc)   (m)->sx_lock((l), loc)
 Lock an rw-lock in sx-mode. More...
 
#define mtr_memo_contains_flagged(m, p, l)   (m)->memo_contains_flagged((p), (l))
 
#define mtr_memo_contains_page_flagged(m, p, l)    (m)->memo_contains_page_flagged((p), (l))
 
#define mtr_release_block_at_savepoint(m, s, b)    (m)->release_block_at_savepoint((s), (b))
 
#define mtr_block_sx_latch_at_savepoint(m, s, b)    (m)->sx_latch_at_savepoint((s), (b))
 
#define mtr_block_x_latch_at_savepoint(m, s, b)    (m)->x_latch_at_savepoint((s), (b))
 

Functions

std::ostream & operator<< (std::ostream &out, const mtr_memo_slot_t &obj)
 
lsn_t mtr_commit_mlog_test (size_t payload=0)
 Reserves space in the log buffer and writes a single MLOG_TEST. More...
 
void mtr_commit_mlog_test_filling_block (log_t &log, size_t space_left=0)
 Reserves space in the log buffer and writes a single MLOG_TEST. More...
 

Detailed Description

Mini-transaction buffer.

Created 11/26/1995 Heikki Tuuri

Macro Definition Documentation

◆ mtr_block_sx_latch_at_savepoint

#define mtr_block_sx_latch_at_savepoint (   m,
  s,
 
)     (m)->sx_latch_at_savepoint((s), (b))

◆ mtr_block_x_latch_at_savepoint

#define mtr_block_x_latch_at_savepoint (   m,
  s,
 
)     (m)->x_latch_at_savepoint((s), (b))

◆ mtr_commit

#define mtr_commit (   m)    (m)->commit()

Commit a mini-transaction.

◆ mtr_get_flush_observer

#define mtr_get_flush_observer (   m)    (m)->get_flush_observer()

Get the flush observer of a mini-transaction.

Returns
flush observer object

◆ mtr_get_log

#define mtr_get_log (   m)    (m)->get_log()

Return the log object of a mini-transaction buffer.

Returns
log

◆ mtr_get_log_mode

#define mtr_get_log_mode (   m)    (m)->get_log_mode()

Get the logging mode of a mini-transaction.

Returns
logging mode: MTR_LOG_NONE, ...

◆ mtr_is_block_fix

#define mtr_is_block_fix (   m,
  o,
  t,
  table 
)     (mtr_memo_contains(m, o, t) || table->is_intrinsic())

Check if memo contains the given item ignore if table is intrinsic.

Returns
true if contains or table is intrinsic.

◆ mtr_is_page_fix

#define mtr_is_page_fix (   m,
  p,
  t,
  table 
)     (mtr_memo_contains_page(m, p, t) || table->is_intrinsic())

Check if memo contains the given page ignore if table is intrinsic.

Returns
true if contains or table is intrinsic.

◆ mtr_memo_contains

#define mtr_memo_contains (   m,
  o,
 
)    (m)->memo_contains((m)->get_memo(), (o), (t))

Check if memo contains the given item.

Returns
true if contains

◆ mtr_memo_contains_flagged

#define mtr_memo_contains_flagged (   m,
  p,
 
)    (m)->memo_contains_flagged((p), (l))

◆ mtr_memo_contains_page

#define mtr_memo_contains_page (   m,
  p,
 
)     (m)->memo_contains_page_flagged((p), (t))

Check if memo contains the given page.

Returns
true if contains

◆ mtr_memo_contains_page_flagged

#define mtr_memo_contains_page_flagged (   m,
  p,
 
)     (m)->memo_contains_page_flagged((p), (l))

◆ mtr_memo_push

#define mtr_memo_push (   m,
  o,
 
)    (m)->memo_push(o, t)

Push an object to an mtr memo stack.

◆ mtr_memo_release

#define mtr_memo_release (   m,
  o,
 
)    (m)->memo_release((o), (t))

Release an object in the memo stack.

Returns
true if released

◆ mtr_print

#define mtr_print (   m)    (m)->print()

Print info of an mtr handle.

◆ mtr_read_ulint

#define mtr_read_ulint (   p,
  t,
 
)    (m)->read_ulint((p), (t))

Read 1 - 4 bytes from a file page buffered in the buffer pool.

Returns
value read

◆ mtr_release_block_at_savepoint

#define mtr_release_block_at_savepoint (   m,
  s,
 
)     (m)->release_block_at_savepoint((s), (b))

◆ mtr_release_s_latch_at_savepoint

#define mtr_release_s_latch_at_savepoint (   m,
  s,
 
)     (m)->release_s_latch_at_savepoint((s), (l))

Release the (index tree) s-latch stored in an mtr memo after a savepoint.

◆ mtr_s_lock

#define mtr_s_lock (   l,
  m,
  loc 
)    (m)->s_lock((l), loc)

Lock an rw-lock in s-mode.

◆ mtr_set_flush_observer

#define mtr_set_flush_observer (   m,
 
)    (m)->set_flush_observer((d))

Set the flush observer of a mini-transaction.

◆ mtr_set_log_mode

#define mtr_set_log_mode (   m,
 
)    (m)->set_log_mode((d))

Change the logging mode of a mini-transaction.

Returns
old mode

◆ mtr_set_savepoint

#define mtr_set_savepoint (   m)    (m)->get_savepoint()

Set and return a savepoint in mtr.

Returns
savepoint

◆ mtr_start

#define mtr_start (   m)    (m)->start()

Start a mini-transaction.

◆ mtr_start_ro

#define mtr_start_ro (   m)    (m)->start(true, true)

Start an asynchronous read-only mini-transaction.

◆ mtr_start_sync

#define mtr_start_sync (   m)    (m)->start(true)

Start a synchronous mini-transaction.

◆ mtr_sx_lock

#define mtr_sx_lock (   l,
  m,
  loc 
)    (m)->sx_lock((l), loc)

Lock an rw-lock in sx-mode.

◆ mtr_x_lock

#define mtr_x_lock (   l,
  m,
  loc 
)    (m)->x_lock((l), loc)

Lock an rw-lock in x-mode.

◆ mtr_x_lock_space

#define mtr_x_lock_space (   s,
 
)    (m)->x_lock_space((s), UT_LOCATION_HERE)

Lock a tablespace in x-mode.

Function Documentation

◆ mtr_commit_mlog_test()

lsn_t mtr_commit_mlog_test ( size_t  payload = 0)

Reserves space in the log buffer and writes a single MLOG_TEST.

Parameters
[in]payloadnumber of extra bytes within the record, not greater than 1024
Returns
end_lsn pointing to the first byte after the written record

◆ mtr_commit_mlog_test_filling_block()

void mtr_commit_mlog_test_filling_block ( log_t log,
size_t  space_left = 0 
)

Reserves space in the log buffer and writes a single MLOG_TEST.

Adjusts size of the payload in the record, in order to fill the current block up to its boundary. If nothing else is happening in parallel, we could expect to see afterwards: (cur_lsn + space_left) % OS_FILE_LOG_BLOCK_SIZE == LOG_BLOCK_HDR_SIZE, where cur_lsn = log_get_lsn(log).

Parameters
[in,out]logredo log
[in]space_leftextra bytes left to the boundary of block, must be not greater than 496

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const mtr_memo_slot_t obj 
)
inline