Class: Innodb::Page::TrxSys
- Inherits:
-
Innodb::Page
- Object
- Innodb::Page
- Innodb::Page::TrxSys
- Defined in:
- lib/innodb/page/trx_sys.rb
Overview
A specialized class for TRX_SYS pages, which contain various information about the transaction system within InnoDB. Only one TRX_SYS page exists in any given InnoDB installation, and it is page 5 of the system tablespace (space 0), most commonly named “ibdata1”.
The basic structure of a TRX_SYS page is: FIL header, TRX_SYS header, empty space, master binary log information, empty space, local binary log information, empty space, doublewrite information (repeated twice), empty space, and FIL trailer.
Constant Summary collapse
- MYSQL_LOG_MAGIC_N =
A magic number present in each MySQL binary log information structure, which helps identify whether the structure is populated or not.
873422344
- DOUBLEWRITE_MAGIC_N =
A magic number present in each doublewrite buffer information structure, which helps identify whether the structure is populated or not.
536853855
- DOUBLEWRITE_SPACE_ID_STORED_MAGIC_N =
A magic number present in the overall doublewrite buffer structure, which identifies whether the space id is stored.
1783657386
Constants inherited from Innodb::Page
PAGE_TYPE, SPECIALIZED_CLASSES
Instance Attribute Summary
Attributes inherited from Innodb::Page
Instance Method Summary collapse
-
#doublewrite_info ⇒ Object
Read the overall doublewrite buffer structures.
-
#doublewrite_page_info(cursor) ⇒ Object
Read a single doublewrite buffer information structure from a given cursor.
-
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
-
#mysql_log_info(offset) ⇒ Object
Read a MySQL binary log information structure from a given position.
-
#pos_doublewrite_info ⇒ Object
The doublewrite buffer information is located 200 bytes from the end of the page.
-
#pos_mysql_binary_log_info ⇒ Object
The local binary log information is located 1000 bytes from the end of the page.
-
#pos_mysql_master_log_info ⇒ Object
The master’s binary log information is located 2000 bytes from the end of the page.
-
#pos_trx_sys_header ⇒ Object
The TRX_SYS header immediately follows the FIL header.
-
#trx_sys ⇒ Object
Read the TRX_SYS headers and other information.
Methods inherited from Innodb::Page
#cursor, #data, #fil_header, #initialize, #inspect, #lsn, maybe_undefined, #next, #offset, parse, #pos_fil_header, #pos_fil_trailer, #prev, #size, #size_fil_header, #size_fil_trailer, #type
Constructor Details
This class inherits a constructor from Innodb::Page
Instance Method Details
#doublewrite_info ⇒ Object
Read the overall doublewrite buffer structures
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/innodb/page/trx_sys.rb', line 69 def doublewrite_info c = cursor(pos_doublewrite_info) { :fseg => Innodb::FsegEntry.get_inode(@space, c), :page_info => [ doublewrite_page_info(c), doublewrite_page_info(c), ], :space_id_stored => c.get_uint32 == DOUBLEWRITE_SPACE_ID_STORED_MAGIC_N, } end |
#doublewrite_page_info(cursor) ⇒ Object
Read a single doublewrite buffer information structure from a given cursor.
54 55 56 57 58 59 60 61 62 |
# File 'lib/innodb/page/trx_sys.rb', line 54 def doublewrite_page_info(cursor) { :magic_n => cursor.get_uint32, :page_number => [ cursor.get_uint32, cursor.get_uint32, ], } end |
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
94 95 96 97 98 99 100 |
# File 'lib/innodb/page/trx_sys.rb', line 94 def dump super puts "trx_sys:" pp trx_sys puts end |
#mysql_log_info(offset) ⇒ Object
Read a MySQL binary log information structure from a given position.
39 40 41 42 43 44 45 46 47 |
# File 'lib/innodb/page/trx_sys.rb', line 39 def mysql_log_info(offset) c = cursor(offset) if c.get_uint32 == MYSQL_LOG_MAGIC_N { :offset => c.get_uint64, :name => c.get_bytes(100), } end end |
#pos_doublewrite_info ⇒ Object
The doublewrite buffer information is located 200 bytes from the end of the page.
30 31 32 |
# File 'lib/innodb/page/trx_sys.rb', line 30 def pos_doublewrite_info size - 200 end |
#pos_mysql_binary_log_info ⇒ Object
The local binary log information is located 1000 bytes from the end of the page.
24 25 26 |
# File 'lib/innodb/page/trx_sys.rb', line 24 def pos_mysql_binary_log_info size - 1000 end |
#pos_mysql_master_log_info ⇒ Object
The master’s binary log information is located 2000 bytes from the end of the page.
18 19 20 |
# File 'lib/innodb/page/trx_sys.rb', line 18 def pos_mysql_master_log_info size - 2000 end |
#pos_trx_sys_header ⇒ Object
The TRX_SYS header immediately follows the FIL header.
12 13 14 |
# File 'lib/innodb/page/trx_sys.rb', line 12 def pos_trx_sys_header pos_fil_header + size_fil_header end |
#trx_sys ⇒ Object
Read the TRX_SYS headers and other information.
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/innodb/page/trx_sys.rb', line 82 def trx_sys c = cursor(pos_trx_sys_header) @trx_sys ||= { :trx_id => c.get_uint64, :fseg => Innodb::FsegEntry.get_inode(@space, c), :binary_log => mysql_log_info(pos_mysql_binary_log_info), :master_log => mysql_log_info(pos_mysql_master_log_info), :doublewrite => doublewrite_info, } end |