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



Reply via email to