From 7424433a6945bdcfac1e72b434c63dbff8d8617d Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 13 Nov 2008 08:28:32 +0000 Subject: [PATCH] 0002483: Gramps crashes while loading database, always. Patch of Josip, support bsddb >= 4.7 svn: r11297 --- src/gen/db/dbdir.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gen/db/dbdir.py b/src/gen/db/dbdir.py index a856a90bc..c44d0aafb 100644 --- a/src/gen/db/dbdir.py +++ b/src/gen/db/dbdir.py @@ -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,7 +1572,8 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): transaction = BdbTransaction(msg, self.undodb, batch, no_magic) if transaction.batch: self.env.txn_checkpoint() - self.env.set_flags(db.DB_TXN_NOSYNC, 1) # async txn + 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: # Disconnect unneeded secondary indices @@ -1605,7 +1611,8 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): self.txn.commit() if transaction.batch: self.env.txn_checkpoint() - self.env.set_flags(db.DB_TXN_NOSYNC, 0) # sync txn + if db.version() < (4, 7): + self.env.set_flags(db.DB_TXN_NOSYNC, 0) # sync txn if not transaction.no_magic: # create new secondary indices to replace the ones removed @@ -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) - 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 |\