The following bug has been logged online:
Bug reference: 2488
Logged by: Masao Fujii
Email address: fujii.masao@oss.ntt.co.jp
PostgreSQL version: 8.1.4
Operating system: Fedora Core 5
Description: backup history file is archived doubly
Details:
Hi, My name is Masao Fujii.
I found an error that backup history file is archived doubly.
postgresql.conf that I changed from the default is as follow.
archive_command = 'cp %p /home/postgres/pg_archive/%f'
The sequence of steps to reproduce the problem is as follow.
NOTE: it is very rare that the problem reproduces.
---
[postgres@excalibur pgsql-8.1.4]$ bin/psql sampledb
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
sampledb=# SELECT pg_start_backup('test1');
pg_start_backup
-----------------
0/33ACB4
(1 row)
sampledb=# SELECT pg_stop_backup();
pg_stop_backup
----------------
0/33ACF8
(1 row)
---
The server log is as follow.
---
[postgres@excalibur pgsql-8.1.4]$ bin/postmaster -D ./data
LOG: database system was shut down at 2006-06-21 21:40:26 JST
LOG: checkpoint record is at 0/33A6AC
LOG: redo record is at 0/33A6AC; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 565; next OID: 10794
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready
LOG: transaction ID wrap limit is 2147484146, limited by database
"postgres"
LOG: transaction ID wrap limit is 2147484146, limited by database
"postgres"
LOG: archived transaction log file
"000000010000000000000000.0033ACB4.backup"
LOG: archived transaction log file
"000000010000000000000000.0033ACB4.backup"
---
The cause of the problem is that pg_stop_backup creates two *.ready files.
One file is created by pg_stop_backup > RemoveOldBackupHistory >
XLogArchiveIsDone > XLogArchiveNotify.
Another is created by pg_stop_backup > XLogArchiveNotify.
The problem occurs if archiver process executes archive_command during the
creation of two files.
I'll be pleased if you cope with the trouble.
Thanks in advance,