Fix bug in bsddb 4.7 by moving the NOSYNC setting before env open

svn: r16460
This commit is contained in:
Benny Malengier 2011-01-24 19:34:59 +00:00
parent 7c3bcc5f06
commit 4313de6f72

View File

@ -399,8 +399,16 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.env.set_lk_max_locks(DBLOCKS)
self.env.set_lk_max_objects(DBOBJECTS)
# Set to auto remove stale logs
self.set_auto_remove()
# Set not to flush to disk synchronous, this greatly speeds up
# database changes, but comes at the cause of loss of durability, so
# power loss might cause a need to run db recovery, see BSDDB manual
## NOTE: due to pre 4.8 bsddb bug it is needed to set this flag before
## open of env, #16492 - http://download.oracle.com/docs/cd/E17076_02/html/installation/changelog_4_8.html
self.env.set_flags(db.DB_TXN_WRITE_NOSYNC, 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 |\
@ -417,8 +425,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
except:
pass
raise DbEnvironmentError(msg)
# Set not to flush to disk synchronous
self.env.set_flags(db.DB_TXN_WRITE_NOSYNC, 1)
self.env.txn_checkpoint()
@ -1643,9 +1649,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
self.undodb.clear()
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 no_magic:
# Disconnect unneeded secondary indices
self.surnames.close()
@ -1683,8 +1686,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"""
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:
# create new secondary indices to replace the ones removed