zotero.sqlite corruption caused by multiple reads?

37 views
Skip to first unread message

Graham Perrin

unread,
Dec 27, 2008, 7:08:06 AM12/27/08
to zotero-dev
I read a highlight from
http://www.zotero.org/support/dev/accessing_zotero_data_using_an_sqlite_client

> external access to the SQLite database … should only be
> done in a read-only manner.

alongside a highlight from
http://www.zotero.org/support/zotero_over_a_network

> multiple reads/writes can corrupt the Zotero library database

I can understand how multiple _concurrent writes_ might cause
corruption, but:

* how might corruption be caused by _multiple reads_?

TIA for advice
Graham

Dan Stillman

unread,
Dec 29, 2008, 4:21:49 AM12/29/08
to zoter...@googlegroups.com

Concurrent reads wouldn't, of course, corrupt the database, but there
are a few additional issues that come into play when accessing Zotero
over the network:

1) If the auto-update preference is enabled, Zotero will still write to
the database during translator/style updates even if no manual changes
are made. So you'd want to enforce read-only access at the share level,
and you'd want to disable the pref (to prevent possible errors--I don't
know off-hand how well Zotero deals with a write failure during an update).

2) Zotero caches a lot of information in memory to improve performance,
so it won't really work as a traditional multi-user database
client--other clients wouldn't see many changes until restart.

3) Mozilla does some additional SQLite caching that may cause problems
if the database changes out from under it, so even if Zotero were
designed to account for external DB changes, mozStorage might not allow
for it, and it might even throw a (spurious) corruption error.

- Dan

Graham Perrin

unread,
Dec 29, 2008, 5:53:58 AM12/29/08
to zotero-dev
Dan, many thanks.

Answers (1) and (2) paint a clear picture.

Answer (3) is equally good but (to me) not a concern; I don't
anticipate external (ex-Zotero) (ex-Mozilla) changes to the database.

Dan Stillman

unread,
Dec 29, 2008, 1:13:58 PM12/29/08
to zoter...@googlegroups.com
On 12/29/08 5:53 AM, Graham Perrin wrote:
> Answer (3) is equally good but (to me) not a concern; I don't
> anticipate external (ex-Zotero) (ex-Mozilla) changes to the database.
>

I wasn't referring to changes outside Zotero, actually. From the
perspective of one of the read-only Mozilla clients, a write by another
Mozilla client would be an external change, changing the on-disk state
of the database from the in-memory representation.

Graham Perrin

unread,
Dec 29, 2008, 3:04:27 PM12/29/08
to zotero-dev
Again, thanks: the picture is even clearer.

(AFAIR I found something to this effect in the documentation at
zotero.org but it's good to have it reaffirmed in this thread.)

I do not envisage a Mozilla client
but if I did: the client should be designed to never write to
zotero.sqlite
(assumes that Zotero is both added to, and enabled in, Mozilla).

(For users of Mozilla, Zotero add-on is certainly the preferred client
of zotero.sqlite.)

Best,
Graham
Reply all
Reply to author
Forward
0 new messages