MySQL  8.0.12
Source Code Documentation
trx0sys.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24  The lines above are intentionally left blank
25 */
26 
27 /** @file include/trx0sys.h
28  Transaction system
29 
30  Created 3/26/1996 Heikki Tuuri
31  *******************************************************/
32 
33 #ifndef trx0sys_h
34 #define trx0sys_h
35 
36 #include "univ.i"
37 
38 #include "buf0buf.h"
39 #include "fil0fil.h"
40 #include "trx0types.h"
41 #ifndef UNIV_HOTBACKUP
42 #include "mem0mem.h"
43 #include "mtr0mtr.h"
44 #include "page0types.h"
45 #include "ut0byte.h"
46 #include "ut0lst.h"
47 #include "ut0mutex.h"
48 #endif /* !UNIV_HOTBACKUP */
49 #include <atomic>
50 #include "trx0trx.h"
51 
52 #ifndef UNIV_HOTBACKUP
53 typedef UT_LIST_BASE_NODE_T(trx_t) trx_ut_list_t;
54 
55 // Forward declaration
56 class MVCC;
57 class ReadView;
58 
59 /** The transaction system */
60 extern trx_sys_t *trx_sys;
61 
62 /** Checks if a page address is the trx sys header page.
63 @param[in] page_id page id
64 @return true if trx sys header page */
65 UNIV_INLINE
66 bool trx_sys_hdr_page(const page_id_t &page_id);
67 
68 /** Creates and initializes the central memory structures for the transaction
69  system. This is called when the database is started.
70  @return min binary heap of rsegs to purge */
72 /** Creates the trx_sys instance and initializes purge_queue and mutex. */
73 void trx_sys_create(void);
74 /** Creates and initializes the transaction system at the database creation. */
75 void trx_sys_create_sys_pages(void);
76 
77 /** Find the page number in the TRX_SYS page for a given slot/rseg_id
78 @param[in] rseg_id slot number in the TRX_SYS page rseg array
79 @return page number from the TRX_SYS page rseg array */
81 
82 /** Look for a free slot for a rollback segment in the trx system file copy.
83 @param[in,out] mtr mtr
84 @return slot index or ULINT_UNDEFINED if not found */
85 ulint trx_sysf_rseg_find_free(mtr_t *mtr);
86 
87 /** Gets a pointer to the transaction system file copy and x-locks its page.
88  @return pointer to system file copy, page x-locked */
89 UNIV_INLINE
90 trx_sysf_t *trx_sysf_get(mtr_t *mtr); /*!< in: mtr */
91 
92 /** Gets the space of the nth rollback segment slot in the trx system
93 file copy.
94 @param[in] sys_header trx sys file copy
95 @param[in] i slot index == rseg id
96 @param[in] mtr mtr
97 @return space id */
98 UNIV_INLINE
99 space_id_t trx_sysf_rseg_get_space(trx_sysf_t *sys_header, ulint i, mtr_t *mtr);
100 
101 /** Gets the page number of the nth rollback segment slot in the trx system
102 file copy.
103 @param[in] sys_header trx sys file copy
104 @param[in] i slot index == rseg id
105 @param[in] mtr mtr
106 @return page number, FIL_NULL if slot unused */
107 UNIV_INLINE
108 page_no_t trx_sysf_rseg_get_page_no(trx_sysf_t *sys_header, ulint i,
109  mtr_t *mtr);
110 
111 /** Sets the space id of the nth rollback segment slot in the trx system
112 file copy.
113 @param[in] sys_header trx sys file copy
114 @param[in] i slot index == rseg id
115 @param[in] space space id
116 @param[in] mtr mtr */
117 UNIV_INLINE
118 void trx_sysf_rseg_set_space(trx_sysf_t *sys_header, ulint i, space_id_t space,
119  mtr_t *mtr);
120 
121 /** Set the page number of the nth rollback segment slot in the trx system
122 file copy.
123 @param[in] sys_header trx sys file copy
124 @param[in] i slot index == rseg id
125 @param[in] page_no page number, FIL_NULL if the slot is reset to
126  unused
127 @param[in] mtr mtr */
128 UNIV_INLINE
129 void trx_sysf_rseg_set_page_no(trx_sysf_t *sys_header, ulint i,
130  page_no_t page_no, mtr_t *mtr);
131 
132 /** Allocates a new transaction id.
133  @return new, allocated trx id */
134 UNIV_INLINE
136 /** Determines the maximum transaction id.
137  @return maximum currently allocated trx id; will be stale after the
138  next call to trx_sys_get_new_trx_id() */
139 UNIV_INLINE
141 
142 #ifdef UNIV_DEBUG
143 /* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
145 #endif
146 #endif /* !UNIV_HOTBACKUP */
147 
148 /** Writes a trx id to an index page. In case that the id size changes in some
149 future version, this function should be used instead of mach_write_...
150 @param[in] ptr pointer to memory where written
151 @param[in] id id */
152 UNIV_INLINE
153 void trx_write_trx_id(byte *ptr, trx_id_t id);
154 
155 #ifndef UNIV_HOTBACKUP
156 /** Reads a trx id from an index page. In case that the id size changes in
157  some future version, this function should be used instead of
158  mach_read_...
159  @return id */
160 UNIV_INLINE
162  const byte *ptr); /*!< in: pointer to memory from where to read */
163 
164 /** Looks for the trx instance with the given id in the rw trx_list.
165  @return the trx handle or NULL if not found */
166 UNIV_INLINE
167 trx_t *trx_get_rw_trx_by_id(trx_id_t trx_id); /*!< in: trx id to search for */
168 /** Returns the minimum trx id in rw trx list. This is the smallest id for which
169  the trx can possibly be active. (But, you must look at the trx->state to
170  find out if the minimum trx id transaction itself is active, or already
171  committed.)
172  @return the minimum trx id, or trx_sys->max_trx_id if the trx list is empty */
173 UNIV_INLINE
175 
176 /** Checks if a rw transaction with the given id is active.
177 @param[in] trx_id trx id of the transaction
178 @param[in] corrupt NULL or pointer to a flag that will be set if
179  corrupt
180 @return transaction instance if active, or NULL */
181 UNIV_INLINE
182 trx_t *trx_rw_is_active_low(trx_id_t trx_id, ibool *corrupt);
183 
184 /** Checks if a rw transaction with the given id is active. If the caller is
185 not holding trx_sys->mutex, the transaction may already have been committed.
186 @param[in] trx_id trx id of the transaction
187 @param[in] corrupt NULL or pointer to a flag that will be set if
188  corrupt
189 @param[in] do_ref_count if true then increment the trx_t::n_ref_count
190 @return transaction instance if active, or NULL; */
191 UNIV_INLINE
192 trx_t *trx_rw_is_active(trx_id_t trx_id, ibool *corrupt, bool do_ref_count);
193 
194 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
195 /** Assert that a transaction has been recovered.
196  @return true */
197 UNIV_INLINE
198 ibool trx_assert_recovered(trx_id_t trx_id) /*!< in: transaction identifier */
199  MY_ATTRIBUTE((warn_unused_result));
200 #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
201 /** Updates the offset information about the end of the MySQL binlog entry
202  which corresponds to the transaction just being committed. In a MySQL
203  replication slave updates the latest master binlog position up to which
204  replication has proceeded. */
206  const char *file_name, /*!< in: MySQL log file name */
207  int64_t offset, /*!< in: position in that log file */
208  ulint field, /*!< in: offset of the MySQL log info field in
209  the trx sys header */
210  mtr_t *mtr); /*!< in: mtr */
211 /** Prints to stderr the MySQL binlog offset info in the trx system header if
212  the magic number shows it valid. */
214 /** Shutdown/Close the transaction system. */
215 void trx_sys_close(void);
216 
217 /** Determine if there are incomplete transactions in the system.
218 @return whether incomplete transactions need rollback */
219 UNIV_INLINE
220 bool trx_sys_need_rollback();
221 
222 /*********************************************************************
223 Check if there are any active (non-prepared) transactions.
224 @return total number of active transactions or 0 if none */
226 #else /* !UNIV_HOTBACKUP */
227 /** Prints to stderr the MySQL binlog info in the system header if the
228  magic number shows it valid. */
229 void trx_sys_print_mysql_binlog_offset_from_page(
230  const byte *page); /*!< in: buffer containing the trx
231  system header page, i.e., page number
232  TRX_SYS_PAGE_NO in the tablespace */
233 #endif /* !UNIV_HOTBACKUP */
234 /**
235 Add the transaction to the RW transaction set
236 @param trx transaction instance to add */
237 UNIV_INLINE
238 void trx_sys_rw_trx_add(trx_t *trx);
239 
240 #ifdef UNIV_DEBUG
241 /** Validate the trx_sys_t::rw_trx_list.
242  @return true if the list is valid */
244 #endif /* UNIV_DEBUG */
245 
246 /** Initialize trx_sys_undo_spaces, called once during srv_start(). */
248 
249 /** Free the resources occupied by trx_sys_undo_spaces,
250 called once during thread de-initialization. */
252 
253 /** The automatically created system rollback segment has this id */
254 #define TRX_SYS_SYSTEM_RSEG_ID 0
255 
256 /** The offset of the transaction system header on the page */
257 #define TRX_SYS FSEG_PAGE_DATA
258 
259 /** Transaction system header */
260 /*------------------------------------------------------------- @{ */
261 #define TRX_SYS_TRX_ID_STORE \
262  0 /*!< the maximum trx id or trx \
263  number modulo \
264  TRX_SYS_TRX_ID_UPDATE_MARGIN \
265  written to a file page by any \
266  transaction; the assignment of \
267  transaction ids continues from \
268  this number rounded up by \
269  TRX_SYS_TRX_ID_UPDATE_MARGIN \
270  plus \
271  TRX_SYS_TRX_ID_UPDATE_MARGIN \
272  when the database is \
273  started */
274 #define TRX_SYS_FSEG_HEADER \
275  8 /*!< segment header for the \
276  tablespace segment the trx \
277  system is created into */
278 #define TRX_SYS_RSEGS (8 + FSEG_HEADER_SIZE)
279 /*!< the start of the array of
280 rollback segment specification
281 slots */
282 /*------------------------------------------------------------- @} */
283 
284 /* Originally, InnoDB defined TRX_SYS_N_RSEGS as 256 but created only one
285 rollback segment. It initialized some arrays with this number of entries.
286 We must remember this limit in order to keep file compatibility. */
287 #define TRX_SYS_OLD_N_RSEGS 256
288 
289 /* The system temporary tablespace was originally allocated rseg_id slot
290 numbers 1 through 32 in the TRX_SYS page. But those slots were not used
291 because those Rollback segments were recreated at startup and after any
292 crash. These slots are now used for redo-enabled rollback segments.
293 The default number of rollback segments in the temporary tablespace
294 remains the same. */
295 #define TRX_SYS_OLD_TMP_RSEGS 32
296 
297 /** Maximum length of MySQL binlog file name, in bytes. */
298 #define TRX_SYS_MYSQL_LOG_NAME_LEN 512
299 /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */
300 #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344
301 
302 #if UNIV_PAGE_SIZE_MIN < 4096
303 #error "UNIV_PAGE_SIZE_MIN < 4096"
304 #endif
305 /** The offset of the MySQL binlog offset info in the trx system header */
306 #define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000)
307 #define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD \
308  0 /*!< magic number which is \
309  TRX_SYS_MYSQL_LOG_MAGIC_N \
310  if we have valid data in the \
311  MySQL binlog info */
312 #define TRX_SYS_MYSQL_LOG_OFFSET_HIGH \
313  4 /*!< high 4 bytes of the offset \
314  within that file */
315 #define TRX_SYS_MYSQL_LOG_OFFSET_LOW \
316  8 /*!< low 4 bytes of the offset \
317  within that file */
318 #define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */
320 /** Doublewrite buffer */
321 /* @{ */
322 /** The offset of the doublewrite buffer header on the trx system header page */
323 #define TRX_SYS_DOUBLEWRITE (UNIV_PAGE_SIZE - 200)
324 /*-------------------------------------------------------------*/
325 #define TRX_SYS_DOUBLEWRITE_FSEG \
326  0 /*!< fseg header of the fseg \
327  containing the doublewrite \
328  buffer */
329 #define TRX_SYS_DOUBLEWRITE_MAGIC FSEG_HEADER_SIZE
330 /*!< 4-byte magic number which
331 shows if we already have
332 created the doublewrite
333 buffer */
334 #define TRX_SYS_DOUBLEWRITE_BLOCK1 (4 + FSEG_HEADER_SIZE)
335 /*!< page number of the
336 first page in the first
337 sequence of 64
338 (= FSP_EXTENT_SIZE) consecutive
339 pages in the doublewrite
340 buffer */
341 #define TRX_SYS_DOUBLEWRITE_BLOCK2 (8 + FSEG_HEADER_SIZE)
342 /*!< page number of the
343 first page in the second
344 sequence of 64 consecutive
345 pages in the doublewrite
346 buffer */
347 #define TRX_SYS_DOUBLEWRITE_REPEAT \
348  12 /*!< we repeat \
349  TRX_SYS_DOUBLEWRITE_MAGIC, \
350  TRX_SYS_DOUBLEWRITE_BLOCK1, \
351  TRX_SYS_DOUBLEWRITE_BLOCK2 \
352  so that if the trx sys \
353  header is half-written \
354  to disk, we still may \
355  be able to recover the \
356  information */
357 /** If this is not yet set to TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
358 we must reset the doublewrite buffer, because starting from 4.1.x the
359 space id of a data page is stored into
360 FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. */
361 #define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED (24 + FSEG_HEADER_SIZE)
362 
363 /*-------------------------------------------------------------*/
364 /** Contents of TRX_SYS_DOUBLEWRITE_MAGIC */
365 #define TRX_SYS_DOUBLEWRITE_MAGIC_N 536853855
366 /** Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED */
367 #define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N 1783657386
368 
369 /** Size of the doublewrite block in pages */
370 #define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE
371 /* @} */
372 
373 /** List of undo tablespace IDs. */
374 class Space_Ids : public std::vector<space_id_t, ut_allocator<space_id_t>> {
375  public:
376  void sort() { std::sort(begin(), end()); }
377 
378  bool contains(space_id_t id) {
379  if (size() == 0) {
380  return (false);
381  }
382 
383  iterator it = std::find(begin(), end(), id);
384 
385  return (it != end());
386  }
387 
388  iterator find(space_id_t id) { return (std::find(begin(), end(), id)); }
389 };
390 
391 #ifndef UNIV_HOTBACKUP
392 /** The transaction system central memory data structure. */
393 struct trx_sys_t {
394  TrxSysMutex mutex; /*!< mutex protecting most fields in
395  this structure except when noted
396  otherwise */
397 
398  MVCC *mvcc; /*!< Multi version concurrency control
399  manager */
400  volatile trx_id_t max_trx_id; /*!< The smallest number not yet
401  assigned as a transaction id or
402  transaction number. This is declared
403  volatile because it can be accessed
404  without holding any mutex during
405  AC-NL-RO view creation. */
406  std::atomic<trx_id_t> min_active_id;
407  /*!< Minimal transaction id which is
408  still in active state. */
409  trx_ut_list_t serialisation_list;
410  /*!< Ordered on trx_t::no of all the
411  currenrtly active RW transactions */
412 #ifdef UNIV_DEBUG
413  trx_id_t rw_max_trx_id; /*!< Max trx id of read-write
414  transactions which exist or existed */
415 #endif /* UNIV_DEBUG */
417  char pad1[64]; /*!< To avoid false sharing */
418  trx_ut_list_t rw_trx_list; /*!< List of active and committed in
419  memory read-write transactions, sorted
420  on trx id, biggest first. Recovered
421  transactions are always on this list. */
423  char pad2[64]; /*!< To avoid false sharing */
424  trx_ut_list_t mysql_trx_list; /*!< List of transactions created
425  for MySQL. All user transactions are
426  on mysql_trx_list. The rw_trx_list
427  can contain system transactions and
428  recovered transactions that will not
429  be in the mysql_trx_list.
430  mysql_trx_list may additionally contain
431  transactions that have not yet been
432  started in InnoDB. */
433 
434  trx_ids_t rw_trx_ids; /*!< Array of Read write transaction IDs
435  for MVCC snapshot. A ReadView would take
436  a snapshot of these transactions whose
437  changes are not visible to it. We should
438  remove transactions from the list before
439  committing in memory and releasing locks
440  to ensure right order of removal and
441  consistent snapshot. */
442 
443  char pad3[64]; /*!< To avoid false sharing */
444 
445  Rsegs rsegs; /*!< Vector of pointers to rollback
446  segments. These rsegs are iterated
447  and added to the end under a read
448  lock. They are deleted under a write
449  lock while the vector is adjusted.
450  They are created and destroyed in
451  single-threaded mode. */
453  Rsegs tmp_rsegs; /*!< Vector of pointers to rollback
454  segments within the temp tablespace;
455  This vector is created and destroyed
456  in single-threaded mode so it is not
457  protected by any mutex because it is
458  read-only during multi-threaded
459  operation. */
460 
461  ulint rseg_history_len;
462  /*!< Length of the TRX_RSEG_HISTORY
463  list (update undo logs for committed
464  transactions), protected by
465  rseg->mutex */
466 
467  TrxIdSet rw_trx_set; /*!< Mapping from transaction id
468  to transaction instance */
469 
470  ulint n_prepared_trx; /*!< Number of transactions currently
471  in the XA PREPARED state */
472 
473  bool found_prepared_trx; /*!< True if XA PREPARED trxs are
474  found. */
475 };
476 
477 #endif /* !UNIV_HOTBACKUP */
478 
479 /** A list of undo tablespace IDs found in the TRX_SYS page.
480 This cannot be part of the trx_sys_t object because it is initialized before
481 that object is created. These are the old type of undo tablespaces that do not
482 have space_IDs in the reserved range nor contain an RSEG_ARRAY page. */
484 
485 /** When a trx id which is zero modulo this number (which must be a power of
486 two) is assigned, the field TRX_SYS_TRX_ID_STORE on the transaction system
487 page is updated */
488 #define TRX_SYS_TRX_ID_WRITE_MARGIN ((trx_id_t)256)
490 /** Test if trx_sys->mutex is owned. */
491 #define trx_sys_mutex_own() (trx_sys->mutex.is_owned())
492 
493 /** Acquire the trx_sys->mutex. */
494 #define trx_sys_mutex_enter() \
495  do { \
496  mutex_enter(&trx_sys->mutex); \
497  } while (0)
499 /** Release the trx_sys->mutex. */
500 #define trx_sys_mutex_exit() \
501  do { \
502  trx_sys->mutex.exit(); \
503  } while (0)
504 
505 #include "trx0sys.ic"
506 
507 #endif
page_no_t trx_sysf_rseg_find_page_no(ulint rseg_id)
Find the page number in the TRX_SYS page for a given slot/rseg_id.
Definition: trx0sys.cc:197
trx_sys_t * trx_sys
The transaction system.
Definition: trx0sys.cc:57
unsigned char byte
Blob class.
Definition: common.h:159
UNIV_INLINE trx_t * trx_rw_is_active_low(trx_id_t trx_id, ibool *corrupt)
Checks if a rw transaction with the given id is active.
The MVCC read view manager.
Definition: read0read.h:43
void trx_sys_create(void)
Creates the trx_sys instance and initializes purge_queue and mutex.
Definition: trx0sys.cc:382
This is a wrapper for a std::vector of trx_rseg_t object pointers.
Definition: trx0types.h:251
uint32 page_no_t
Page number.
Definition: api0api.h:57
UNIV_INLINE page_no_t trx_sysf_rseg_get_page_no(trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
Gets the page number of the nth rollback segment slot in the trx system file copy.
List utilities.
UNIV_INLINE trx_sysf_t * trx_sysf_get(mtr_t *mtr)
Gets a pointer to the transaction system file copy and x-locks its page.
The low-level file system.
UNIV_INLINE void trx_write_trx_id(byte *ptr, trx_id_t id)
Writes a trx id to an index page.
Definition: trx0trx.h:713
Read view lists the trx ids of those transactions for which a consistent read should not see the modi...
Definition: read0types.h:47
pthread_mutex_t mutex
Definition: memcached.c:384
Page identifier.
Definition: buf0types.h:153
Space_Ids * trx_sys_undo_spaces
A list of undo tablespace IDs found in the TRX_SYS page.
Definition: trx0sys.cc:607
void trx_sys_undo_spaces_deinit()
Free the resources occupied by trx_sys_undo_spaces, called once during thread de-initialization.
Definition: trx0sys.cc:618
UNIV_INLINE bool trx_sys_hdr_page(const page_id_t &page_id)
Checks if a page address is the trx sys header page.
iterator find(space_id_t id)
Definition: trx0sys.h:416
typedef UT_LIST_BASE_NODE_T(trx_t) trx_ut_list_t
Index page routines.
int page
Definition: ctype-mb.cc:1220
std::priority_queue< TrxUndoRsegs, std::vector< TrxUndoRsegs, ut_allocator< TrxUndoRsegs > >, TrxUndoRsegs > purge_pq_t
Definition: trx0types.h:424
purge_pq_t * trx_sys_init_at_db_start(void)
Creates and initializes the central memory structures for the transaction system. ...
Definition: trx0sys.cc:298
bool trx_sys_validate_trx_list()
Validate the trx_sys_t::rw_trx_list.
Definition: trx0sys.cc:593
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:191
void trx_sys_close(void)
Shutdown/Close the transaction system.
Definition: trx0sys.cc:449
ulint trx_sys_any_active_transactions(void)
Definition: trx0sys.cc:530
unsigned int uint
Definition: uca-dump.cc:29
Utilities for byte operations.
Transaction system global type definitions.
void trx_sys_print_mysql_binlog_offset(void)
Prints to stderr the MySQL binlog offset info in the trx system header if the magic number shows it v...
Definition: trx0sys.cc:162
std::set< TrxTrack, TrxTrackCmp, ut_allocator< TrxTrack > > TrxIdSet
Definition: trx0types.h:460
UNIV_INLINE trx_t * trx_get_rw_trx_by_id(trx_id_t trx_id)
Looks for the trx instance with the given id in the rw trx_list.
Policy based mutexes.
UNIV_INLINE ibool trx_assert_recovered(trx_id_t trx_id)
Assert that a transaction has been recovered.
uint trx_rseg_n_slots_debug
Definition: trx0sys.cc:94
ulint trx_sysf_rseg_find_free(mtr_t *mtr)
Look for a free slot for a rollback segment in the trx system file copy.
Definition: trx0sys.cc:214
The memory management.
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
List of undo tablespace IDs.
Definition: trx0sys.h:402
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:148
UNIV_INLINE trx_id_t trx_read_trx_id(const byte *ptr)
Reads a trx id from an index page.
UNIV_INLINE trx_id_t trx_sys_get_max_trx_id(void)
Determines the maximum transaction id.
UNIV_INLINE space_id_t trx_sysf_rseg_get_space(trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
Gets the space of the nth rollback segment slot in the trx system file copy.
void trx_sys_undo_spaces_init()
Initialize trx_sys_undo_spaces, called once during srv_start().
Definition: trx0sys.cc:610
UNIV_INLINE void trx_sysf_rseg_set_space(trx_sysf_t *sys_header, ulint i, space_id_t space, mtr_t *mtr)
Sets the space id of the nth rollback segment slot in the trx system file copy.
std::vector< trx_id_t, ut_allocator< trx_id_t > > trx_ids_t
Definition: trx0types.h:426
UNIV_INLINE trx_id_t trx_sys_get_new_trx_id()
Allocates a new transaction id.
Mini-transaction buffer.
The transaction.
void trx_sys_create_sys_pages(void)
Creates and initializes the transaction system at the database creation.
Definition: trx0sys.cc:408
void trx_sys_update_mysql_binlog_offset(const char *file_name, int64_t offset, ulint field, mtr_t *mtr)
Updates the offset information about the end of the MySQL binlog entry which corresponds to the trans...
Definition: trx0sys.cc:120
UNIV_INLINE bool trx_sys_need_rollback()
Determine if there are incomplete transactions in the system.
The transaction system central memory data structure.
Definition: trx0sys.h:421
UNIV_INLINE void trx_sys_rw_trx_add(trx_t *trx)
Add the transaction to the RW transaction set.
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:164
The database buffer pool high-level routines.
void sort()
Definition: trx0sys.h:404
ib_mutex_t TrxSysMutex
Definition: trx0types.h:184
UNIV_INLINE trx_t * trx_rw_is_active(trx_id_t trx_id, ibool *corrupt, bool do_ref_count)
Checks if a rw transaction with the given id is active.
bool contains(space_id_t id)
Definition: trx0sys.h:406
UNIV_INLINE void trx_sysf_rseg_set_page_no(trx_sysf_t *sys_header, ulint i, page_no_t page_no, mtr_t *mtr)
Set the page number of the nth rollback segment slot in the trx system file copy. ...
byte trx_sysf_t
File objects.
Definition: trx0types.h:165
UNIV_INLINE trx_id_t trx_rw_min_trx_id(void)
Returns the minimum trx id in rw trx list.