[OSSTEST PATCH 0/1] PostgreSQL db: Retry on constraint violation

From: Ian Jackson <ian(dot)jackson(at)eu(dot)citrix(dot)com>
To: <xen-devel(at)lists(dot)xenproject(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: [OSSTEST PATCH 0/1] PostgreSQL db: Retry on constraint violation
Date: 2016-12-09 18:26:30
Message-ID: 1481307991-16971-1-git-send-email-ian.jackson@eu.citrix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi. This message is going to xen-devel (because that's where the
osstest project is) and to pgsql-hackers (because I hope they may be
able to advise about the scope of the PostgreSQL SERIALIZABLE
constraint problem).

In summary: PostgreSQL only provides transaction serialisability for
successful transactions. Even with SERIALIZABLE, transactions may
fail due to spurious and "impossible" constraint violations.

As a result, I need to make osstest retry transactions not only on
explicitly reported serialisation failures and deadlocks, but also on
integrity violations.

It is not clear to me from the thread
WIP: Detecting SSI conflicts before reporting constraint violations
which was on pgsql-hackers earlier this year, whether it is only
unique constraint violations which may spuriously occur.

Can anyone from the PostgreSQL hacker community advise ? The existing
documentation patch just talks about "successful" transactions, and
uses unique constraints as an example. In principle this leaves open
the possibility that the transaction might fail with bizarre and
unpredictable error codes, although I hope this isn't possible.

It would be good to narrow the scope of the retries in my system as
much as possible.

I'm hoping to get an authoritative answer here but it seems that this
is a common problem to which there is still not yet a definitive
solution. I would like there to be a definitive solution.

If I get a clear answer I'll submit a further docs patch to pgsql :-).

Thanks,
Ian.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Jackson 2016-12-09 18:26:31 [OSSTEST PATCH 1/1] PostgreSQL db: Retry transactions on constraint failures
Previous Message Keith Fiske 2016-12-09 18:23:44 Re: [COMMITTERS] pgsql: Implement table partitioning.