Class: Innodb::Page::FspHdrXdes
- Inherits:
-
Innodb::Page
- Object
- Innodb::Page
- Innodb::Page::FspHdrXdes
- Defined in:
- lib/innodb/page/fsp_hdr_xdes.rb
Overview
A specialized class for FSP_HDR (filespace header) and XDES (extent descriptor) page types. Each tablespace always has an FSP_HDR page as its first page (page 0), and has repeating XDES pages every 16,384 pages after that (page 16384, 32768, …). The FSP_HDR and XDES page structure is completely identical, with the exception that the FSP header structure is zero-filled on XDES pages, but populated on FSP_HDR pages.
The basic structure of FSP_HDR and XDES pages is: FIL header, FSP header, an array of 256 XDES entries, empty (unused) space, and FIL trailer.
Constant Summary
Constants inherited from Innodb::Page
PAGE_TYPE, SPECIALIZED_CLASSES
Instance Attribute Summary
Attributes inherited from Innodb::Page
Instance Method Summary collapse
-
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
-
#each_list ⇒ Object
Iterate through all lists in the file space.
-
#each_xdes ⇒ Object
Iterate through all XDES entries in order.
-
#entries_in_xdes_array ⇒ Object
The number of entries in the XDES array.
-
#fsp_header ⇒ Object
Read the FSP (filespace) header, which contains a few counters and flags, as well as list base nodes for each list maintained in the filespace.
-
#pos_fsp_header ⇒ Object
The FSP header immediately follows the FIL header.
-
#pos_xdes_array ⇒ Object
The XDES entry array immediately follows the FSP header.
-
#size_fsp_header ⇒ Object
The FSP header contains six 32-bit integers, one 64-bit integer, and 5 list base nodes.
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
#dump ⇒ Object
Dump the contents of a page for debugging purposes.
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 88 def dump super puts "fsp header:" pp fsp_header puts puts "xdes entries:" each_xdes do |xdes| pp xdes end puts end |
#each_list ⇒ Object
Iterate through all lists in the file space.
62 63 64 65 66 67 68 69 70 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 62 def each_list unless block_given? return enum_for(:each_list) end fsp_header.each do |key, value| yield key, value if value.is_a?(Innodb::List) end end |
#each_xdes ⇒ Object
Iterate through all XDES entries in order. This is useful for debugging, but each of these entries is actually a node in some other list. The state field in the XDES entry indicates which type of list it is present in, although not necessarily which list (e.g. :fseg).
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 76 def each_xdes unless block_given? return enum_for(:each_xdes) end c = cursor(pos_xdes_array) entries_in_xdes_array.times do yield Innodb::Xdes.new(self, c) end end |
#entries_in_xdes_array ⇒ Object
The number of entries in the XDES array. Defined as page size divided by extent size.
32 33 34 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 32 def entries_in_xdes_array size / space.pages_per_extent end |
#fsp_header ⇒ Object
Read the FSP (filespace) header, which contains a few counters and flags, as well as list base nodes for each list maintained in the filespace.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 38 def fsp_header c = cursor(pos_fsp_header) @fsp_header ||= { :space_id => c.get_uint32, :unused => c.get_uint32, :size => c.get_uint32, :free_limit => c.get_uint32, :flags => c.get_uint32, :frag_n_used => c.get_uint32, :free => Innodb::List::Xdes.new(@space, Innodb::List.get_base_node(c)), :free_frag => Innodb::List::Xdes.new(@space, Innodb::List.get_base_node(c)), :full_frag => Innodb::List::Xdes.new(@space, Innodb::List.get_base_node(c)), :first_unused_seg => c.get_uint64, :full_inodes => Innodb::List::Inode.new(@space, Innodb::List.get_base_node(c)), :free_inodes => Innodb::List::Inode.new(@space, Innodb::List.get_base_node(c)), } end |
#pos_fsp_header ⇒ Object
The FSP header immediately follows the FIL header.
15 16 17 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 15 def pos_fsp_header pos_fil_header + size_fil_header end |
#pos_xdes_array ⇒ Object
The XDES entry array immediately follows the FSP header.
26 27 28 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 26 def pos_xdes_array pos_fsp_header + size_fsp_header end |
#size_fsp_header ⇒ Object
The FSP header contains six 32-bit integers, one 64-bit integer, and 5 list base nodes.
21 22 23 |
# File 'lib/innodb/page/fsp_hdr_xdes.rb', line 21 def size_fsp_header ((4 * 6) + (1 * 8) + (5 * Innodb::List::BASE_NODE_SIZE)) end |