public inbox for [email protected]
help / color / mirror / Atom feedRe: Postgres restore sometimes restores to a point 2 days in the past
2+ messages / 2 participants
[nested] [flat]
* Re: Postgres restore sometimes restores to a point 2 days in the past
@ 2025-01-31 21:26 Adrian Klaver <[email protected]>
2025-01-31 21:52 ` Re: Postgres restore sometimes restores to a point 2 days in the past Koen De Groote <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Klaver @ 2025-01-31 21:26 UTC (permalink / raw)
To: Koen De Groote <[email protected]>; +Cc: PostgreSQL General <[email protected]>
On 1/31/25 12:10, Koen De Groote wrote:
> > What is the complete pg_basebackup command?
> 2/ All my WAL files are archived and uploaded to the cloud. So, I can
> just have them downloaded.
I should have asked earlier what is the archive command?
Are
> > What is determining that a particular WAL file should be asked for?
>
> The postgres server itself does this. Here's the documentation:
> https://www.postgresql.org/docs/16/runtime-config-wal.html#GUC-RESTORE-COMMAND <https://www.postgresql.org/docs/16/runtime-config-wal.html#GUC-RESTORE-COMMAND;
>
> And here: https://www.postgresql.org/docs/current/warm-standby.html
> <https://www.postgresql.org/docs/current/warm-standby.html;
>
> In practice, Postgres will see the "standby.signal" file and start
In your OP you say:
"It downloads the basebackup, unpacks it, sets a recovery.signal, ..."
Are you setting standby.signal or recovery.signal or both?
> asking for WAL files. It will read the database it has and determine
> what the next WAL filename should be. And then it asks for it. And it
> will keep asking for these hexadecimal filenames, 1 at a time, for as
> long as the command or set of commands provided to "restore_command"
> returns exit code 0. If the process receives any other exit code, it
> stops recovery, switches timeline, and considers the database to be up
> and running at the state its in.
>
> It's constantly asking "I want this file now" and the script I have as
> the restore command will attempt to download it from the cloud. Then it
> will attempt to unzip it and move it into place. If any of these steps
> fails, I return exit code 1.
>
> Regards,
> Koen De Groote
>
>
--
Adrian Klaver
[email protected]
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Postgres restore sometimes restores to a point 2 days in the past
2025-01-31 21:26 Re: Postgres restore sometimes restores to a point 2 days in the past Adrian Klaver <[email protected]>
@ 2025-01-31 21:52 ` Koen De Groote <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Koen De Groote @ 2025-01-31 21:52 UTC (permalink / raw)
To: Adrian Klaver <[email protected]>; +Cc: PostgreSQL General <[email protected]>
> I should have asked earlier what is the archive command
The example from the documentation, but with GZIP. So from the
documentation:
https://www.postgresql.org/docs/16/continuous-archiving.html#BACKUP-ARCHIVING-WAL
Which becomes this: archive_command = 'test ! -f
/mnt/server/archivedir/%f.gz && gzip -c %p /mnt/server/archivedir/%f.gz'
> Are you setting standby.signal or recovery.signal or both
Sorry, I keep confusing them. I checked my deployment code, it's
recovery.signal and only that.
Regards,
Koen De Groote
On Fri, Jan 31, 2025 at 10:26 PM Adrian Klaver <[email protected]>
wrote:
> On 1/31/25 12:10, Koen De Groote wrote:
> > > What is the complete pg_basebackup command?
>
> > 2/ All my WAL files are archived and uploaded to the cloud. So, I can
> > just have them downloaded.
>
> I should have asked earlier what is the archive command?
>
> Are
> > > What is determining that a particular WAL file should be asked for?
> >
> > The postgres server itself does this. Here's the documentation:
> >
> https://www.postgresql.org/docs/16/runtime-config-wal.html#GUC-RESTORE-COMMAND
> <
> https://www.postgresql.org/docs/16/runtime-config-wal.html#GUC-RESTORE-COMMAND
> >
> >
> > And here: https://www.postgresql.org/docs/current/warm-standby.html
> > <https://www.postgresql.org/docs/current/warm-standby.html;
> >
> > In practice, Postgres will see the "standby.signal" file and start
>
> In your OP you say:
>
> "It downloads the basebackup, unpacks it, sets a recovery.signal, ..."
>
> Are you setting standby.signal or recovery.signal or both?
>
>
> > asking for WAL files. It will read the database it has and determine
> > what the next WAL filename should be. And then it asks for it. And it
> > will keep asking for these hexadecimal filenames, 1 at a time, for as
> > long as the command or set of commands provided to "restore_command"
> > returns exit code 0. If the process receives any other exit code, it
> > stops recovery, switches timeline, and considers the database to be up
> > and running at the state its in.
> >
> > It's constantly asking "I want this file now" and the script I have as
> > the restore command will attempt to download it from the cloud. Then it
> > will attempt to unzip it and move it into place. If any of these steps
> > fails, I return exit code 1.
> >
>
> > Regards,
> > Koen De Groote
> >
> >
>
>
> --
> Adrian Klaver
> [email protected]
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-01-31 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-31 21:26 Re: Postgres restore sometimes restores to a point 2 days in the past Adrian Klaver <[email protected]>
2025-01-31 21:52 ` Koen De Groote <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox