Class: Innodb::Page::IndexCompressed

Inherits:
Index show all
Defined in:
lib/innodb/page/index_compressed.rb

Constant Summary

Constants inherited from Index

Innodb::Page::Index::PAGE_DIRECTION, Innodb::Page::Index::PAGE_DIR_SLOT_MAX_N_OWNED, Innodb::Page::Index::PAGE_DIR_SLOT_MIN_N_OWNED, Innodb::Page::Index::PAGE_DIR_SLOT_SIZE, Innodb::Page::Index::RECORD_COMPACT_BITS_SIZE, Innodb::Page::Index::RECORD_MAX_N_FIELDS, Innodb::Page::Index::RECORD_MAX_N_SYSTEM_FIELDS, Innodb::Page::Index::RECORD_MAX_N_USER_FIELDS, Innodb::Page::Index::RECORD_NEXT_SIZE, Innodb::Page::Index::RECORD_REDUNDANT_BITS_SIZE, Innodb::Page::Index::RECORD_REDUNDANT_OFF1_NULL_MASK, Innodb::Page::Index::RECORD_REDUNDANT_OFF1_OFFSET_MASK, Innodb::Page::Index::RECORD_REDUNDANT_OFF2_EXTERN_MASK, Innodb::Page::Index::RECORD_REDUNDANT_OFF2_NULL_MASK, Innodb::Page::Index::RECORD_REDUNDANT_OFF2_OFFSET_MASK, Innodb::Page::Index::RECORD_TYPES

Constants inherited from Innodb::Page

PAGE_TYPE, PAGE_TYPE_BY_VALUE, UNDEFINED_PAGE_NUMBER

Instance Attribute Summary

Attributes inherited from Index

#record_describer

Attributes inherited from Innodb::Page

#space

Instance Method Summary collapse

Methods inherited from Index

#binary_search_by_directory, #directory_slot_for_record, #directory_space, #dump, #each_child_page, #each_directory_offset, #each_directory_record, #each_garbage_record, #each_record, #each_region, #fseg_header, #header_space, #ibuf_index?, #infimum, #leaf?, #linear_search_from_cursor, #make_record_describer, #make_record_description, #max_record, #min_record, #offset_directory_slot, #page_header, #pos_directory, #pos_fseg_header, #pos_index_header, #pos_infimum, #pos_records, #pos_supremum, #pos_user_records, #record, #record_cursor, #record_directory_slot, #record_fields, #record_format, #record_header, #record_header_compact_additional, #record_header_compact_null_bitmap, #record_header_compact_variable_lengths_and_externs, #record_header_redundant_additional, #record_header_redundant_field_end_offsets, #record_if_exists, #record_space, #root?, #size_fseg_header, #size_index_header, #size_mum_record, #size_mum_record_header_additional, #size_record_header, #space_per_record, #supremum, #system_record, #trailer_space, #used_space

Methods inherited from Innodb::Page

#checksum_crc32, #checksum_crc32?, #checksum_innodb, #checksum_innodb?, #checksum_invalid?, #checksum_type, #checksum_valid?, #corrupt?, #cursor, #default_page_size?, #dump, #each_page_body_byte_as_uint8, #each_page_header_byte_as_uint8, #each_region, #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

#directoryObject



17
18
19
# File 'lib/innodb/page/index_compressed.rb', line 17

def directory
  super.map { |n| n & 0x3fff }
end

#directory_slotsObject

The number of directory slots in use.



13
14
15
# File 'lib/innodb/page/index_compressed.rb', line 13

def directory_slots
  page_header[:n_heap] - 2
end

#free_spaceObject

Return the amount of free space in the page.



34
35
36
37
38
39
40
41
42
43
# File 'lib/innodb/page/index_compressed.rb', line 34

def free_space
  free_space_start =
    size - size_fil_trailer - directory_space - (uncompressed_columns_size * (page_header.n_heap - 2))
  puts "Free space start == %04x" % [(offset * size) + free_space_start]
  c = cursor(free_space_start).backward
  zero_bytes = 0
  zero_bytes += 1 while c.read_uint8.zero?
  zero_bytes
  # page_header[:garbage] + (size - size_fil_trailer - directory_space - page_header[:heap_top])
end

#uncompressed_columns_sizeObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/innodb/page/index_compressed.rb', line 21

def uncompressed_columns_size
  if leaf?
    if record_format && record_format[:type] == :clustered
      6 + 7 # Transaction ID + Roll Pointer
    else
      0
    end
  else
    4 # Node pointer for non-leaf pages
  end
end