A summary analysis for checkpoint

Source: Internet
Author: User
Tags commit

Checkpoint Overview

What is checkpoint

In the database system, writes the log and writes the data file is the database IO consumes the biggest two kinds of operations, in these two kinds of operations writes the data file to be scattered writes, writes the log file is the sequential writing, therefore in order to guarantee the database performance, usually the database is guarantees in submits (commits) Before you finish, make sure that the log is written to the log file, and that the dirty data blocks are stored in the data cache (buffer cache) and are not periodically written to the data file in batches. This means that the log write and commit operations are synchronized, and the data write and commit operations are not synchronized. So there is a problem, when a database crashes do not guarantee that the dirty data in the cache are all written to the data file, so that when the instance is started, use log files for recovery operations, restore the database to the state before the crash to ensure data consistency. Checkpoints are an important mechanism in this process to determine which redo logs should be scanned and applied to recovery.

Generally speaking, the checkpoint is a database event, the checkpoint event is emitted by the checkpoint process (Lgwr/ckpt process), and checkpoint writes the dirty block to disk when the Dbwn event occurs, The file headers of the data files and control files are also updated to record checkpoint information.

The role of Checkpoint

Checkpoint Main 2 functions:

Ensure the consistency of the database, which is to write dirty data to the hard disk, to ensure that the data on the memory and hard disk is the same;

Shorten the time of instance recovery, the instance restores the dirty data not written to the hard disk before the instance is turned off unexpectedly to recover by log. If the dirty block is too large, the instance can be recovered for a long time, and the checkpoint will reduce the number of dirty blocks, thus increasing the time of instance recovery.

The popular saying checkpoint is like word's automatic save.

Checkpoint classification

Full checkpoint (Normal checkpoint)

Incremental checkpoint (incremental checkpoint)

Checkpoint related conceptual terminology

Before we explain how checkpoint works, let's look at some relevant terminology.

RBA (Redo Byte address), Low RBA (Lrba), High RBA (Hrba)

RBA is the address of the redo log block (redo log blocks), which is equivalent to the ROWID in the data file to locate the Redo log block through this address. The RBA consists of three parts:

Log file sequence number (4 bytes)

Log File block number (4 bytes)

The starting offset byte (2 bytes) of the redo log record in the log block

Commonly used in the form of RBA are:

Lrba

Data cache (buffer cache) when a dirty block is updated for the first time, the redo log record in the Redo log file corresponds to the location called Lrba.

Hrba

Data cache (buffer cache) when a dirty block is recently updated the Redo log record in the Redo log file corresponds to the location called Hrba.

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.