[Spambayes] ZODB simultaneous read-write is okay, right?

Tim Peters tim.peters at gmail.com
Sun May 7 06:35:21 CEST 2006

[skip at pobox.com]
> I've switched from anydbm to ZODB for my SpamBayes database file.  Just to
> confirm, I can read and write simultaneously, correct?  I'm going back to
> using sb_mboxtrain for training and using sb_bnfilter for scoring should
> that make a difference.  I'd like to make sure the two processes can share
> the same ZODB database.

If you're using ZODB thru ZEO, any number of processes can have
read-write connections to the database simultaneously.

If you're not using ZEO, only one process can open the database with
write access, and all other processes must ask for read-only
connections; e.g.,

    st = FileStorage('Data.fs', read_only=True)

Note that a read-only connection can't participate in transactions,
and in particular that means it never "sees" changes made to the
database after it opens the database.  When a process with a read-only
connection decides it wants to see current data, it should close its
connection and DB, and re-open the storage from scratch (then create a
new DB from the new FileStorage instance, then create a new Connection
from the new DB).

More information about the SpamBayes mailing list