From: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, "nikita(dot)y(dot)volkov(at)mail(dot)ru" <nikita(dot)y(dot)volkov(at)mail(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BUG #12330: ACID is broken for unique constraints |
Date: | 2014-12-29 15:09:09 |
Message-ID: | 534827646.1373406.1419865749409.JavaMail.yahoo@jws100110.mail.ne1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> Well, I'm arguing that duplicate key errors are not serialization
> failures unless it's likely the insertion would succeed upon a retry;
> a proper insert, not an upsert. If that's the case with what you're
> proposing, then it makes sense to me. But that's not what it sounds
> like...your language suggests AIUI that having the error simply be
> caused by another transaction being concurrent would be sufficient to
> switch to a serialization error (feel free to correct me if I'm
> wrong!).
>
> In other words, the current behavior is:
> txn A,B begin
> txn A inserts
> txn B inserts over A, locks, waits
> txn A commits. B aborts with duplicate key error
>
> Assuming that case is untouched, then we're good! My long winded
> point above is that case must fail with duplicate key error; a
> serialization error is suggesting the transaction should be retried
> and it shouldn't be...it would simply fail a second time.
What I'm proposing is that for serializable transactions B would
get a serialization failure; otherwise B would get a duplicate key
error. If the retry of B looks at something in the database to
determine what it's primary key should be it will get a new value
on the retry, since it will be starting after the commit of A. If
it is using a literal key, not based on something changed by A, it
will get a duplicate key error on the retry, since it will be
starting after the commit of A.
It will either succeed on retry or get an error for a different
reason.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2014-12-29 15:31:46 | Re: BUG #12330: ACID is broken for unique constraints |
Previous Message | Tom Lane | 2014-12-29 14:55:42 | Re: BUG #12367: Wrong result on to_char() when inputing dates |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2014-12-29 15:21:40 | Re: Serialization exception : Who else was involved? |
Previous Message | Ali Akbar | 2014-12-29 15:06:38 | Re: PATCH: decreasing memory needlessly consumed by array_agg |