вторник, 15 марта 2011 г.

PostrgreSQL pgarch_ArchiverCopyLoop

Today I had an interesting experiment while tuning our new PostgreSQL server. I powered it off during operation. PostgreSQL restored after reboot and was rather happy after restoring from log files in pg_xlog, but later it began to swear:

Mar 15 17:36:01 pgsql pgsql[1579]: [10-2] db , client , user LOCATION: pgarch_ArchiverCopyLoop, pgarch.c:466
Mar 15 17:37:03 pgsql pgsql[1579]: [14-1] db , client , user WARNING: 01000: transaction log file "00000001000000170000007E" could not be archived: too many failures

It seems that during power failure one log was archiving and as result file "00000001000000170000007E.bz2" existed in archive. So, PostgreSQL refused to overwrite it (test -f returned not 0). So, I moved that file to other directory and postgresql created new archive copy of this wal file. I compared md5 sums of original log file in pg_xlog and archived one, they matched and I deleted old copy. It seems that bzip2 process was interrupted during power failure. It's a good expirience: it confirms that my archive_command

/bin/test ! -f /path/to/archived/logs/%f.bz2 && /bin/cat %p | /usr/bin/bzip2 -c > /path/to/archived/logs/%f.bz2'
is right.

Комментариев нет:

Отправить комментарий