| Class | Innodb::Page::Index |
| In: |
lib/innodb/page/index.rb
|
| Parent: | Innodb::Page |
A specialized class for handling INDEX pages, which contain a portion of the data from exactly one B+tree. These are typically the most common type of page in any database.
The basic structure of an INDEX page is: FIL header, INDEX header, FSEG header, fixed-width system records (infimum and supremum), user records (the actual data) which grow ascending by offset, free space, the page directory which grows descending by offset, and the FIL trailer.
| RECORD_NEXT_SIZE | = | 2 | The size (in bytes) of the "next" pointer in each record header. | |
| RECORD_REDUNDANT_BITS_SIZE | = | 4 | The size (in bytes) of the bit-packed fields in each record header for "redundant" record format. | |
| RECORD_REDUNDANT_OFF1_OFFSET_MASK | = | 0x7f | Masks for 1-byte record end-offsets within "redundant" records. | |
| RECORD_REDUNDANT_OFF1_NULL_MASK | = | 0x80 | ||
| RECORD_REDUNDANT_OFF2_OFFSET_MASK | = | 0x3fff | Masks for 2-byte record end-offsets within "redundant" records. | |
| RECORD_REDUNDANT_OFF2_NULL_MASK | = | 0x8000 | ||
| RECORD_REDUNDANT_OFF2_EXTERN_MASK | = | 0x4000 | ||
| RECORD_COMPACT_BITS_SIZE | = | 3 | The size (in bytes) of the bit-packed fields in each record header for "compact" record format. | |
| RECORD_MAX_N_SYSTEM_FIELDS | = | 3 | Maximum number of fields. | |
| RECORD_MAX_N_FIELDS | = | 1024 - 1 | ||
| RECORD_MAX_N_USER_FIELDS | = | RECORD_MAX_N_FIELDS - RECORD_MAX_N_SYSTEM_FIELDS * 2 | ||
| PAGE_DIRECTION | = | { 1 => :left, # Inserts have been in descending order. 2 => :right, # Inserts have been in ascending order. 3 => :same_rec, # Unused by InnoDB. 4 => :same_page, # Unused by InnoDB. 5 => :no_direction, # Inserts have been in random order. } | Page direction values possible in the page_header‘s :direction field. | |
| RECORD_TYPES | = | { 0 => :conventional, # A normal user record in a leaf page. 1 => :node_pointer, # A node pointer in a non-leaf page. 2 => :infimum, # The system "infimum" record. 3 => :supremum, # The system "supremum" record. } | Record types used in the :type field of the record header. | |
| RECORD_INFO_MIN_REC_FLAG | = | 1 | This record is the minimum record at this level of the B-tree. | |
| RECORD_INFO_DELETED_FLAG | = | 2 | This record has been marked as deleted. | |
| PAGE_DIR_SLOT_SIZE | = | 2 | The size (in bytes) of the record pointers in each page directory slot. | |
| PAGE_DIR_SLOT_MIN_N_OWNED | = | 4 | The minimum number of records "owned" by each record with an entry in the page directory. | |
| PAGE_DIR_SLOT_MAX_N_OWNED | = | 8 | The maximum number of records "owned" by each record with an entry in the page directory. |
Search or a record within a single page using the page directory to limit the number of record comparisons required. Once the last page directory entry closest to but not greater than the key is found, fall back to linear search using linear_search_from_cursor to find the closest record whose key is not greater than the desired key. (If an exact match is desired, the returned record must be checked in the same way as the above linear_search_from_cursor function.)
Search for a record within a single page, and return either a perfect match for the key, or the last record closest to they key but not greater than the key. (If an exact match is desired, compare_key must be used to check if the returned record matches. This makes the function useful for search in both leaf and non-leaf pages.)
The position of the page directory, which starts at the "fil" trailer and grows backwards from there.
Return the byte offset of the start of the "fseg" header, which immediately follows the "index" header.
Return the byte offset of the start of the "index" page header, which immediately follows the "fil" header.
Return the byte offset of the start of records within the page (the position immediately after the page header).
Return the actual bytes of the portion of the page which is used to store user records (eliminate the headers and trailer from the page).
Read additional header information from a compact format record header.
Return an array containing an array of the length of each variable-length field and an array indicating which fields are stored externally.
Read additional header information from a redundant format record header.