Re: after using pg_resetxlog, db lost

От: Tom Lane
Тема: Re: after using pg_resetxlog, db lost
Дата: ,
Msg-id: 8397.1088048486@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Re: after using pg_resetxlog, db lost  ("Shea,Dan [CIS]")
Список: pgsql-performance

Скрыть дерево обсуждения

after using pg_resetxlog, db lost  ("Shea,Dan [CIS]", )
 Re: after using pg_resetxlog, db lost  (Tom Lane, )
  Re: after using pg_resetxlog, db lost  (Richard Huxton, )
   Re: after using pg_resetxlog, db lost  (Tom Lane, )
 Re: after using pg_resetxlog, db lost  ("Shea,Dan [CIS]", )
  Re: after using pg_resetxlog, db lost  (Tom Lane, )
 Re: after using pg_resetxlog, db lost  ("Shea,Dan [CIS]", )
  Re: after using pg_resetxlog, db lost  (Tom Lane, )
 Re: after using pg_resetxlog, db lost  ("Shea,Dan [CIS]", )

"Shea,Dan [CIS]" <> writes:
> Tom I see you from past emails that you reference using -i -f with
> pg_filedump.  I have tried this, but do not know what I am looking at.

What you want to look at is valid XMIN and XMAX values.  In this
example:

>  Item   1 -- Length:  196  Offset: 4292 (0x10c4)  Flags: USED
>   XID: min (2)  CMIN|XMAX: 211  CMAX|XVAC: 469
>   Block Id: 0  linp Index: 1   Attributes: 24   Size: 28
>  infomask: 0x2912 (HASVARWIDTH|HASOID|XMIN_COMMITTED|XMAX_INVALID|UPDATED)

the infomask shows XMIN_COMMITTED, so xmin (here 2) is valid, but it also
shows XMAX_INVALID, so the putative XMAX (211) should be ignored.

In general the xmin field should be valid, but xmax shares storage with
cmin and so you have to look at the infomask bits to know whether to
believe that the cmin/xmax field represents a transaction ID.

The cmax/xvac field could also hold a transaction ID.  If I had only
the above data to go on, I'd guess that the current transaction counter
is at least 469.

Under normal circumstances, command counter values (cmin or cmax) are
unlikely to exceed a few hundred, while the transaction IDs you are
looking for are likely to be much larger.  So you could get away with
just computing the max of *all* the numbers you see in xmin, cmin/xmax,
or cmax/cvac, and then using something a million or so bigger for safety
factor.

            regards, tom lane


В списке pgsql-performance по дате сообщения:

От: Tom Lane
Дата:
Сообщение: Re: after using pg_resetxlog, db lost
От: Laurent Martelli
Дата:
Сообщение: Re: Pas la samedi