Class: Innodb::Page::Index::Compressed

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

Constant Summary

Constants inherited from Innodb::Page::Index

PAGE_DIRECTION, PAGE_DIR_SLOT_MAX_N_OWNED, PAGE_DIR_SLOT_MIN_N_OWNED, PAGE_DIR_SLOT_SIZE, RECORD_COMPACT_BITS_SIZE, RECORD_INFO_DELETED_FLAG, RECORD_INFO_MIN_REC_FLAG, RECORD_NEXT_SIZE, RECORD_REDUNDANT_BITS_SIZE, RECORD_REDUNDANT_OFF1_NULL_MASK, RECORD_REDUNDANT_OFF1_OFFSET_MASK, RECORD_REDUNDANT_OFF2_EXTERN_MASK, RECORD_REDUNDANT_OFF2_NULL_MASK, RECORD_REDUNDANT_OFF2_OFFSET_MASK, RECORD_TYPES

Constants inherited from Innodb::Page

PAGE_TYPE, PAGE_TYPE_BY_VALUE, SPECIALIZED_CLASSES

Instance Attribute Summary

Attributes inherited from Innodb::Page::Index

#record_describer

Attributes inherited from Innodb::Page

#space

Instance Method Summary collapse

Methods inherited from Innodb::Page::Index

#directory_space, #dump, #each_child_page, #each_garbage_record, #each_record, #first_record, #fseg_header, #garbage_offset, #header_space, #infimum, #level, #make_record_description, #page_header, #pos_directory, #pos_fseg_header, #pos_index_header, #pos_infimum, #pos_records, #pos_supremum, #pos_user_records, #record, #record_bytes, #record_cursor, #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_space, #records, #root?, #size_fseg_header, #size_index_header, #size_mum_record, #size_mum_record_header_additional, #size_record_header, #supremum, #system_record, #trailer_space, #used_space

Methods inherited from Innodb::Page

#calculate_checksum, #checksum, #corrupt?, #cursor, #data, #dump, #fil_header, handle, #initialize, #inspect, #lsn, maybe_undefined, #next, #offset, parse, #pos_fil_header, #pos_fil_trailer, #pos_page_body, #prev, #size, #size_fil_header, #size_fil_trailer, #type

Constructor Details

This class inherits a constructor from Innodb::Page

Instance Method Details

#directoryObject



9
10
11
# File 'lib/innodb/page/index_compressed.rb', line 9

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

#directory_slotsObject

The number of directory slots in use.



5
6
7
# File 'lib/innodb/page/index_compressed.rb', line 5

def directory_slots
  page_header[:n_heap] - 2
end

#free_spaceObject

Return the amount of free space in the page.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/innodb/page/index_compressed.rb', line 26

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
  while (b = c.get_uint8) == 0
    zero_bytes += 1
  end
  zero_bytes
  #page_header[:garbage] +
  #  (size - size_fil_trailer - directory_space - page_header[:heap_top])
end

#uncompressed_columns_sizeObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/innodb/page/index_compressed.rb', line 13

def uncompressed_columns_size
  if level == 0
    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