Fix error when opening bsddb db in read-only mode (#624)
Fixes #10615 BSDDB had errors when trying to open in read-only mode.
This commit is contained in:
parent
31eecac590
commit
21408ab9d2
@ -619,9 +619,9 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
|
||||
# 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_LOG | db.DB_INIT_TXN
|
||||
|
||||
db.DB_INIT_MPOOL
|
||||
if not self.readonly:
|
||||
env_flags |= db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||
# As opposed to before, we always try recovery on databases
|
||||
env_flags |= db.DB_RECOVER
|
||||
|
||||
@ -638,6 +638,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
pass
|
||||
raise DbEnvironmentError(msg)
|
||||
|
||||
if not self.readonly:
|
||||
self.env.txn_checkpoint()
|
||||
|
||||
if callback:
|
||||
@ -1330,6 +1331,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
return
|
||||
if self.txn:
|
||||
self.transaction_abort(self.transaction)
|
||||
if not self.readonly:
|
||||
self.env.txn_checkpoint()
|
||||
|
||||
self.__close_metadata()
|
||||
|
Loading…
Reference in New Issue
Block a user