[Python-Dev] improving dumbdbm's survival chances...
Sun, 13 Jul 2003 13:32:15 -0500
(CC'ing python-dev because I think there's a simple improvement/fix for
I realize we (the Spambayes folks) want to discourage people from using
dumbdbm, but for those who are either stuck with it or don't realize they
are using it, I wonder if we can do a little something to help them out.
As I understand it, if a machine crashes or is shut down without exiting
Outlook, there's a good chance that the dumbdbm's _commit method won't have
been called and the directory and data files will be out-of-sync. It seems
that dumbdbm doesn't support a sync() method which shelve likes to call.
Shelve's sync method gets called from time-to-time by the Spambayes storage
code. dumbdbm.sync has this statement:
if hasattr(self.dict, 'sync'):
so maybe it's as simple (short-term) as modifying dbmstorage.open_dumbdbm()
"""Open a dumbdbm database."""
db = dumbdbm.open(*args)
if not hasattr(db, "sync"):
db.sync = db._commit
The above should help. Meanwhile, it appears that would be a good method to
add to dumbdbm databases both for 2.3 and the 2.2 maintenance branch.