Re: What's the best practice to compare the transaction with the checkpoint?

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: What's the best practice to compare the transaction with the checkpoint?
Date: 2020-07-06 16:34:48
Message-ID: 1380011.1594053288@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:
> My question is that, consider such a situation (in the order of time):
> 1. toast create a file for a value V;
> 2. latest checkpoint;
> 3. use V (here the file is read);
> 4. delete the file when VACUUM deletes V;
> 5. crash, then when we recover from the latest checkpoint, the file will be
> accessed again but it has gone.

What is "use V", and why would it be part of what is replayed in step 5?
Replay generally doesn't do anything that could access potentially-deleted
data, because depending on whether or not the updated page from step 4 got
written out before crashing, there may or may not be any such tuple.

The replay of step 4 would need to perform something like "delete the file
for V if it exists, but don't complain if it does not", since we couldn't
be sure which state we'll find on-disk.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jialun Zhang 2020-07-06 21:50:17 Re: What's the best practice to compare the transaction with the checkpoint?
Previous Message Jialun Zhang 2020-07-06 16:23:31 Re: What's the best practice to compare the transaction with the checkpoint?