| Class | Innodb::Page |
| In: |
lib/innodb/page.rb
|
| Parent: | Object |
A generic class for any type of page, which handles reading the common FIL header and trailer, and can handle (via parse) dispatching to a more specialized class depending on page type (which comes from the FIL header). A page being handled by Innodb::Page indicates that its type is not currently handled by any more specialized class.
| SPECIALIZED_CLASSES | = | {} | A hash of page types to specialized classes to handle them. Normally subclasses will register themselves in this list. | |
| PAGE_TYPE | = | { :ALLOCATED => { :value => 0, :description => "Freshly allocated", :usage => "page type field has not been initialized", }, :UNDO_LOG => { :value => 2, :description => "Undo log", :usage => "stores previous values of modified records", }, :INODE => { :value => 3, :description => "File segment inode", :usage => "bookkeeping for file segments", }, :IBUF_FREE_LIST => { :value => 4, :description => "Insert buffer free list", :usage => "bookkeeping for insert buffer free space management", }, :IBUF_BITMAP => { :value => 5, :description => "Insert buffer bitmap", :usage => "bookkeeping for insert buffer writes to be merged", }, :SYS => { :value => 6, :description => "System internal", :usage => "used for various purposes in the system tablespace", }, :TRX_SYS => { :value => 7, :description => "Transaction system header", :usage => "bookkeeping for the transaction system in system tablespace", }, :FSP_HDR => { :value => 8, :description => "File space header", :usage => "header page (page 0) for each tablespace file", }, :XDES => { :value => 9, :description => "Extent descriptor", :usage => "header page for subsequent blocks of 16,384 pages", }, :BLOB => { :value => 10, :description => "Uncompressed BLOB", :usage => "externally-stored uncompressed BLOB column data", }, :ZBLOB => { :value => 11, :description => "First compressed BLOB", :usage => "externally-stored compressed BLOB column data, first page", }, :ZBLOB2 => { :value => 12, :description => "Subsequent compressed BLOB", :usage => "externally-stored compressed BLOB column data, subsequent page", }, :INDEX => { :value => 17855, :description => "B+Tree index", :usage => "table and index data stored in B+Tree structure", }, } | InnoDB Page Type constants from include/fil0fil.h. | |
| PAGE_TYPE_BY_VALUE | = | PAGE_TYPE.inject({}) { |h, (k, v)| h[v[:value]] = k; |
| space | [R] |
Allow the specialized class to do something that isn‘t ‘new’ with this page.
A helper to convert "undefined" values stored in previous and next pointers in the page header to nil.
Load a page as a generic page in order to make the "fil" header accessible, and then attempt to hand off the page to a specialized class to be re-parsed if possible. If there is no specialized class for this type of page, return the generic object.
This could be optimized to reach into the page buffer and efficiently extract the page type in order to avoid throwing away a generic Innodb::Page object when parsing every specialized page, but this is a bit cleaner, and we‘re not particularly performance sensitive.
A helper function to return the checksum from the "fil" trailer, for easier access.
If no block is passed, return an BufferCursor object positioned at a specific offset. If a block is passed, create a cursor at the provided offset and yield it to the provided block one time, and then return the return value of the block.
Implement a custom inspect method to avoid irb printing the contents of the page buffer, since it‘s very large and mostly not interesting.
A helper function to return the low 32 bits of the LSN from the page header for use in comparing to the low 32 bits stored in the trailer.
A helper function to return the low 32 bits of the LSN as stored in the page trailer.
Is the page number stored in the header different from the page number which was supposed to be read?
Is the space ID stored in the header different from that of the space provided when initializing this page?
Return a simple string to uniquely identify this page within the space. Be careful not to call anything which would instantiate a BufferCursor so that we can use this method in cursor initialization.
A helper function to return the page number of the logical next page (from the doubly-linked list from page to page) from the "fil" header, for easier access.
Return the byte offset of the start of the "fil" header, which is at the beginning of the page. Included here primarily for completeness.
Return the byte offset of the start of the "fil" trailer, which is at the end of the page.
A helper function to return the page number of the logical previous page (from the doubly-linked list from page to page) from the "fil" header, for easier access.