Fixes to allow log cleanup
svn: r15803
This commit is contained in:
parent
32f9ff1863
commit
b3929af419
@ -1659,25 +1659,20 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
BSDDB change log settings using new method with renamed attributes
|
BSDDB change log settings using new method with renamed attributes
|
||||||
"""
|
"""
|
||||||
if db.version() < (4, 7):
|
autoremove_flag = None
|
||||||
# by the book: old method with old attribute
|
autoremove_method = None
|
||||||
self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1)
|
for flag in ["DB_LOG_AUTO_REMOVE", "DB_LOG_AUTOREMOVE"]:
|
||||||
else: # look at python interface
|
if hasattr(db, flag):
|
||||||
# TODO test with new version of pybsddb
|
autoremove_flag = getattr(db, flag)
|
||||||
try:
|
break
|
||||||
# try numeric compare, just first 2 digits
|
for method in ["log_set_config", "set_flags"]:
|
||||||
# this won't work with something like "4.10a", but
|
if hasattr(self.env, method):
|
||||||
# hopefully they won't do that
|
autoremove_method = getattr(self.env, method)
|
||||||
old_version = map(int, db.__version__.split(".",2)[:2]) < (4, 7)
|
break
|
||||||
except:
|
if autoremove_method and autoremove_flag:
|
||||||
# fallback, weak string compare
|
autoremove_method(autoremove_flag, 1)
|
||||||
old_version = db.__version__ < "4.7"
|
else:
|
||||||
if old_version:
|
_LOG.debug("Failed to set autoremove flag")
|
||||||
# undocumented: old method with new attribute
|
|
||||||
self.env.set_flags(db.DB_LOG_AUTO_REMOVE, 1)
|
|
||||||
else:
|
|
||||||
# by the book: new method with new attribute
|
|
||||||
self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1)
|
|
||||||
|
|
||||||
def write_version(self, name):
|
def write_version(self, name):
|
||||||
"""Write version number for a newly created DB."""
|
"""Write version number for a newly created DB."""
|
||||||
@ -1699,7 +1694,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
||||||
|
|
||||||
# As opposed to before, we always try recovery on databases
|
# As opposed to before, we always try recovery on databases
|
||||||
env_flags = env_flags | db.DB_RECOVER
|
env_flags |= db.DB_RECOVER
|
||||||
|
|
||||||
# Environment name is now based on the filename
|
# Environment name is now based on the filename
|
||||||
env_name = name
|
env_name = name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user