Re: Why do we have checkPointCopy in ControlFileData?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jialun Zhang <reatank(at)gmail(dot)com>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Why do we have checkPointCopy in ControlFileData?
Date: 2020-07-03 19:55:29
Message-ID: 1047047.1593806129@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Jialun Zhang <reatank(at)gmail(dot)com> writes:
> I am reading the code about checkpoint, I think ControlFileData::checkPoint
> in pg_control.h is the last checkpoint, so why is there also a checkPointCopy?
> What is its role?

IIRC, checkPointCopy is the info about the preceding checkpoint.

I think the reason for it being there is an idea that if the latest
checkpoint record is corrupt, we could go back to the prior one and
replay forward from there. I don't believe any such recovery method was
ever implemented (and it's fair to wonder if you'd have a consistent
database afterwards, anyway) but no one has bothered to remove the
field.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jialun Zhang 2020-07-04 16:19:15 What's the best practice to compare the transaction with the checkpoint?
Previous Message Jialun Zhang 2020-07-03 19:12:08 Why do we have checkPointCopy in ControlFileData?