pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Transactional support across multiple machines...
5+ messages / 3 participants
[nested] [flat]

* Transactional support across multiple machines...
@ 2010-11-17 18:14  Peter Tap <ptrtap@yahoo.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Tap @ 2010-11-17 18:14 UTC (permalink / raw)
  To: pgsql-jdbc

Folks,

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Transactional support across multiple machines...
@ 2010-11-17 18:40  Maciek Sakrejda <msakrejda@truviso.com>
  parent: Peter Tap <ptrtap@yahoo.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Maciek Sakrejda @ 2010-11-17 18:40 UTC (permalink / raw)
  To: Peter Tap <ptrtap@yahoo.com>; +Cc: pgsql-jdbc

Prepared transactions:
http://www.postgresql.org/docs/9.0/static/sql-prepare-transaction.html
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Transactional support across multiple machines...
@ 2010-11-17 18:47  Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  parent: Maciek Sakrejda <msakrejda@truviso.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2010-11-17 18:47 UTC (permalink / raw)
  To: Maciek Sakrejda <msakrejda@truviso.com>; +Cc: Peter Tap <ptrtap@yahoo.com>; pgsql-jdbc

On 17.11.2010 20:40, Maciek Sakrejda wrote:
> Prepared transactions:
> http://www.postgresql.org/docs/9.0/static/sql-prepare-transaction.html

Yeah, two-phase commit is the usual solution. But you shouldn't usually 
try to implement that yourself, you should pick an existing Transaction 
Manager. Java application servers usually include one, so if you're 
using an application server, just configure your application to use XA 
connections and let the app server handle the two-phase commit for you.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Transactional support across multiple machines...
@ 2010-11-17 18:55  Peter Tap <ptrtap@yahoo.com>
  parent: Maciek Sakrejda <msakrejda@truviso.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Peter Tap @ 2010-11-17 18:55 UTC (permalink / raw)
  To: Maciek Sakrejda <msakrejda@truviso.com>; +Cc: pgsql-jdbc

Hi Maciek,

Thank you for your help.

I looked at the link you provided me. However, I am still confused. I have three 
different connections to three different databases. If I call 
PREPARE_TRANSACTION and COMMIT_PREPARED on each machine, it may still not be 
atomic. 


I would think one would need some kind of distributed transaction coordinator 
such as Java Transactional API (JTA).

I appreciate your help.

Regards,
Peter





________________________________
From: Maciek Sakrejda <msakrejda@truviso.com>
To: Peter Tap <ptrtap@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Sent: Wed, November 17, 2010 10:40:57 AM
Subject: Re: [JDBC] Transactional support across multiple machines...

Prepared transactions:
http://www.postgresql.org/docs/9.0/static/sql-prepare-transaction.html
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com



      

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Transactional support across multiple machines...
@ 2010-11-17 19:15  Maciek Sakrejda <msakrejda@truviso.com>
  parent: Peter Tap <ptrtap@yahoo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Maciek Sakrejda @ 2010-11-17 19:15 UTC (permalink / raw)
  To: Peter Tap <ptrtap@yahoo.com>; +Cc: pgsql-jdbc

Once the transactions are prepared, they are serialized to disk and
you will be able to go back and commit them later even if you have a
database crash (assuming safe postgresql.conf settings). All
distributed commit mechanisms will be built on something like this
under the hood--there is no magical "commit everywhere atomically"
functionality (perhaps with quantum computing ;) ). But Heikki is
right--you probably want to go through higher-level APIs like JTA.
Just make sure you understand the recovery guarantees if you fail in
the middle of, e.g., a JTA commit, which could translate into some
committed prepared transactions and some uncommitted ones, or some
rolled back and some prepared.

Everything you need to either commit or roll back (depending on when
the failure occurred) the full set of transactions will be there on
disk, but I don't know whether the JTA implementation will do that for
you. And you definitely don't want prepared transactions sitting
around on disk indefinitely.
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2010-11-17 19:15 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-17 18:14 Transactional support across multiple machines... Peter Tap <ptrtap@yahoo.com>
2010-11-17 18:40 ` Maciek Sakrejda <msakrejda@truviso.com>
2010-11-17 18:47   ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2010-11-17 18:55   ` Peter Tap <ptrtap@yahoo.com>
2010-11-17 19:15     ` Maciek Sakrejda <msakrejda@truviso.com>

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