PITR and instance without any activity

2022-12-12 Thread Adrien Nayrat

Hello,

I came across a weird problem about PITR with a recovery_target_time and 
a cluster without any activity. The issue is quite simple, we just try 
to do a PITR by specifying a recovery_target_time after the backup.


The main issue, is that there is no timestamp in the wal as there is no 
activity. Postgres fetches the record timestamp thanks to 
getRecordTimestamp:


/* 

 * Extract timestamp from WAL record. 

 * 

 * If the record contains a timestamp, returns true, and saves the 
timestamp
 * in *recordXtime. If the record type has no timestamp, returns false. 

 * Currently, only transaction commit/abort records and restore points 
contain
 * timestamps. 

 */ 



So, Postgres tries to replay all the wal until the end, and we got this 
message:

FATAL:  recovery ended before configured recovery target was reached

Before 13, promotion was done without any error:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=dc788668bb269b10a108e87d14fefd1b9301b793

I wonder if we may add a timestamp for other wal records? Maybe when we 
switch xlog?


I may have spotted a bug, I tried to create restore point. I expected 
Postgres will get its timestamp as comment in getRecordTimestamp.
But Postgres did not find any timestamp and keep replaying the wal even 
after the restore point.


FYI, It seems I am not alone with this issue:
https://github.com/pgbackrest/pgbackrest/issues/1934
https://github.com/pgbackrest/pgbackrest/issues/1526#issuecomment-937759691

Thanks

--
Adrien NAYRAT





names of the WAL files

2022-12-12 Thread Matthias Apitz


Hello,

Is there some interpretation of the names of the WAL files available?

Thanks

matthias


-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub




Re: names of the WAL files

2022-12-12 Thread Reid Thompson
On Mon, 2022-12-12 at 18:16 +0100, Matthias Apitz wrote:
> 
> Hello,
> 
> Is there some interpretation of the names of the WAL files available?
> 
> Thanks
> 
>     matthias

Hi,
http://eulerto.blogspot.com/2011/11/understanding-wal-nomenclature.html
seems to break it down.