Class: Innodb::Page::SysDataDictionaryHeader

Inherits:
Innodb::Page show all
Defined in:
lib/innodb/page/sys_data_dictionary_header.rb

Defined Under Namespace

Classes: Header

Constant Summary

Constants inherited from Innodb::Page

PAGE_TYPE, PAGE_TYPE_BY_VALUE, UNDEFINED_PAGE_NUMBER

Instance Attribute Summary

Attributes inherited from Innodb::Page

#space

Instance Method Summary collapse

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

#data_dictionary_headerObject

Parse the data dictionary header from the page.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 29

def data_dictionary_header
  cursor(pos_data_dictionary_header).name("data_dictionary_header") do |c|
    Header.new(
      max_row_id: c.name("max_row_id") { c.read_uint64 },
      max_table_id: c.name("max_table_id") { c.read_uint64 },
      max_index_id: c.name("max_index_id") { c.read_uint64 },
      max_space_id: c.name("max_space_id") { c.read_uint32 },
      unused_mix_id_low: c.name("unused_mix_id_low") { c.read_uint32 },
      indexes: c.name("indexes") do
        {
          SYS_TABLES: c.name("SYS_TABLES") do
            {
              PRIMARY: c.name("PRIMARY") { c.read_uint32 },
              ID: c.name("ID") { c.read_uint32 },
            }
          end,
          SYS_COLUMNS: c.name("SYS_COLUMNS") do
            {
              PRIMARY: c.name("PRIMARY") { c.read_uint32 },
            }
          end,
          SYS_INDEXES: c.name("SYS_INDEXES") do
            {
              PRIMARY: c.name("PRIMARY") { c.read_uint32 },
            }
          end,
          SYS_FIELDS: c.name("SYS_FIELDS") do
            {
              PRIMARY: c.name("PRIMARY") { c.read_uint32 },
            }
          end,
        }
      end,
      unused_space: c.name("unused_space") { c.read_bytes(4) },
      fseg: c.name("fseg") { Innodb::FsegEntry.get_inode(@space, c) }
    )
  end
end

#dumpObject



83
84
85
86
87
88
89
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 83

def dump
  super

  puts
  puts "data_dictionary header:"
  pp data_dictionary_header
end

#each_region {|Region.new( offset: pos_data_dictionary_header, length: size_data_dictionary_header, name: :data_dictionary_header, info: "Data Dictionary Header" )| ... } ⇒ Object

Yields:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 68

def each_region(&block)
  return enum_for(:each_region) unless block_given?

  super

  yield Region.new(
    offset: pos_data_dictionary_header,
    length: size_data_dictionary_header,
    name: :data_dictionary_header,
    info: "Data Dictionary Header"
  )

  nil
end

#pos_data_dictionary_headerObject

The position of the data dictionary header within the page.



19
20
21
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 19

def pos_data_dictionary_header
  pos_page_body
end

#size_data_dictionary_headerObject

The size of the data dictionary header.



24
25
26
# File 'lib/innodb/page/sys_data_dictionary_header.rb', line 24

def size_data_dictionary_header
  ((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)
end