Re: Zeroed out pages at the end of the database files

Поиск
Список
Период
Сортировка
От Jerry Sievers
Тема Re: Zeroed out pages at the end of the database files
Дата
Msg-id 86k3gtnqif.fsf@jerry.enova.com
обсуждение исходный текст
Ответ на Zeroed out pages at the end of the database files  (Drazen Kacar <drazen.kacar@oradian.com>)
Список pgsql-admin
Drazen Kacar <drazen.kacar@oradian.com> writes:

> Hello,
>
> I'm running PostgreSQL 9.2.4 on Ubuntu 12.04.3 LTS. It's being used by an application that has recently gone from
demo(very, very low usage) to production (low, but 
> constant usage). It runs the autovacuum daemon and zero_damaged_pages configuration parameter is off.
>
> Since Postgres 9.2 doesn't have block checksums I implemented a poor man's consistency checking: on the backup server
everybackup is unpacked and pg_filedump <db_file> 
> | grep Error is run on every database file. I have never seen any error reported by that, until the last Sunday the
firstone appeared. 

Are you running pg_filedump against either or both of a. live DB,
b. unpacked hot-backup that hasn't been started and allowed to reach
consistent recovery state?

If so, then I don't presume you'll have a reliable outcome though if
this had been done in the past on a system with very little throughput,
it might work by luck.

> It turned out that pg_filedump reported errors for 34 database files, but that was because all those files had one or
moredatabase pages (8k) at the end of the file 
> zeroed out. So pg_filedump couldn't find the proper header and thus reported an error. This was also the case on the
mainserver, so it wasn't some error present on the 
> backup server only. Database files stay in this condition for a time (I'm not sure how long) and then the zeroed out
pagesdisappear. Postgres doesn't report any kind 
> of an error.
>
> I want to ask if this behaviour is normal.
>
> I know that autovacuum can truncate the db file if it happens that the last page(s) don't contain live data, so this
behaviourcould be that, but it seems weird that 
> the pages would first be zeroed out and then, some time later, the file truncated. Why not truncate it immediately?
>
> My checking incantation is:
>
> cd $PGDATA
> for f in `find base global -type f -name '[0-9]*' \! -empty`; do
> ??? pg_filedump $f | grep -q Error
> ??? [[ $? -eq 0 ]] && echo $f
> done
>
> And later, to verify that all errors are zeroed-out pages at the end of the file:
>
> pg_filedump -d <file>
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


В списке pgsql-admin по дате отправления:

Предыдущее
От: Евгений Селявка
Дата:
Сообщение: Re: postgresql 9.1 out of memory
Следующее
От: Rune Gullstrom
Дата:
Сообщение: Connecting to Oracle from Postgresql 9.2 on Windows