Re: "missing chunk number 0 for toast value xxx in pg_toast_xxx" when pg_basebackup - Mailing list pgsql-general

From Laurenz Albe
Subject Re: "missing chunk number 0 for toast value xxx in pg_toast_xxx" when pg_basebackup
Date
Msg-id 61b4ae27860092f78bde74c38db524f51cbcf527.camel@cybertec.at
Whole thread Raw
In response to Re: "missing chunk number 0 for toast value xxx in pg_toast_xxx" when pg_basebackup  (MaXinjian <machine_ok@163.com>)
List pgsql-general
On Tue, 2021-04-13 at 06:36 -0700, MaXinjian wrote:
> > Why do you write the WAL to /tmp/pg_wal, only to later mount that at the
> > default location?
>
> pg_wal dir has size limitation, if wal files are too large, they will be
> overwrited, right?

No, they won't.
You could run out of space on the file system though.

> > I see nothing wrong with what you are doing, but I may have got lost in
> > your complicated procedure.
> > You don't happen to remove "backup_label", do you?
>
> em, I do remove backup_label...

Then that's your problem.
That will corrupt your data, because recovery starts from the wrong
checkpoint.

> 1. It means recovery.conf is not necessary, backup_label is necessary?

Yes, exactly.

> 2. Which key in backup_label is necessary?

The whole file needs to be preserved unchanged, just as it is.
Don't mess with that file.

> 3. I searched the log, it do has recoveried.
> Then, if there is no backup_label, what's the default START WAL LOCATION and
> CHECKPOINT LOCATION?

That's the catch.

"backup_label" is the *only way* to tell a backup from a crashed
PostgreSQL cluster.

If there is no "backup_label", PostgreSQL will get the latest checkpoint
from the control file (global/pg_control), which may well be later than
the checkpoint that started the backup, so you will miss to recover some
transactions.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: "missing chunk number 0 for toast value xxx in pg_toast_xxx" when pg_basebackup
Next
From: "LE MENTEC, SANDRINE"
Date:
Subject: RE: looking for a installation package to Using GSSAPI with Postgres12 for windows