Class: Innodb::Page::SysRsegHeader
- Inherits:
-
Innodb::Page
- Object
- Innodb::Page
- Innodb::Page::SysRsegHeader
- Defined in:
- lib/innodb/page/sys_rseg_header.rb
Defined Under Namespace
Classes: Header
Constant Summary collapse
- UNDO_SEGMENT_SLOTS =
The number of undo log slots in the page.
1024
Constants inherited from Innodb::Page
PAGE_TYPE, PAGE_TYPE_BY_VALUE, UNDEFINED_PAGE_NUMBER
Instance Attribute Summary
Attributes inherited from Innodb::Page
Instance Method Summary collapse
- #dump ⇒ Object
- #each_region {|Region.new( offset: pos_rseg_header, length: size_rseg_header, name: :rseg_header, info: "Rollback Segment Header" )| ... } ⇒ Object
- #each_undo_segment ⇒ Object
- #history_list ⇒ Object
-
#pos_rseg_header ⇒ Object
The position of the rollback segment header within the page.
- #pos_undo_segment_array ⇒ Object
-
#rseg_header ⇒ Object
Parse the rollback segment header from the page.
-
#size_rseg_header ⇒ Object
The size of the rollback segment header.
- #size_undo_segment_slot ⇒ Object
Methods inherited from Innodb::Page
#checksum_crc32, #checksum_crc32?, #checksum_innodb, #checksum_innodb?, #checksum_invalid?, #checksum_type, #checksum_valid?, #corrupt?, #cursor, #default_page_size?, #each_page_body_byte_as_uint8, #each_page_header_byte_as_uint8, #extent_descriptor?, #fil_header, #fil_trailer, handle, #in_doublewrite_buffer?, #initialize, #inspect, #inspect_header_fields, maybe_undefined, #misplaced?, #misplaced_offset?, #misplaced_space?, #name, page_type_by_value, parse, #pos_fil_header, #pos_fil_trailer, #pos_page_body, #pos_partial_page_header, register_specialization, #size, #size_fil_header, #size_fil_trailer, #size_page_body, #size_partial_page_header, specialization_for, specialization_for?, #torn?, undefined?
Constructor Details
This class inherits a constructor from Innodb::Page
Instance Method Details
#dump ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 90 def dump super puts puts "rollback segment header:" pp rseg_header puts puts "undo segment array:" each_undo_segment do |slot, page_number| puts " #{slot}: #{page_number}" end end |
#each_region {|Region.new( offset: pos_rseg_header, length: size_rseg_header, name: :rseg_header, info: "Rollback Segment Header" )| ... } ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 66 def each_region(&block) return enum_for(:each_region) unless block_given? super yield Region.new( offset: pos_rseg_header, length: size_rseg_header, name: :rseg_header, info: "Rollback Segment Header" ) (0...UNDO_SEGMENT_SLOTS).each do |slot| yield Region.new( offset: pos_undo_segment_array + (slot * size_undo_segment_slot), length: size_undo_segment_slot, name: :undo_segment_slot, info: "Undo Segment Slot" ) end nil end |
#each_undo_segment ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 53 def each_undo_segment return enum_for(:each_undo_segment) unless block_given? cursor(pos_undo_segment_array).name("undo_segment_array") do |c| (0...UNDO_SEGMENT_SLOTS).each do |slot| page_number = c.name("slot[#{slot}]") do Innodb::Page.maybe_undefined(c.read_uint32) end yield slot, page_number end end end |
#history_list ⇒ Object
49 50 51 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 49 def history_list Innodb::HistoryList.new(rseg_header.history_list) end |
#pos_rseg_header ⇒ Object
The position of the rollback segment header within the page.
18 19 20 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 18 def pos_rseg_header pos_page_body end |
#pos_undo_segment_array ⇒ Object
27 28 29 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 27 def pos_undo_segment_array pos_rseg_header + size_rseg_header end |
#rseg_header ⇒ Object
Parse the rollback segment header from the page.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 36 def rseg_header cursor(pos_rseg_header).name("rseg_header") do |c| Header.new( max_size: c.name("max_size") { c.read_uint32 }, history_size: c.name("history_size") { c.read_uint32 }, history_list: c.name("history_list") do Innodb::List::History.new(@space, Innodb::List.get_base_node(c)) end, fseg: c.name("fseg") { Innodb::FsegEntry.get_inode(@space, c) } ) end end |
#size_rseg_header ⇒ Object
The size of the rollback segment header.
23 24 25 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 23 def size_rseg_header 4 + 4 + Innodb::List::BASE_NODE_SIZE + Innodb::FsegEntry::SIZE end |
#size_undo_segment_slot ⇒ Object
31 32 33 |
# File 'lib/innodb/page/sys_rseg_header.rb', line 31 def size_undo_segment_slot 4 end |