pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles
3+ messages / 1 participants
[nested] [flat]

* AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles
@ 2022-03-04 07:09 ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
  1 sibling, 0 replies; 3+ messages in thread

From: Lorenz, Christopher @ 2022-03-04 07:09 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Hello,

was anyone able to reproduce and confirm this bug? I don't found any response.

Christopher Lorenz



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles
@ 2022-03-30 11:49 ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
  2022-04-04 07:00   ` AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
  1 sibling, 1 reply; 3+ messages in thread

From: Lorenz, Christopher @ 2022-03-30 11:49 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Hello,

I created a script which do the complete procedure of create database backup and reproduce the bug while recovery. 
I created this used by rpm from official postgresql yum repo. I used a RedHat 7 OS. I also add the output of the script.
You need to set your path to binary in the script: Line 9 pg_bin, as described before I also can reproduce this behavior in Versions 12 to 14

The line with the wrong stop in bug report seams to be a copy&paste error and was done correctly.

The WAL recovery is done by recovery_command which restores all previous saved files. In the log you can see that the WAL files are used for recovery:
2022-03-29 10:30:19.686 CEST [15169] LOG:  restored log file "000000010000000000000003" from archive
2022-03-29 10:30:19.727 CEST [15169] LOG:  recovery stopping before commit of transaction 486, time 2022-03-29 10:30:08.739965+02
2022-03-29 10:30:19.727 CEST [15169] LOG:  pausing at the end of recovery

Regards,

Christopher Lorenz


-----Ursprüngliche Nachricht-----
Von: Julien Rouhaud <rjuju123@gmail.com> 
Gesendet: Sonntag, 6. März 2022 08:42
An: Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>; pgsql-bugs@lists.postgresql.org
Betreff: Re: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles

...

I can't reproduce the problem. Now, given what you seem to be using, this is
likely an operator error:

...

> pg_ctl -D $PGDATAstop

this won't stop the instance.  If that's what you're really doing it's clearly
going to be broken.
...

no WAL recovery?

I recommend reading
https://www.postgresql.org/docs/current/continuous-archiving.html to see what
are the correct steps to restore a PITR backup, and if you still have a problem
please show a script that is self contained (ie. provide all parameter
initialization), safe, and actually works.

Attachments:

  base_recovery.log (application/octet-stream, 8.4K) download

  base_recovery.sh (application/octet-stream, 3.7K) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles
  2022-03-30 11:49 ` AW: BUG #17393: Delete database after recovery with point-in-time is still missing datafiles Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
@ 2022-04-04 07:00   ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Lorenz, Christopher @ 2022-04-04 07:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Hi,

Thanks for your explanation. I makes sense cause the DML command DROP isn't transactional so it don't have a COMMIT which can be rolled back. I also can get an valid restore if I set an recovery_target_name before. In most cases I don't have the txid or a named recovery point, cause the DROP was done accidentally. 

I've don't test it, but to get a restore as I need:
- Run a recovery to get the txid and exactly time of the DROP, so I also have the last wal I've have to start looking
- find out the last txid of a COMMIT before current stopping point of recovery using pg_waldump, decreasing the txid by 1 isn't sure cause the txids are maybe unordered
- Run the recover a second time with supplied txid to stop after the transaction before the DROP (recovery_target_xid)

> This is not a bug, rather a limitation of recovery_target_time.

I know this is not "real" a bug, it should be in the documentation (I don't found this anywhere in context of recovery). Or better I should be printed out in log of the recovery if it happened. This case of recovery produce an postgresql cluster with database (which is show in list of databases) without datafiles. It recovered a corrupt database which isn't fine. After it happened for me I spend time to find the reason of the faulty recovery.

If postgresql is doing an empty commit before DML commands it should also work.

Regards

Christopher Lorenz





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-04-04 07:00 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 07:09 ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
2022-03-30 11:49 ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>
2022-04-04 07:00   ` Lorenz, Christopher <Christopher.Lorenz@ZIT-BB.Brandenburg.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox