After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629238 - Need database locking for sqlite/mysql/postgresql
Need database locking for sqlite/mysql/postgresql
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Backend - SQL
git-master
Other All
: High major
: ---
Assigned To: Phil Longstaff
Chris Shoemaker
Depends on:
Blocks:
 
 
Reported: 2010-09-10 07:12 UTC by Christian Stimming
Modified: 2018-06-29 22:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Stimming 2010-09-10 07:12:38 UTC
Gnucash 2.3.x and also 2.4.0 will in no way be multi-user enabled. Instead, 
each time more than one user (or: more than one instance of gnucash) accesses 
the same database backend, data loss will occurr almost inevitably. To prevent 
that, for XML files we create an extra lock file and display a big red warning 
sign in case it already exists. Because of the non-existence of multi-user 
capabilities, we *must* ship with a similar database lock in case the backend 
is not XML but sqlite3 or mysql or postgresql (depending on the available dbi 
drivers).

I've asked this before, and the conclusion was that a lock on the full 
database is probably easiest and also sufficient. This bug reminds that we need such a database locking.

http://lists.gnucash.org/pipermail/gnucash-devel/2010-August/029177.html
https://lists.gnucash.org/pipermail/gnucash-devel/2010-May/028421.html
Comment 1 John Ralls 2010-10-17 18:08:45 UTC
AFAICT, locking is generally transaction-based in SQL databases. This makes sense considering that they're generally designed to be multi-user. Since that's apparently not the way we're using the database backend at the moment, I propose that we add a lock table with a single row. Is there any reason that this wouldn't work?
Comment 2 John Ralls 2010-10-31 21:00:16 UTC
r19738 implements the lock table for PostgresQL and MySQL. I had some concerns about that approach working with SQLite, so I tested multiple access with it and it worked out OK. r19739 adds the lock table function to SQLite initialization as well.
Comment 3 John Ralls 2018-06-29 22:44:29 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=629238. Please update any external references or bookmarks.