Re: 2 connections 1 transaction - Mailing list pgsql-general
From | Daniel Schuchardt |
---|---|
Subject | Re: 2 connections 1 transaction |
Date | |
Msg-id | 001701c34c72$4b8dc1f0$4500a8c0@DSVAIO Whole thread Raw |
In response to | Re: 2 connections 1 transaction (Jason Godden <jasongodden@optushome.com.au>) |
Responses |
Re: 2 connections 1 transaction
Re: 2 connections 1 transaction |
List | pgsql-general |
Hi Jason, Thats not what I mean. Both, the Client and the App-Server connects to the same Postgres-Database. The problem a procedure like this: 1.Client starts Transaction and does some changes. 2.Now the client notices that very huge operations are nescesarry and starts a procedure @ App-Server 3.App-Server reads the database and makes changes. Problem : the changes the client does are not commited -> the server can't see the changes or the case more bad the server waits for the client connection. (transaction isolation and table / record locking) 4.If everything works well both changes (done by the client and the server) should commit or rollback now So both Postgres-Connections has to be @ the same TransAction-OID in Postgres. greets Daniel -----Ursprüngliche Nachricht----- Von: pgsql-general-owner+M45575@postgresql.org [mailto:pgsql-general-owner+M45575@postgresql.org] Im Auftrag von Jason Godden Gesendet: Donnerstag, 17. Juli 2003 14:23 An: Daniel Schuchardt; pgsql-general@postgresql.org Betreff: Re: [GENERAL] 2 connections 1 transaction Hi Daniel, Maybe make procedural wrappers around all events undertaken and simulate it? ie: 1. Client connects to MS SQL Server (Application Server) and PG Server 2. SQL Server connects to PG Server aswell 3. Client begins new record process 4. New record process starts by putting PG into serializable transactions (so App Server can respect the changes). 5. If one server transaction fails roll back the other and vice versa and start again. 6. If all good, commit both at the client as the last item in the new record process. Meanwhile the Application Server may make it's own calls against Pg through strored procedures. If any part of this PG transaction fails, error comes back to App Server and App Server transaction roll backs, which tells the client and the client rolls back it's own call to PG. I don't know if this is a viable method (v. messy) and given the concurrent update issue this may play havoc with the client logic if both the client and the app server attempt to modify the same data at the PG Server. Can all connections simply go through the App Server leaving it to manage the PG stuff in it's own transactions (still, concurrent update problem can occur if dealing with same records)? Rgds, Jason On Thu, 17 Jul 2003 09:45 pm, Daniel Schuchardt wrote: > Hi @ all, > > Our software consists of a Client-Side App and a Application Server. > Every client owns a direct connection to the PSql-Server and for every > Client the Application-Server also creates a connection to the > PSql-Server. The problem is that it is nescesary that the Client and > the Application-Server are in the same transaction. But how say > connection x to be in the same transaction like connection y? > > Thanks for help, > > Daniel ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster
pgsql-general by date: