Re: cannot freeze committed xmax - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Re: cannot freeze committed xmax
Date
Msg-id 67179360-566b-7e2d-b94f-274d77e33741@postgrespro.ru
Whole thread Raw
In response to Re: cannot freeze committed xmax  (Mark Dilger <mark.dilger@enterprisedb.com>)
Responses Re: cannot freeze committed xmax
List pgsql-hackers

On 28.10.2020 18:25, Mark Dilger wrote:
>
>> On Oct 28, 2020, at 6:44 AM, Konstantin Knizhnik <k.knizhnik@postgrespro.ru> wrote:
>>
>> Looks like there is no assumption that xmax should be set to InvalidTransactionId when HEAP_XMAX_INVALID bit is
set.
>> And I didn't find any check  preventing cutoff_xid to be greater than XID of some transaction which was aborted long
timeago.
 
> Nothing in your example suggests that cutoff_xid is wrong, so I'd assume that part is probably working ok.
>
> Your data shows that HEAP_XMAX_INVALID and HEAP_UPDATED flags are both set.  That should only happen if the updating
transactionaborted.  But the query of clog is saying that it committed. Something is wrong with that.  How did the hint
bitsget set to HEAP_XMAX_INVALID if the transaction did commit.  Either some process is setting that hint bit when it
shouldn't,or your clog is corrupted and returning a bogus answer about the xmax having been committed.  Either way,
you'vegot corruption.
 
>
> Your question "preventing cutoff_xid to be greater than XID of some transaction which was aborted long time ago"
seemsto be ignoring that TransactionIdDidCommit(xid) is returning true, suggesting the transaction did not abort.
 
>
> —
> Mark Dilger
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
Yes, I forgot to say that transaction is treated as committed 
(txid_status() returns "committed").
Also database was previously upgraded from 11.5 to 11.7
Certainly the hypothesis of CLOG corruption explains everything.
I wonder if there can be some other scenario (upgrade, multixacts, 
previous freeze attempt...) which can cause such combination of flags?
I have inspected all cases where HEAP_XMAX_INVALID is set, but have not 
found any one which can explain it.

-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: duplicate function oid symbols
Next
From: Tom Lane
Date:
Subject: Re: Patch to fix FK-related selectivity estimates with constants