Re: cannot freeze committed xmax

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cannot freeze committed xmax
Date: 2020-10-28 15:25:31
Message-ID: 8B2560FC-F92D-46A4-8D71-EA274B5A56FC@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Oct 28, 2020, at 6:44 AM, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)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 time ago.

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 transaction aborted. But the query of clog is saying that it committed. Something is wrong with that. How did the hint bits get 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've got corruption.

Your question "preventing cutoff_xid to be greater than XID of some transaction which was aborted long time ago" seems to 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-10-28 15:30:24 Re: Patch to fix FK-related selectivity estimates with constants
Previous Message Magnus Hagander 2020-10-28 15:20:03 Re: cutting down the TODO list thread