Обсуждение: PITR - Bug or feature?
Hello
Today we have got one PITR backup history file in one of our systems
with a format change.
The PITR backup history file named
pg_xlog/000000010000003800000000.00000020.backup included this information:
--------------------------------------------------------
START WAL LOCATION: 38/20 (file 000000010000003800000000)
STOP WAL LOCATION: 38/88 (file 000000010000003800000000)
CHECKPOINT LOCATION: 38/20
START TIME: 2010-02-01 07:20:05 CET
LABEL:
/usit/dbpg-research/pg_bck/PITR_data/PITRBASE-dbpg-research_v8.3.9_j10_2010-02-01_072001
STOP TIME: 2010-02-01 07:22:42 CET
--------------------------------------------------------
As you can see, the second number in START/STOP and CHECKPOINT LOCATION
has a length of 2. This second number usually has a length of 8.
I have checked the logs from our last 5000 PITR jobs and the format of
these values has always been "<some number>/<8 digits number>"
We have been using the "<some number>/<8 digits>" ID returned by the
pg_start_backup() function to find out the PITR backup history file we
have to wait for in the archive directory, before we can delete old WAL
files that are not needed anymore. This task gets more complicated if we
cannot trust to get a consistent format from pg_start_backup().
These are some thoughts that may help to debug this issue:
* The postgresql version with this 'problem' is 8.3.9
* The active WAL ID when we started and stopped PITR ends with '00'
* We have not seen this change of format in 8.3.9 when the WAL ID does not ends with '00'
* We have had WAL files ending with '00' with versions < 8.3.9 and the format used have been the expected ("<some
number>/<8digits>").
Any thoughts about this? Is this a bug or a 'feature'?
Thanks in advance.
regards,
-- Rafael Martinez, <r.m.guerrero@usit.uio.no>Center for Information Technology ServicesUniversity of Oslo, Norway
PGP Public Key: http://folk.uio.no/rafael/
Hi,
On Mon, Feb 1, 2010 at 7:33 PM, Rafael Martinez
<r.m.guerrero@usit.uio.no> wrote:
> The PITR backup history file named
> pg_xlog/000000010000003800000000.00000020.backup included this information:
> --------------------------------------------------------
> START WAL LOCATION: 38/20 (file 000000010000003800000000)
> STOP WAL LOCATION: 38/88 (file 000000010000003800000000)
> CHECKPOINT LOCATION: 38/20
> START TIME: 2010-02-01 07:20:05 CET
> LABEL:
> /usit/dbpg-research/pg_bck/PITR_data/PITRBASE-dbpg-research_v8.3.9_j10_2010-02-01_072001
> STOP TIME: 2010-02-01 07:22:42 CET
> --------------------------------------------------------
>
> As you can see, the second number in START/STOP and CHECKPOINT LOCATION
> has a length of 2. This second number usually has a length of 8.
>
> I have checked the logs from our last 5000 PITR jobs and the format of
> these values has always been "<some number>/<8 digits number>"
>
> We have been using the "<some number>/<8 digits>" ID returned by the
> pg_start_backup() function to find out the PITR backup history file we
> have to wait for in the archive directory, before we can delete old WAL
> files that are not needed anymore. This task gets more complicated if we
> cannot trust to get a consistent format from pg_start_backup().
>
> These are some thoughts that may help to debug this issue:
>
> * The postgresql version with this 'problem' is 8.3.9
> * The active WAL ID when we started and stopped PITR ends with '00'
> * We have not seen this change of format in 8.3.9 when the WAL ID does
> not ends with '00'
> * We have had WAL files ending with '00' with versions < 8.3.9 and the
> format used have been the expected ("<some number>/<8 digits>").
>
> Any thoughts about this? Is this a bug or a 'feature'?
This is not a bug. Since pg_start_backup() uses "%X/%X" (not "%08X/%08X")
as the format of WAL location, the length of the second number of the WAL
location could be less than 8.
Instead of calculating the name of the backup history file for yourself,
how about using pg_xlogfile_name() or pg_xlogfile_name_offset()? Those
functions convert the WAL location regardless of a format into the file name.
http://www.postgresql.org/docs/8.3/static/functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Fujii Masao wrote: > On Mon, Feb 1, 2010 at 7:33 PM, Rafael Martinez > <r.m.guerrero@usit.uio.no> wrote: >> >> Any thoughts about this? Is this a bug or a 'feature'? > > This is not a bug. Since pg_start_backup() uses "%X/%X" (not "%08X/%08X") > as the format of WAL location, the length of the second number of the WAL > location could be less than 8. > > Instead of calculating the name of the backup history file for yourself, > how about using pg_xlogfile_name() or pg_xlogfile_name_offset()? Thanks for the answer. We have updated our code and started using pg_xlogfile_name() in our PITR script. Everything works perfect now. When we started using PITR with version 8.1, we didn't have these functions and that was the reason we were using the value returned by pg_start_backup() to find out the last WAL to keep after PITR was finnish. regards, - --Rafael Martinez, <r.m.guerrero@usit.uio.no>Center for Information Technology ServicesUniversity of Oslo, Norway PGP Public Key: http://folk.uio.no/rafael/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.7 (GNU/Linux) iD8DBQFLaUXLBhuKQurGihQRAqNpAKCLCc6MDhGONJi5fTgStFoC+PP6hgCdHqVC yDfsC1erRWxFJRCF305Bbg8= =Brbz -----END PGP SIGNATURE-----