When PostgreSQL initiates recovery, the recovery to the timeline is determined

Source: Internet
Author: User
Tags postgresql strcmp

1. When you start recovery, determine the time line that you restored to Recoverytargettli

1) Archive recovery point is larger than the time line recorded in Checkpoint, then select Archive recovery point as target timeline

2) Otherwise, the time line in the checkpoint record as the target timeline

Startupxlog->if (Controlfile->minrecoverypointtli >controlfile->checkpointcopy.thistimelineid) Recoverytargettli = Controlfile->minrecoverypointtli;elserecoverytargettli = controlfile-> Checkpointcopy.thistimelineid, .....

2. Then read from the recovery.conf file

1) If the Recovery_target_timeline value is set and is set to latest, then the maximum timeline for the history list is the target time line

2) Otherwise, the time line value set in the Recovery.conf file

3) If the Recovery_target_timeline value is not set, the target timeline is the value in the first step

Startupxlog->readrecoverycommandfile ()->for (item = head; item; item = Item->next) {if (strcmp (Item->name, " Restore_command ") = = 0) {...} else If ... else if (strcmp (Item->name, "recovery_target_timeline") = = 0) {Rtligiven = True;if (strcmp (Item->value, " Latest ") = = 0) Rtli = 0;elsertli = (Timelineid) strtoul (item->value, NULL, 0);} else If ...} if (Rtligiven) {if (Rtli) {Recoverytargettli = Rtli;recoverytargetislatest = false;} else{/* We start the "latest" search from Pg_control ' s timeline */recoverytargettli = Findnewesttimeline (recoverytargettl I); recoverytargetislatest = True;}}


When PostgreSQL initiates recovery, the recovery to the timeline is determined

Related Article

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.