0002483: Gramps crashes while loading database, always.

Patch of Josip, support bsddb >= 4.7


svn: r11297
This commit is contained in:
Benny Malengier 2008-11-13 08:28:32 +00:00
parent 4979cf1651
commit 7424433a69

View File

@ -481,8 +481,13 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
# These env settings are only needed for Txn environment
self.env.set_lk_max_locks(25000)
self.env.set_lk_max_objects(25000)
self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) # clean up unused logs
if db.version() < (4, 7):
# Python 2.5 log settings
self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) # clean up unused logs
else:
# Python 2.6 log settings (db version 4.7.25)
self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1)
# The DB_PRIVATE flag must go if we ever move to multi-user setup
env_flags = db.DB_CREATE | db.DB_PRIVATE |\
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
@ -1567,6 +1572,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
transaction = BdbTransaction(msg, self.undodb, batch, no_magic)
if transaction.batch:
self.env.txn_checkpoint()
if db.version() < (4, 7):
self.env.set_flags(db.DB_TXN_NOSYNC, 1) # async txn
if self.secondary_connected and not transaction.no_magic:
@ -1605,6 +1611,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
self.txn.commit()
if transaction.batch:
self.env.txn_checkpoint()
if db.version() < (4, 7):
self.env.set_flags(db.DB_TXN_NOSYNC, 0) # sync txn
if not transaction.no_magic:
@ -1901,7 +1908,12 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
# These env settings are only needed for Txn environment
self.env.set_lk_max_locks(25000)
self.env.set_lk_max_objects(25000)
if db.version() < (4, 7):
# Python 2.5 log settings
self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) # clean up unused logs
else:
# Python 2.6 log settings (db version 4.7.25)
self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1)
# The DB_PRIVATE flag must go if we ever move to multi-user setup
env_flags = db.DB_CREATE | db.DB_PRIVATE |\