[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] (no subject)
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] (no subject) |
Date: |
Thu, 22 Dec 2005 02:00:48 +0100 |
User-agent: |
Mutt/1.5.11 |
On Thu, Dec 22, 2005 at 08:33:43AM +0800, Syan Tan wrote:
> a client could
> be operating on stale data, send an update based on the stale data, and
> then later receive a delayed notify message
> to update it's stale data, and it would not see the same total order as
> other clients.
>
> or the client must check xmin with each update, just in case it is
> overwriting
> a delayed update from elsewhere.
That's what we do.
On each write (sql-update in save_payload()) we
- "select for update" to check whether someone else is
writing *right now*
- "update ... where xmin=old_xmin" to see whether someone
else changed/deleted our row while we were away
In case of the former we retry with a timeout.
In case of the latter - which is likely to happen after the
former occurred - we offer all three versions
- the original data we saw when reading it
- the new data we were about to write to the backend
- the modified data as is currently in the backend written by someone else
to the caller for use in a merge widget.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346