The checkpoint in Inondb

Source: Internet
Author: User

Checkpoint is mainly to solve the problem:

1. Shorten the recovery time of the database

2. When the buffer pool is not enough, flush the dirty pages to disk

3. Refresh dirty pages When redo logs are not available

The InnoDB engine uses the LSN (log sequence number) to mark the log version. LSN is a 8-byte number. Each page has LSN, redo log, LSN, checkpoint, and LSN.

There are two types of checkpoint inside the InnoDB storage engine:

1.sharp checkpoint

Occurs when the database shuts down. Flushes all dirty pages to disk. This is the default way, that is, innodb_fast_shutdown=1

Mysql> Show variables like ' innodb_fast_shutdown '; +----------------------+-------+| Variable_name        | Value |+----------------------+-------+| Innodb_fast_shutdown | 1     

2.fuzzy checkpoint
When the database is running, using sharp checkpoint can affect the availability of the database.
So at run time, use fuzzy checkpoint to refresh the page (only part of the dirty page is refreshed, not all dirty pages).


There are several cases of fuzzy checkpoint in InnoDB:
-master Thread Checkpoint:

(Almost every second or every 10 seconds) asynchronously refreshes a percentage of the page-to-disk from the list of dirty pages in the buffer pool

-flush_lru_list Checkpoint:

Remove the page from the end of the LRU list, InnoDB to ensure that there are enough free pages available in the LRU list. The number of available pages in the LRU list is controlled by the parameter Innodb_lru_depth in 5.6, which defaults to 1024

Mysql> Show variables like ' innodb_lru_scan_depth '; +-----------------------+-------+| Variable_name         | Value |+-----------------------+-------+| innodb_lru_scan_depth | 1024  

-async/sync Flush Checkpoint

When redo logs are not available, you need to force some pages to be flushed to disk.

-dirty page too much checkpoint

Too many dirty pages, forcing checkpoints to occur

Mysql> Show variables like ' innodb_max_dirty_pages_pct '; +----------------------------+-------+| Variable_name              | Value |+----------------------------+-------+| innodb_max_dirty_pages_pct | 75    

Forced refresh when dirty pages account for 75%.

The checkpoint in Inondb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.