Re: Problem with txid_snapshot_in/out() functionality

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Jan Wieck <jan(at)wi3ck(dot)info>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with txid_snapshot_in/out() functionality
Date: 2014-04-12 12:38:58
Message-ID: 20140412123858.GT14419@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-04-12 10:27:16 +0300, Heikki Linnakangas wrote:
> On 04/12/2014 12:07 AM, Jan Wieck wrote:
> >The symptom is that a txid_snapshot on output lists the same txid
> >multiple times in the xip list part of the external representation. This
> >string is later rejected by txid_snapshot_in() when trying to determine
> >if a particular txid is visible in that snapshot using the
> >txid_visible_in_snapshot() function.

> It's two-phase commit. When preparing a transaction, the state of the
> transaction is first transfered to a dummy PGXACT entry, and then the PGXACT
> entry of the backend is cleared. There is a transient state when both PGXACT
> entries have the same xid.

Which I find to be a pretty bad idea independent of this bug. But I
think that's nothing fixable in the back branches.

> Hmm. Do we snapshots to be stored in tables, and included in a dump? I don't
> think we can guarantee that will work, at least not across versions, as the
> way we handle snapshot internally can change.

Hm. I don't think we'll earn much love changing that - there's at the
very least slony and londiste out there using it... IIRC both store the
result in tables.

> But yeah, we probably should do something about that. The most
> straightforward fix would be to scan the array in txid_current_snapshot()
> and remove any duplicates.

Since it's sorted there, that should be fairly straightforward. Won't
fix already created and stored datums tho. Maybe _in()/parse_snapshot()
should additionally skip over duplicate values? Looks easy enough.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2014-04-12 12:42:51 Re: Problem with txid_snapshot_in/out() functionality
Previous Message Jan Wieck 2014-04-12 12:34:49 Re: Problem with txid_snapshot_in/out() functionality