From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
Cc: | Sherif Kottapurath <sherifkm(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: locking problem in jdbc driver? |
Date: | 2009-12-31 01:01:50 |
Message-ID: | 4B3BF7FE.4040001@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On 31/12/2009 12:46 AM, Richard Broersma wrote:
> On Wed, Dec 30, 2009 at 8:29 AM, Sherif Kottapurath<sherifkm(at)gmail(dot)com> wrote:
>
>> All threads shown here are operating on
>> the same table, and they are all parts of transactions involving multiple tables.
>> deadlock detection is set for 1 sec and no dedlocks are reported by postgres.
>
> From my experience, PostgreSQL doesn't report deadlocks.
It should, at least with default settings. Failure to do so would, I
expect, be considered a bug. How, exactly, are you creating a deadlock
situation for your testing?
> However, unless you've set your transaction isolation level to
> SERIALIZABLE ( the default isolation level is READ COMMITED), you will
> not be getting deadlocks from PostgreSQL.
Sure you will. In READ COMMITTED:
CREATE TABLE a ( );
CREATE TABLE b ( );
T1: LOCK TABLE a;
T2: LOCK TABLE b;
T2: LOCK TABLE a;
T1: LOCK TABLE b;
then one of the transactions will be aborted with:
ERROR: deadlock detected
DETAIL: Process 13674 waits for AccessExclusiveLock on relation 57791
of database 57071; blocked by process 13672.
Process 13672 waits for AccessExclusiveLock on relation 57788 of
database 57071; blocked by process 13674.
HINT: See server log for query details.
What *doesn't* happen in read committed isolation is serialization failures.
> Also, IIRC the PostgreSQL JDBC driver only allows a single thread to
> access a connection object at a time.
Yep. It's thread safe, but a given connection can only be doing one
thing at a time, so other Java threads will wait for access to the
connection.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2009-12-31 01:07:06 | Re: locking problem in jdbc driver? |
Previous Message | John R Pierce | 2009-12-30 23:58:33 | Re: metadata as XML |