Class Innodb::Space
In: lib/innodb/space.rb
Parent: Object

An InnoDB space file, which can be either a multi-table ibdataN file or a single-table "innodb_file_per_table" .ibd file.

Methods

Classes and Modules

Class Innodb::Space::DataFile

Constants

DEFAULT_PAGE_SIZE = 16384   InnoDB‘s default page size is 16KiB.
SYSTEM_SPACE_PAGE_MAP = { 0 => :FSP_HDR, 1 => :IBUF_BITMAP, 2 => :INODE, 3 => :SYS, 4 => :INDEX, 5 => :TRX_SYS, 6 => :SYS, 7 => :SYS, }   A map of InnoDB system space fixed-allocation pages. This can be used to check whether a space is a system space or not, as non-system spaces will not match this pattern.

Attributes

innodb_system  [RW]  The Innodb::System to which this space belongs, if any.
page_size  [R]  The size (in bytes) of each page in the space.
pages  [R]  The number of pages in the space.
record_describer  [RW]  An object which can be used to describe records found in pages within this space.
size  [R]  The size (in bytes) of the space
system_page_size  [R]  The system default page size (in bytes), equivalent to UNIV_PAGE_SIZE.

Public Class methods

Open a space file, optionally providing the page size to use. Pages that aren‘t 16 KiB may not be supported well.

Public Instance methods

Return true if a page is in the doublewrite buffer.

Iterate through the page numbers in the doublewrite buffer.

Iterate through all indexes in the space.

Iterate through all root page numbers for indexes in the space.

Iterate through Innodb::Inode objects in the space.

Iterate through all pages in a space, returning the page number and an Innodb::Page object for each one.

Iterate through all pages, yielding the page number, page object, and page status.

Iterate through unique regions in the space by page type. This is useful to achieve an overall view of the space.

Iterate through all extent descriptors for the space, returning an Innodb::Xdes object for each one.

Iterate through Innodb::Xdes lists in the space.

An array of all FSP/XDES page numbers for the space.

The size (in bytes) of an extent.

Get (and cache) the FSP header from the FSP_HDR page.

The FSP header flags, decoded. If the page size has not been initialized, reach into the raw bytes of the FSP_HDR page and attempt to decode the flags field that way.

The IBUF_BITMAP page which will contain the bitmap entry for a given page.

Get an Innodb::Index object for a specific index by root page number.

Get an Innodb::List object for a specific list by list name.

Return a string which can uniquely identify this space. Be careful not to do anything which could instantiate a BufferCursor so that we can use this method in cursor initialization.

Get an Innodb::Page object for a specific page by page number.

Get the raw byte buffer for a specific page by page number.

Return the page number for the space‘s FSP_HDR page.

Return the page number for the space‘s SYS data dictionary header.

Return the page number for the space‘s TRX_SYS page.

The number of pages per FSP_HDR/XDES/IBUF_BITMAP page. This is crudely mapped to the page size, and works for pages down to 1KiB.

The number of pages per extent.

Read the FSP header "flags" field by byte offset within the space file. This is useful in order to initialize the page size, as we can‘t properly read the FSP_HDR page before we know its size.

Get the raw byte buffer of size bytes at offset in the file.

Determine whether this space looks like a system space. If the initial pages in the space match the SYSTEM_SPACE_PAGE_MAP, it is likely to be a system space.

Get the Innodb::Page::TrxSys page for a system space.

A helper to produce a printable page type.

The XDES entry offset for a given page within its FSP_HDR/XDES page‘s XDES array.

Return the Innodb::Xdes entry which represents a given page.

An array of Innodb::Xdes list names.

The FSP_HDR/XDES page which will contain the XDES entry for a given page.

[Validate]