MySQL  8.0.19
Source Code Documentation
mtr0mtr.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved.
4 Copyright (c) 2012, Facebook Inc.
5 
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License, version 2.0, as published by the
8 Free Software Foundation.
9 
10 This program is also distributed with certain software (including but not
11 limited to OpenSSL) that is licensed under separate terms, as designated in a
12 particular file or component or in included license documentation. The authors
13 of MySQL hereby grant you an additional permission to link the program and
14 your derivative works with the separately licensed software that they have
15 included with MySQL.
16 
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21 
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 
26 *****************************************************************************/
27 
28 /** @file include/mtr0mtr.h
29  Mini-transaction buffer
30 
31  Created 11/26/1995 Heikki Tuuri
32  *******************************************************/
33 
34 #ifndef mtr0mtr_h
35 #define mtr0mtr_h
36 
37 #include <stddef.h>
38 
39 #include "univ.i"
40 
41 #include "buf0types.h"
42 #include "dyn0buf.h"
43 #include "fil0fil.h"
44 #include "log0types.h"
45 #include "mtr0types.h"
46 #include "srv0srv.h"
47 #include "trx0types.h"
48 
49 /** Start a mini-transaction. */
50 #define mtr_start(m) (m)->start()
51 
52 /** Start a synchronous mini-transaction */
53 #define mtr_start_sync(m) (m)->start(true)
54 
55 /** Start an asynchronous read-only mini-transaction */
56 #define mtr_start_ro(m) (m)->start(true, true)
57 
58 /** Commit a mini-transaction. */
59 #define mtr_commit(m) (m)->commit()
60 
61 /** Set and return a savepoint in mtr.
62 @return savepoint */
63 #define mtr_set_savepoint(m) (m)->get_savepoint()
64 
65 /** Release the (index tree) s-latch stored in an mtr memo after a
66 savepoint. */
67 #define mtr_release_s_latch_at_savepoint(m, s, l) \
68  (m)->release_s_latch_at_savepoint((s), (l))
69 
70 /** Get the logging mode of a mini-transaction.
71 @return logging mode: MTR_LOG_NONE, ... */
72 #define mtr_get_log_mode(m) (m)->get_log_mode()
73 
74 /** Change the logging mode of a mini-transaction.
75 @return old mode */
76 #define mtr_set_log_mode(m, d) (m)->set_log_mode((d))
77 
78 /** Get the flush observer of a mini-transaction.
79 @return flush observer object */
80 #define mtr_get_flush_observer(m) (m)->get_flush_observer()
81 
82 /** Set the flush observer of a mini-transaction. */
83 #define mtr_set_flush_observer(m, d) (m)->set_flush_observer((d))
84 
85 /** Read 1 - 4 bytes from a file page buffered in the buffer pool.
86 @return value read */
87 #define mtr_read_ulint(p, t, m) (m)->read_ulint((p), (t))
88 
89 /** Release an object in the memo stack.
90 @return true if released */
91 #define mtr_memo_release(m, o, t) (m)->memo_release((o), (t))
92 
93 #ifdef UNIV_DEBUG
94 
95 /** Check if memo contains the given item ignore if table is intrinsic
96 @return true if contains or table is intrinsic. */
97 #define mtr_is_block_fix(m, o, t, table) \
98  (mtr_memo_contains(m, o, t) || table->is_intrinsic())
99 
100 /** Check if memo contains the given page ignore if table is intrinsic
101 @return true if contains or table is intrinsic. */
102 #define mtr_is_page_fix(m, p, t, table) \
103  (mtr_memo_contains_page(m, p, t) || table->is_intrinsic())
104 
105 /** Check if memo contains the given item.
106 @return true if contains */
107 #define mtr_memo_contains(m, o, t) (m)->memo_contains((m)->get_memo(), (o), (t))
108 
109 /** Check if memo contains the given page.
110 @return true if contains */
111 #define mtr_memo_contains_page(m, p, t) \
112  (m)->memo_contains_page_flagged((p), (t))
113 #endif /* UNIV_DEBUG */
114 
115 /** Print info of an mtr handle. */
116 #define mtr_print(m) (m)->print()
117 
118 /** Return the log object of a mini-transaction buffer.
119 @return log */
120 #define mtr_get_log(m) (m)->get_log()
121 
122 /** Push an object to an mtr memo stack. */
123 #define mtr_memo_push(m, o, t) (m)->memo_push(o, t)
124 
125 /** Lock an rw-lock in s-mode. */
126 #define mtr_s_lock(l, m) (m)->s_lock((l), __FILE__, __LINE__)
127 
128 /** Lock an rw-lock in x-mode. */
129 #define mtr_x_lock(l, m) (m)->x_lock((l), __FILE__, __LINE__)
130 
131 /** Lock a tablespace in x-mode. */
132 #define mtr_x_lock_space(s, m) (m)->x_lock_space((s), __FILE__, __LINE__)
133 
134 /** Lock an rw-lock in sx-mode. */
135 #define mtr_sx_lock(l, m) (m)->sx_lock((l), __FILE__, __LINE__)
136 
137 #define mtr_memo_contains_flagged(m, p, l) (m)->memo_contains_flagged((p), (l))
138 
139 #define mtr_memo_contains_page_flagged(m, p, l) \
140  (m)->memo_contains_page_flagged((p), (l))
141 
142 #define mtr_release_block_at_savepoint(m, s, b) \
143  (m)->release_block_at_savepoint((s), (b))
144 
145 #define mtr_block_sx_latch_at_savepoint(m, s, b) \
146  (m)->sx_latch_at_savepoint((s), (b))
147 
148 #define mtr_block_x_latch_at_savepoint(m, s, b) \
149  (m)->x_latch_at_savepoint((s), (b))
150 
151 /** Check if a mini-transaction is dirtying a clean page.
152 @param b block being x-fixed
153 @return true if the mtr is dirtying a clean page. */
154 #define mtr_block_dirtied(b) mtr_t::is_block_dirtied((b))
155 
156 /** Forward declaration of a tablespace object */
157 struct fil_space_t;
158 
159 /** Mini-transaction memo stack slot. */
161  /** pointer to the object */
162  void *object;
163 
164  /** type of the stored object (MTR_MEMO_S_LOCK, ...) */
165  ulint type;
166 };
167 
168 /** Mini-transaction handle and buffer */
169 struct mtr_t {
170  /** State variables of the mtr */
171  struct Impl {
172  /** memo stack for locks etc. */
174 
175  /** mini-transaction log */
177 
178  /** true if mtr has made at least one buffer pool page dirty */
180 
181  /** true if inside ibuf changes */
183 
184  /** true if the mini-transaction modified buffer pool pages */
186 
187  /** Count of how many page initial log records have been
188  written to the mtr log */
189  ib_uint32_t m_n_log_recs;
190 
191  /** specifies which operations should be logged; default
192  value MTR_LOG_ALL */
194 
195  /** State of the transaction */
197 
198  /** Flush Observer */
200 
201 #ifdef UNIV_DEBUG
202  /** For checking corruption. */
203  ulint m_magic_n;
204 #endif /* UNIV_DEBUG */
205 
206  /** Owning mini-transaction */
208  };
209 
211 
212  ~mtr_t() {
213 #ifdef UNIV_DEBUG
214  switch (m_impl.m_state) {
215  case MTR_STATE_ACTIVE:
216  ut_ad(m_impl.m_memo.size() == 0);
217  break;
218  case MTR_STATE_INIT:
219  case MTR_STATE_COMMITTED:
220  break;
222  ut_error;
223  }
224 #endif /* UNIV_DEBUG */
225  }
226 
227  /** Start a mini-transaction.
228  @param sync true if it is a synchronous mini-transaction
229  @param read_only true if read only mini-transaction */
230  void start(bool sync = true, bool read_only = false);
231 
232  /** @return whether this is an asynchronous mini-transaction. */
233  bool is_async() const { return (!m_sync); }
234 
235  /** Request a future commit to be synchronous. */
236  void set_sync() { m_sync = true; }
237 
238  /** Commit the mini-transaction. */
239  void commit();
240 
241  /** Return current size of the buffer.
242  @return savepoint */
243  ulint get_savepoint() const MY_ATTRIBUTE((warn_unused_result)) {
244  ut_ad(is_active());
246 
247  return (m_impl.m_memo.size());
248  }
249 
250  /** Release the (index tree) s-latch stored in an mtr memo after a
251  savepoint.
252  @param savepoint value returned by @see set_savepoint.
253  @param lock latch to release */
254  inline void release_s_latch_at_savepoint(ulint savepoint, rw_lock_t *lock);
255 
256  /** Release the block in an mtr memo after a savepoint. */
257  inline void release_block_at_savepoint(ulint savepoint, buf_block_t *block);
258 
259  /** SX-latch a not yet latched block after a savepoint. */
260  inline void sx_latch_at_savepoint(ulint savepoint, buf_block_t *block);
261 
262  /** X-latch a not yet latched block after a savepoint. */
263  inline void x_latch_at_savepoint(ulint savepoint, buf_block_t *block);
264 
265  /** Get the logging mode.
266  @return logging mode */
267  inline mtr_log_t get_log_mode() const MY_ATTRIBUTE((warn_unused_result));
268 
269  /** Change the logging mode.
270  @param mode logging mode
271  @return old mode */
272  inline mtr_log_t set_log_mode(mtr_log_t mode);
273 
274  /** Read 1 - 4 bytes from a file page buffered in the buffer pool.
275  @param ptr pointer from where to read
276  @param type MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES
277  @return value read */
278  inline uint32_t read_ulint(const byte *ptr, mlog_id_t type) const
279  MY_ATTRIBUTE((warn_unused_result));
280 
281  /** Locks a rw-latch in S mode.
282  NOTE: use mtr_s_lock().
283  @param lock rw-lock
284  @param file file name from where called
285  @param line line number in file */
286  inline void s_lock(rw_lock_t *lock, const char *file, ulint line);
287 
288  /** Locks a rw-latch in X mode.
289  NOTE: use mtr_x_lock().
290  @param lock rw-lock
291  @param file file name from where called
292  @param line line number in file */
293  inline void x_lock(rw_lock_t *lock, const char *file, ulint line);
294 
295  /** Locks a rw-latch in X mode.
296  NOTE: use mtr_sx_lock().
297  @param lock rw-lock
298  @param file file name from where called
299  @param line line number in file */
300  inline void sx_lock(rw_lock_t *lock, const char *file, ulint line);
301 
302  /** Acquire a tablespace X-latch.
303  NOTE: use mtr_x_lock_space().
304  @param[in] space tablespace instance
305  @param[in] file file name from where called
306  @param[in] line line number in file */
307  void x_lock_space(fil_space_t *space, const char *file, ulint line);
308 
309  /** Release an object in the memo stack.
310  @param object object
311  @param type object type: MTR_MEMO_S_LOCK, ... */
312  void memo_release(const void *object, ulint type);
313 
314  /** Release a page latch.
315  @param[in] ptr pointer to within a page frame
316  @param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */
317  void release_page(const void *ptr, mtr_memo_type_t type);
318 
319  /** Note that the mini-transaction has modified data. */
321 
322  /** Set the state to not-modified. This will not log the
323  changes. This is only used during redo log apply, to avoid
324  logging the changes. */
326 
327  /** Get the LSN of commit().
328  @return the commit LSN
329  @retval 0 if the transaction only modified temporary tablespaces */
330  lsn_t commit_lsn() const MY_ATTRIBUTE((warn_unused_result)) {
331  ut_ad(has_committed());
333  return (m_commit_lsn);
334  }
335 
336  /** Note that we are inside the change buffer code. */
337  void enter_ibuf() { m_impl.m_inside_ibuf = true; }
338 
339  /** Note that we have exited from the change buffer code. */
340  void exit_ibuf() { m_impl.m_inside_ibuf = false; }
341 
342  /** @return true if we are inside the change buffer code */
343  bool is_inside_ibuf() const MY_ATTRIBUTE((warn_unused_result)) {
344  return (m_impl.m_inside_ibuf);
345  }
346 
347  /*
348  @return true if the mini-transaction is active */
349  bool is_active() const MY_ATTRIBUTE((warn_unused_result)) {
350  return (m_impl.m_state == MTR_STATE_ACTIVE);
351  }
352 
353  /** Get flush observer
354  @return flush observer */
355  FlushObserver *get_flush_observer() const MY_ATTRIBUTE((warn_unused_result)) {
356  return (m_impl.m_flush_observer);
357  }
358 
359  /** Set flush observer
360  @param[in] observer flush observer */
362  ut_ad(observer == NULL || m_impl.m_log_mode == MTR_LOG_NO_REDO);
363 
364  m_impl.m_flush_observer = observer;
365  }
366 
367 #ifdef UNIV_DEBUG
368  /** Check if memo contains the given item.
369  @param memo memo stack
370  @param object object to search
371  @param type type of object
372  @return true if contains */
373  static bool memo_contains(mtr_buf_t *memo, const void *object, ulint type)
374  MY_ATTRIBUTE((warn_unused_result));
375 
376  /** Check if memo contains the given item.
377  @param ptr object to search
378  @param flags specify types of object (can be ORred) of
379  MTR_MEMO_PAGE_S_FIX ... values
380  @return true if contains */
381  bool memo_contains_flagged(const void *ptr, ulint flags) const
382  MY_ATTRIBUTE((warn_unused_result));
383 
384  /** Check if memo contains the given page.
385  @param[in] ptr pointer to within buffer frame
386  @param[in] flags specify types of object with OR of
387  MTR_MEMO_PAGE_S_FIX... values
388  @return the block
389  @retval NULL if not found */
390  buf_block_t *memo_contains_page_flagged(const byte *ptr, ulint flags) const
391  MY_ATTRIBUTE((warn_unused_result));
392 
393  /** Mark the given latched page as modified.
394  @param[in] ptr pointer to within buffer frame */
395  void memo_modify_page(const byte *ptr);
396 
397  /** Print info of an mtr handle. */
398  void print() const;
399 
400  /** @return true if the mini-transaction has committed */
401  bool has_committed() const MY_ATTRIBUTE((warn_unused_result)) {
402  return (m_impl.m_state == MTR_STATE_COMMITTED);
403  }
404 
405  /** @return true if the mini-transaction is committing */
406  bool is_committing() const {
407  return (m_impl.m_state == MTR_STATE_COMMITTING);
408  }
409 
410  /** @return true if mini-transaction contains modifications. */
411  bool has_modifications() const MY_ATTRIBUTE((warn_unused_result)) {
412  return (m_impl.m_modifications);
413  }
414 
415  /** @return the memo stack */
416  const mtr_buf_t *get_memo() const MY_ATTRIBUTE((warn_unused_result)) {
417  return (&m_impl.m_memo);
418  }
419 
420  /** @return the memo stack */
421  mtr_buf_t *get_memo() MY_ATTRIBUTE((warn_unused_result)) {
422  return (&m_impl.m_memo);
423  }
424 
425  /** Computes the number of bytes that would be written to the redo
426  log if mtr was committed right now (excluding headers of log blocks).
427  @return number of bytes of the colllected log records increased
428  by 1 if MLOG_MULTI_REC_END would already be required */
429  size_t get_expected_log_size() const {
430  return (m_impl.m_log.size() + (m_impl.m_n_log_recs > 1 ? 1 : 0));
431  }
432 
433  void wait_for_flush();
434 #endif /* UNIV_DEBUG */
435 
436  /** @return true if a record was added to the mini-transaction */
437  bool is_dirty() const MY_ATTRIBUTE((warn_unused_result)) {
438  return (m_impl.m_made_dirty);
439  }
440 
441  /** Note that a record has been added to the log */
443 
444  /** Get the buffered redo log of this mini-transaction.
445  @return redo log */
446  const mtr_buf_t *get_log() const MY_ATTRIBUTE((warn_unused_result)) {
448 
449  return (&m_impl.m_log);
450  }
451 
452  /** Get the buffered redo log of this mini-transaction.
453  @return redo log */
454  mtr_buf_t *get_log() MY_ATTRIBUTE((warn_unused_result)) {
456 
457  return (&m_impl.m_log);
458  }
459 
460  /** Push an object to an mtr memo stack.
461  @param object object
462  @param type object type: MTR_MEMO_S_LOCK, ... */
463  inline void memo_push(void *object, mtr_memo_type_t type);
464 
465  /** Check if this mini-transaction is dirtying a clean page.
466  @param block block being x-fixed
467  @return true if the mtr is dirtying a clean page. */
468  static bool is_block_dirtied(const buf_block_t *block)
469  MY_ATTRIBUTE((warn_unused_result));
470 
471  private:
473 
474  /** LSN at commit time */
476 
477  /** true if it is synchronous mini-transaction */
478  bool m_sync;
479 
480  class Command;
481 
482  friend class Command;
483 };
484 
485 #ifndef UNIV_HOTBACKUP
486 #ifdef UNIV_DEBUG
487 
488 /** Reserves space in the log buffer and writes a single MLOG_TEST.
489 @param[in,out] log redo log
490 @param[in] payload number of extra bytes within the record,
491  not greater than 1024
492 @return end_lsn pointing to the first byte after the written record */
493 lsn_t mtr_commit_mlog_test(log_t &log, size_t payload = 0);
494 
495 /** Reserves space in the log buffer and writes a single MLOG_TEST.
496 Adjusts size of the payload in the record, in order to fill the current
497 block up to its boundary. If nothing else is happening in parallel,
498 we could expect to see afterwards:
499 (cur_lsn + space_left) % OS_FILE_LOG_BLOCK_SIZE == LOG_BLOCK_HDR_SIZE,
500 where cur_lsn = log_get_lsn(log).
501 @param[in,out] log redo log
502 @param[in] space_left extra bytes left to the boundary of block,
503  must be not greater than 496 */
504 void mtr_commit_mlog_test_filling_block(log_t &log, size_t space_left = 0);
505 
506 #endif /* UNIV_DEBUG */
507 #endif /* !UNIV_HOTBACKUP */
508 
509 #include "mtr0mtr.ic"
510 
511 #endif /* mtr0mtr_h */
mtr_t::m_impl
Impl m_impl
Definition: mtr0mtr.h:472
lsn_t
uint64_t lsn_t
Type used for all log sequence number storage and arithmetics.
Definition: log0types.h:59
mtr_t::is_dirty
bool is_dirty() const
Definition: mtr0mtr.h:437
mtr_t::get_flush_observer
FlushObserver * get_flush_observer() const
Get flush observer.
Definition: mtr0mtr.h:355
dyn_buf_t::size
ulint size() const
Returns the size of the total stored data.
Definition: dyn0buf.h:288
mtr_t::memo_modify_page
void memo_modify_page(const byte *ptr)
Mark the given latched page as modified.
Definition: mtr0mtr.cc:734
MTR_LOG_ALL
@ MTR_LOG_ALL
Default mode: log all operations modifying disk-based data.
Definition: mtr0types.h:43
NULL
#define NULL
Definition: types.h:55
mtr_t::commit_lsn
lsn_t commit_lsn() const
Get the LSN of commit().
Definition: mtr0mtr.h:330
ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:65
mtr_t::get_log
const mtr_buf_t * get_log() const
Get the buffered redo log of this mini-transaction.
Definition: mtr0mtr.h:446
MTR_STATE_COMMITTED
@ MTR_STATE_COMMITTED
Definition: mtr0types.h:280
mtr_t::x_lock
void x_lock(rw_lock_t *lock, const char *file, ulint line)
Locks a rw-latch in X mode.
mtr_t::read_ulint
uint32_t read_ulint(const byte *ptr, mlog_id_t type) const
Read 1 - 4 bytes from a file page buffered in the buffer pool.
mtr_t::Impl::m_flush_observer
FlushObserver * m_flush_observer
Flush Observer.
Definition: mtr0mtr.h:199
mtr_t::Impl
State variables of the mtr.
Definition: mtr0mtr.h:171
mtr_t
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
mtr_t::Impl::m_magic_n
ulint m_magic_n
For checking corruption.
Definition: mtr0mtr.h:203
mtr_t::Impl::m_state
mtr_state_t m_state
State of the transaction.
Definition: mtr0mtr.h:196
mtr_t::Impl::m_memo
mtr_buf_t m_memo
memo stack for locks etc.
Definition: mtr0mtr.h:173
mtr_t::is_active
bool is_active() const
Definition: mtr0mtr.h:349
mtr_t::get_memo
const mtr_buf_t * get_memo() const
Definition: mtr0mtr.h:416
mtr_commit_mlog_test
lsn_t mtr_commit_mlog_test(log_t &log, size_t payload=0)
Reserves space in the log buffer and writes a single MLOG_TEST.
Definition: mtr0mtr.cc:751
mtr_t::get_log
mtr_buf_t * get_log()
Get the buffered redo log of this mini-transaction.
Definition: mtr0mtr.h:454
mtr_memo_slot_t::object
void * object
pointer to the object
Definition: mtr0mtr.h:162
mtr_t::~mtr_t
~mtr_t()
Definition: mtr0mtr.h:212
mtr_t::Impl::m_log
mtr_buf_t m_log
mini-transaction log
Definition: mtr0mtr.h:176
buf_block_t
The buffer control block structure.
Definition: buf0buf.h:1318
ut_error
#define ut_error
Abort execution.
Definition: ut0dbg.h:61
mtr_t::memo_contains
static bool memo_contains(mtr_buf_t *memo, const void *object, ulint type)
Check if memo contains the given item.
Definition: mtr0mtr.cc:676
mtr_t::memo_release
void memo_release(const void *object, ulint type)
Release an object in the memo stack.
Definition: mtr0mtr.cc:505
mtr_t::s_lock
void s_lock(rw_lock_t *lock, const char *file, ulint line)
Locks a rw-latch in S mode.
fil_space_t
Tablespace or log data space.
Definition: fil0fil.h:218
mtr_t::release_page
void release_page(const void *ptr, mtr_memo_type_t type)
Release a page latch.
Definition: mtr0mtr.cc:524
srv0srv.h
read_only
bool read_only
Definition: mysqld.cc:1054
mtr_t::mtr_t
mtr_t()
Definition: mtr0mtr.h:210
mtr_t::has_modifications
bool has_modifications() const
Definition: mtr0mtr.h:411
log0types.h
dyn0buf.h
mtr_t::enter_ibuf
void enter_ibuf()
Note that we are inside the change buffer code.
Definition: mtr0mtr.h:337
mtr_t::is_block_dirtied
static bool is_block_dirtied(const buf_block_t *block)
Check if this mini-transaction is dirtying a clean page.
Definition: mtr0mtr.cc:348
mtr_t::memo_contains_flagged
bool memo_contains_flagged(const void *ptr, ulint flags) const
Check if memo contains the given item.
Definition: mtr0mtr.cc:706
MTR_LOG_NO_REDO
@ MTR_LOG_NO_REDO
Don't generate REDO log but add dirty pages to flush list.
Definition: mtr0types.h:49
mtr_t::is_inside_ibuf
bool is_inside_ibuf() const
Definition: mtr0mtr.h:343
mtr_t::Impl::m_mtr
mtr_t * m_mtr
Owning mini-transaction.
Definition: mtr0mtr.h:207
log_t
Redo log - single data structure with state of the redo log system.
Definition: log0types.h:133
mtr_t::set_log_mode
mtr_log_t set_log_mode(mtr_log_t mode)
Change the logging mode.
mtr_t::get_savepoint
ulint get_savepoint() const
Return current size of the buffer.
Definition: mtr0mtr.h:243
mtr_t::Impl::m_modifications
bool m_modifications
true if the mini-transaction modified buffer pool pages
Definition: mtr0mtr.h:185
mtr_t::start
void start(bool sync=true, bool read_only=false)
Start a mini-transaction.
Definition: mtr0mtr.cc:422
mtr_t::m_commit_lsn
lsn_t m_commit_lsn
LSN at commit time.
Definition: mtr0mtr.h:475
mtr_t::memo_contains_page_flagged
buf_block_t * memo_contains_page_flagged(const byte *ptr, ulint flags) const
Check if memo contains the given page.
Definition: mtr0mtr.cc:722
MTR_STATE_COMMITTING
@ MTR_STATE_COMMITTING
Definition: mtr0types.h:279
mtr_t::set_modified
void set_modified()
Note that the mini-transaction has modified data.
Definition: mtr0mtr.h:320
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.
Definition: mtr0mtr.cc:878
mtr_t::x_lock_space
void x_lock_space(fil_space_t *space, const char *file, ulint line)
Acquire a tablespace X-latch.
Definition: mtr0mtr.cc:497
dyn_buf_t< DYN_ARRAY_DATA_SIZE >
mtr_t::release_block_at_savepoint
void release_block_at_savepoint(ulint savepoint, buf_block_t *block)
Release the block in an mtr memo after a savepoint.
trx0types.h
mtr_state_t
mtr_state_t
Definition: mtr0types.h:276
mtr_t::Impl::m_n_log_recs
ib_uint32_t m_n_log_recs
Count of how many page initial log records have been written to the mtr log.
Definition: mtr0mtr.h:189
mtr_t::sx_latch_at_savepoint
void sx_latch_at_savepoint(ulint savepoint, buf_block_t *block)
SX-latch a not yet latched block after a savepoint.
buf0types.h
mtr_t::set_flush_observer
void set_flush_observer(FlushObserver *observer)
Set flush observer.
Definition: mtr0mtr.h:361
MTR_STATE_ACTIVE
@ MTR_STATE_ACTIVE
Definition: mtr0types.h:278
mtr_log_t
mtr_log_t
Logging modes for a mini-transaction.
Definition: mtr0types.h:41
mtr_t::memo_push
void memo_push(void *object, mtr_memo_type_t type)
Push an object to an mtr memo stack.
mtr_memo_type_t
mtr_memo_type_t
Types for the mlock objects to store in the mtr memo; NOTE that the first 3 values must be RW_S_LATCH...
Definition: mtr0types.h:252
mtr_t::added_rec
void added_rec()
Note that a record has been added to the log.
Definition: mtr0mtr.h:442
mtr_t::Impl::m_log_mode
mtr_log_t m_log_mode
specifies which operations should be logged; default value MTR_LOG_ALL
Definition: mtr0mtr.h:193
mtr_t::discard_modifications
void discard_modifications()
Set the state to not-modified.
Definition: mtr0mtr.h:325
mtr_t::is_async
bool is_async() const
Definition: mtr0mtr.h:233
MTR_STATE_INIT
@ MTR_STATE_INIT
Definition: mtr0types.h:277
mtr_t::commit
void commit()
Commit the mini-transaction.
Definition: mtr0mtr.cc:471
HttpMethod::type
int type
Definition: http_common.h:411
mtr_t::has_committed
bool has_committed() const
Definition: mtr0mtr.h:401
mtr_t::sx_lock
void sx_lock(rw_lock_t *lock, const char *file, ulint line)
Locks a rw-latch in X mode.
fil0fil.h
mlog_id_t
mlog_id_t
Definition: mtr0types.h:59
mtr_t::print
void print() const
Print info of an mtr handle.
Definition: mtr0mtr.cc:745
mtr_t::exit_ibuf
void exit_ibuf()
Note that we have exited from the change buffer code.
Definition: mtr0mtr.h:340
mtr_t::Impl::m_inside_ibuf
bool m_inside_ibuf
true if inside ibuf changes
Definition: mtr0mtr.h:182
mtr_t::Impl::m_made_dirty
bool m_made_dirty
true if mtr has made at least one buffer pool page dirty
Definition: mtr0mtr.h:179
mtr_t::x_latch_at_savepoint
void x_latch_at_savepoint(ulint savepoint, buf_block_t *block)
X-latch a not yet latched block after a savepoint.
rw_lock_t
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:555
mtr_t::m_sync
bool m_sync
true if it is synchronous mini-transaction
Definition: mtr0mtr.h:478
mtr_t::Command
Definition: mtr0mtr.cc:300
mtr_t::get_memo
mtr_buf_t * get_memo()
Definition: mtr0mtr.h:421
mtr_t::is_committing
bool is_committing() const
Definition: mtr0mtr.h:406
MTR_MAGIC_N
#define MTR_MAGIC_N
Definition: mtr0types.h:273
FlushObserver
We use FlushObserver to track flushing of non-redo logged pages in bulk create index(BtrBulk....
Definition: buf0flu.h:269
mtr_t::get_log_mode
mtr_log_t get_log_mode() const
Get the logging mode.
mtr_t::get_expected_log_size
size_t get_expected_log_size() const
Computes the number of bytes that would be written to the redo log if mtr was committed right now (ex...
Definition: mtr0mtr.h:429
mtr_memo_slot_t
Mini-transaction memo stack slot.
Definition: mtr0mtr.h:160
mtr_t::wait_for_flush
void wait_for_flush()
Definition: mtr0mtr.cc:882
mtr_t::set_sync
void set_sync()
Request a future commit to be synchronous.
Definition: mtr0mtr.h:236
mtr0types.h
flags
static int flags[50]
Definition: hp_test1.cc:39
mtr_memo_slot_t::type
ulint type
type of the stored object (MTR_MEMO_S_LOCK, ...)
Definition: mtr0mtr.h:165
mtr_t::release_s_latch_at_savepoint
void release_s_latch_at_savepoint(ulint savepoint, rw_lock_t *lock)
Release the (index tree) s-latch stored in an mtr memo after a savepoint.