gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Concurrent connections on the same patient


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Concurrent connections on the same patient
Date: Sun, 1 Jul 2012 19:52:50 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Jul 01, 2012 at 06:50:09PM +0200, Slappinjohn wrote:

> so let's see how far we got...
> 
> I managed to set up a set of testdatabases and got replication working
> over the internet - GOOD!
> 
> I tried it with a gnumed_v16 database (sorry not up-to-date, I know)
> applied the SQL-Patch Karsten send me, set up bucardo, tried to add a
> sync and BOOM! It's not working.
> 
> Hours of testing later, one night to sleep over... And I got it.
> 
> The error message said something about you can't use INSERT on a
> read-only connection... I think the gnumed-database is set to "set
> default_transaction_read_only to on", right? - TADA

Nice. Did you yet notice any difference in 

> Any solutions to get around this without setting
> default_transaction_read_only to off permanently?

Not really due to the very nature of things. The default
setting in GNUmed is readonly in order to prevent
"accidental" connections to be able to write to the database
without taking explicit action. The read-write transactions
inside GNUmed do nothing but - they request explicit
read-write after establishing a readonly connection.

So, Bucardo needs to do the same thing.

Since it is unlikely (though not impossible to imagine) that
Bucardo is prepared to run special code before doing any
writes one must find another way to achieve that.

Now, PostgreSQL can store database settings specific to the
user which override those having been stored specific to a
database (such as default_readonly=True for gnumed_vXX).

So what I would suggest doing is to

- create a dedicated user with r/w access to the gnumed_vXX
  in question (the easiest would be to create a staff member
  inside GNUmed and use the database account thereof)

- use that database account for Bucardo replication

- ALTER that USER to have default_transaction_read_only to OFF

That would *localize* the default=write as much as possible.

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

[Prev in Thread] Current Thread [Next in Thread]