-
Notifications
You must be signed in to change notification settings - Fork 315
Home
- Quick start
- Basic tutorial
- Space File Structure
- Page Structure
- Index Structure
- Record Structure
- Record History
- Additional exploration
- Using the innodb_ruby library
To install as root:
sudo gem install innodb_ruby
To install as a user:
gem install --user-install innodb_ruby
To run:
innodb_space ...
Clone repository:
git clone https://github.com/jeremycole/innodb_ruby.git
cd innodb_ruby
To run:
ruby -r rubygems -I lib bin/innodb_space ...
Basics of using innodb_space
from the command line. There are two ways to start innodb_space
.
Against a single space file (ibdata or .ibd):
Option | Parameters | Description |
---|---|---|
-f | <filename> | Load the tablespace file (system or table) |
Against a system tablespace which will auto-load file-per-table tablespace files:
Option | Parameters | Description |
---|---|---|
-s | <filename> | Load the system tablespace file (e.g. ibdata1) |
-T | <table name> | Use the given table name. |
-I | <index name> | Use the given index name |
List all tablespaces available from the system, including some basic stats. This is basically a list of tables:
innodb_space -s ibdata1 system-spaces
List all indexes available from the space (system space or file-per-table space):
innodb_space -s ibdata1 -T sakila/film space-indexes
Iterate through all pages in a space and print a summary of page types coalesced into “regions” of same-type pages:
innodb_space -s ibdata1 -T sakila/film space-page-type-regions
Iterate through all pages and print a summary of total counts of pages by type:
innodb_space -s ibdata1 -T sakila/film space-page-type-summary
Illustrate all pages in all extents in the space, showing a colorized block (colored by index/purpose) for each page, sized based on the amount of data in the page:
innodb_space -s ibdata1 -T sakila/film space-extents-illustrate
Illustrate all pages in all extents in the space, showing a colorized block (colored by the age of the modification LSN for the page):
innodb_space -s ibdata1 -T sakila/payment space-lsn-age-illustrate
Given any page number, explain what the page is used for (for most structures):
innodb_space -s ibdata1 -T sakila/film -p 3 page-account
Intelligently dump the contents of a page including a representation of most structures that innodb_ruby understands:
innodb_space -s ibdata1 -T sakila/film -p 3 page-dump
Summarize all records within the page:
innodb_space -s ibdata1 -T sakila/film -p 3 page-records
Dump the contents of the page directory for a page
innodb_space -s ibdata1 -T sakila/film -p 7 page-directory-summary
Illustrate the content of a page:
innodb_space -s ibdata1 -T sakila/film -p 7 page-illustrate
Recurse an index (perform a full index scan) by following the entire B+Tree (scanning all pages by recursion, not just the leaf pages by list):
innodb_space -s ibdata1 -T sakila/film -I PRIMARY index-recurse
Recurse an index as index-recurse does, but print the offset of each record within the index pages:
innodb_space -s ibdata1 -T sakila/film -I PRIMARY index-record-offsets
Print a summary of all index pages at a given level:
innodb_space -s ibdata1 -T sakila/film -I PRIMARY -l 0 index-level-summary
Given a record offset, dump a detailed description of a record and the data it contains:
innodb_space -s ibdata1 -T sakila/film -p 7 -R 128 record-dump
Summarize the history (undo logs) of a record:
innodb_space -s ibdata1 -T sakila/film -p 7 -R 128 record-history
Show a summary of the lists (free, free_frag, full_frag, free_inodes, and full_inodes) for the space, including the list length and the list node information of the first and last pages in the list:
innodb_space -s ibdata1 space-lists
Iterate through all extents in a list and show the extents or inodes in the list:
innodb_space -s ibdata1 space-list-iterate -L free_frag
Print summary information for each inode in the space:
innodb_space -s ibdata1 space-inodes-summary
Print a summary of all records in the history list (undo logs):
innodb_space -s ibdata1 undo-history-summary
Print a detailed description of an undo record and the data it contains:
innodb_space -s ibdata1 -p page -R offset undo-record-dump
$ irb -r innodb
> sys = Innodb::System.new("ibdata1")
> idx = sys.index_by_name("sakila/film", "PRIMARY")
> rec = idx.binary_search([1])