New database backend and multi-user

Phil Longstaff plongstaff at rogers.com
Sun Sep 6 09:18:32 EDT 2009


On September 6, 2009 06:37:32 am Geert Janssens wrote:
> Hi,
>
> I'm very interested to use the new db backend in the upcoming 2.4 series.
>
> Thinking about this, I was wondering if the current implementation deals
> well with multi-user access to the same db. I mean can two users from two
> different computers use gnucash with the same (postgres or mysql) gnucash
> database at the same time ?
>
> I am aware that the db backend in the current implementation is mainly the
> xml file concept translated into a db backend, but so far it's not clear to
> me if this has implications for concurrent access to the db or not (when
> access is properly done via the gnucash engine).

There are a couple of problems with the current db back-end with respect to 
multi-user access.

1) locking/transactions - db transactions are used whenever an object is 
written or updated.  However, no locking is done, and there are certain cases 
where related objects are not saved in the same db transaction, because the 
back-end does not have enough information.  For example, when a transaction 
with multiple splits is saved, each of these is a separate engine object and 
is saved separately.  The back-end API would need to be modified to add "start-
transaction" and "end-transaction" calls so that multiple objects could be 
saved/committed/rolled back together.

2) Update notification - Most objects are read when the db is opened and not 
read again.  Some databases (postgres? not mysql?) provide a callback when an 
update is made, so that data can be refreshed.  An alternative would be a 
timer to refresh.

3) Mechanism to handle conflicts - How should the cases be handled when 
different people make conflicting changes?

Phil


More information about the gnucash-devel mailing list