pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Vladimir Stankovic <V.Stankovic@city.ac.uk>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: No exception with concurrent updates
Date: Wed, 14 Jul 2004 19:38:39 -0400
Message-ID: <1089848319.1548.60.camel@localhost.localdomain> (raw)
In-Reply-To: <E1BkrQk-0006me-00@ms2.city.ac.uk>
References: <E1BkrQk-0006me-00@ms2.city.ac.uk>

Yes, you are correct, it should be handled properly in this case, you
should look at the logs in the postgresl log, to see what is really
going on, it is possible they truly aren't concurrent.

Set logpid on, and log statement

Dave
On Wed, 2004-07-14 at 17:36, Vladimir Stankovic wrote:
> Dave,
> 
> On Jul 14 2004, Dave Cramer wrote:
> 
> > Vladimir,
> > 
> > This simply won't work, you will need to either synchronize transaction,
> > or use some other locking mechanism. As I said, postgres supports
> > concurrent transactions, they will both succeed simultaneously. 
> > 
> I thought that this is taken care of when you set TRANSACTION_SERIALIZABLE on 
> the Connection object.
> 
> > Your options are select the row for update, which will lock it from
> > other transactions updating it.
> > 
> > synchronize transaction so that only one gets in there at a time.
> > 
> > use pessimistic locking which involves a timestamp and you have to check
> > to make sure that the row has not changed before you update it, although
> > without synchronization this won't work either.
> > 
> > Dave
> > 
> > 
> This programme was a part of the comparison between PostgreSQL and InterBase 
> (known now under name Firebird for open source developement) regarding their 
> concurrent updates handling, which as I know doesn't use 2 Phase Commit either. 
> The term for MVCC in IB is multi-generational database architecture. By the way 
> there exist the NO WAIT parameter in IB, which can be specified when starting a 
> transaction and does not require a transaction to wait until the end of 
> concurrent transaction. Using this mode the first version of my programme 
> (without threads) did not halt - I received the exception and the second 
> transaction's update did not commit.
> 
> Thanks for the prompt responses,
> 
> Vladimir
> 
> ________________________________________________________________________
> 
> Vladimir Stankovic                    Tel: +44 20 7040 0273
> Research Student                      Fax: +44 20 7040 8585
> Centre for Software Reliability       Email: V.Stankovic@city.ac.uk
> City University
> Northampton Square, London EC1V 0HB
> ________________________________________________________________________
> 
> 
> 
> 
> !DSPAM:40f5a78e197681998034425!
> 
> 
-- 
Dave Cramer
519 939 0336
ICQ # 14675561




view thread (9+ messages)

Message-ID: <1089848319.1548.60.camel@localhost.localdomain>
Permalink:  ../1089848319.1548.60.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1089848319.1548.60.camel@localhost.localdomain

 · 

reply

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: pg@fastcrypt.com, V.Stankovic@city.ac.uk
  Subject: Re: No exception with concurrent updates
  In-Reply-To: <1089848319.1548.60.camel@localhost.localdomain>
  References: <E1BkrQk-0006me-00@ms2.city.ac.uk> <1089848319.1548.60.camel@localhost.localdomain>

* 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