Re: check database integrity

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: check database integrity
Дата
Msg-id 23576.1405952278@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: check database integrity  (Torsten Förtsch <torsten.foertsch@gmx.net>)
Ответы Re: check database integrity  (Torsten Förtsch <torsten.foertsch@gmx.net>)
Список pgsql-general
=?ISO-8859-1?Q?Torsten_F=F6rtsch?= <torsten.foertsch@gmx.net> writes:
> Another question, just out of curiosity, for vm and main forks I use
> pg_relation_size to figure out the highest page number. That does not
> work for fsm. I have at least one fsm file that it 24 kb. Fetching page
> 0 works, page 1 and above gives an error:

> db=# select page_header(get_raw_page(2836::oid::regclass::text, 'fsm', 0));
>                  page_header
> ----------------------------------------------
>  (114/23485F78,19084,0,24,8192,8192,8192,4,0)
> (1 row)

> db=# select page_header(get_raw_page(2836::oid::regclass::text, 'fsm',
> 1));
> ERROR:  block number 1 is out of range for relation "pg_toast_1255"
> db=# select pg_relation_size(2836::oid::regclass, 'fsm');

>  pg_relation_size
> ------------------
>             24576

That's bizarre.  AFAICS, pg_relation_size() reduces to a stat() call,
while the other error looks like it's coming from rawpage.c's check on
RelationGetNumberOfBlocks() which depends on mdnblocks() which prefers
to look at the result of lseek(SEEK_END).  But both of those should
surely get the same answer, if the file's not changing.

Could you trace through it and see where the results diverge?  Also,
what's the actual size of the file on disk?

Alternatively, if you have a way to reproduce this from a standing
start, I'd be happy to poke into it here.

            regards, tom lane

PS: you've not messed around with the value of BLCKSZ have you?
If different bits of code had different ideas of that constant's
value, it'd possibly explain this.


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

Предыдущее
От: Rebecca Clarke
Дата:
Сообщение: Re: Track changes to function code
Следующее
От: Sergey Konoplev
Дата:
Сообщение: Re: statement_timeout doesn't work