MySQL kernel InnoDB Storage engine (Volume 1) notes, mysqlinnodb
MySQL kernel InnoDB Storage engine (Volume 1) Directory
- 1 Overview
- 2. Basic data structures and algorithms
- 3. Synchronization Mechanism
- 4. Redo logs
- 5mini-transaction (mtr)
- 6. Storage Management
- 7 records
- 8 index pages
- 9 lock
- 10B + Tree Index
- 11 Insert Buffer
- 12 Buffer Pool
- 13. Transaction Processing
- 14. Data Dictionary
- 15. Service Management
Overview of basic data structures and algorithm synchronization mechanisms
If 1000 cells in sync_primary_wait_array are allocated, ut_error triggers crash.Redo log
LSN (indicates the number of bytes that the transaction writes to the redo log ?)
Checkpoint: refresh the pages in the buffer pool to the disk.
The redo log size is fixed (3 GB)-> archive log
Ib_logfile <N>
Redo log block (512B-12-8)
Redo log Group *
Group Submission: fsync-> log_flush_up_to copies the last log block.
Restore: recovery_from_checkpoint_startMini-transaction (mtr)
Force-Log-at-Commit
Mtr_t mtr; mtr_start (& mtr);... mtr_commit (& mtr );
MLOG_MULTI_REC_ENDStorage Management
Segment (segment)
Tablespace
Data Structure: fil_system/space/node_struct
Four asynchronous I/O threads: asynchronous read, asynchronous write, insert cache, and redo logRecord
P103 VARCHAR type NULL does not occupy disk space, while char null is filled with 0x00
Large record: BLOB/TEXT (overflow page, extern attribute)
Logical record
Row record version (MVCC is only a column ?) : Using the hidden transaction ID column
The p114 function read_view_sees_trx_id is used to determine whether the current transaction can read the current version of the record. If not, row_sel_build_prev_vers_for_mysqlIndex page
Page Directory (locate the location of the record on the Page)
Page Cursor *Lock
Lock_rec_struct = {space, page_no, n_bits}
P144 LOCK_GAP (indicating that the range lock does not contain the endpoint)
Explicit and implicit locks ** (omitted)
Row lock maintenance * (emphasis, omitted)
Auto-increment lock (atomic ?)
Deadlock *B + Tree Index
DML operations
Primary Key Update
Persistent cursor btr_pcur_struct
Adaptive hash Index *Insert BufferBuffer Pool
Linear pre-read *
Logical pre-read
Page refreshTransaction Processing
Undo log implementation: rollback segment + undo segment
Undo records
Purge *
Rollback
CommitData Dictionary Service Management
MySQL storage engine does not have InnoDB
Use
Mysql> show engines;
Command to see if there is InnoDB
If you do not mind reinstalling
What are the differences between the three storage engines of Mysql databases?
This is a matter of consideration for performance, as well as transaction support. You will know about Baidu.
MyISAM, InnoDB, Heap (Memory), NDB
Generally, InnoDB is used,
Mysql storage engines include MyISAM, InnoDB, BDB, MEMORY, MERGE, EXAMPLE, NDBCluster, ARCHIVE, CSV, BLACKHOLE, and FEDERATED. InnoDB and BDB provide transaction security tables, other storage engines are non-transaction security tables.
The two most commonly used storage engines:
1. Myisam is the default storage engine of Mysql. When create creates a new table without specifying the storage engine for the new table, Myisam is used by default. Each MyISAM is stored as three files on the disk. The file names are the same as the table names. The extensions are. frm (storage table definition),. MYD (MYData, storage data), and. MYI (MYIndex, storage index ). Data Files and index files can be placed in different directories, and I/O is evenly distributed for faster speed.
2. the InnoDB Storage engine provides transaction security with commit, rollback, and crash recovery capabilities. However, compared with the storage engine of Myisam, InnoDB writes less efficiently and occupies more disk space to retain data and indexes.
I don't know if it is helpful to you.