From: jwhiting@redhat.com
To: Christopher BROWN <brown@reflexe.fr>
Cc: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Handling transaction failure due to concurrency errors
Date: Thu, 08 Mar 2018 10:59:32 +0000
Message-ID: <1520506772.4589.10.camel@redhat.com> (raw)
In-Reply-To: <CAHL_zcN5n+EzDT8wfdbbgU=0yqThGgDEh94LBC+a9yjQvW=Cow@mail.gmail.com>
References: <CAHL_zcOcnBhHhbLenk0xt43i2v8sO6C5RX2ntVMErbKDc+cuWw@mail.gmail.com>
<26956.1520003407@sss.pgh.pa.us>
<CAHL_zcMGYqbVBftasJb5GQOVtzjy94RHnJfjA5YkAtGNjUE7Cw@mail.gmail.com>
<27574.1520004078@sss.pgh.pa.us>
<CAHL_zcN5n+EzDT8wfdbbgU=0yqThGgDEh94LBC+a9yjQvW=Cow@mail.gmail.com>
Hi Christopher,
On a side note you should look at the Byteman project. Byteman makes
fault injection for testing purposes very easy.
http://byteman.jboss.org/
In your case using Byteman gets round the effort involved to precisely
re-create a failure scenario. Testing when your re-try logic kicks in
(or not).
Jeremy
On Fri, 2018-03-02 at 16:27 +0100, Christopher BROWN wrote:
> Tom,
>
> That's what I was looking for, so thanks, I'll give it a go.
>
> Best regards,
> Christopher
>
>
>
> On 2 March 2018 at 16:21, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Christopher BROWN <brown@reflexe.fr> writes:
> > > Thanks for the quick reply. OK for the explanation, and I don't
> > mind
> > > implementing the retry logic for this case... I just don't know
> > how to
> > > detect when my code encounters this case (as opposed to other
> > cases that
> > > can arise, such as unresolved foreign keys when importing data; I
> > don't
> > > want to get into an infinite retry loop because it will never
> > work in these
> > > other cases).
> >
> > Yes, you should only retry in this way for the specific case of a
> > serialization failure (SQLSTATE 40001).
> >
> > regards, tom lane
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: jwhiting@redhat.com, brown@reflexe.fr, tgl@sss.pgh.pa.us
Subject: Re: Handling transaction failure due to concurrency errors
In-Reply-To: <1520506772.4589.10.camel@redhat.com>
References: <CAHL_zcOcnBhHhbLenk0xt43i2v8sO6C5RX2ntVMErbKDc+cuWw@mail.gmail.com> <26956.1520003407@sss.pgh.pa.us> <CAHL_zcMGYqbVBftasJb5GQOVtzjy94RHnJfjA5YkAtGNjUE7Cw@mail.gmail.com> <27574.1520004078@sss.pgh.pa.us> <CAHL_zcN5n+EzDT8wfdbbgU=0yqThGgDEh94LBC+a9yjQvW=Cow@mail.gmail.com> <1520506772.4589.10.camel@redhat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox