2006-11-26 Alex Roitman <shura@gramps-project.org>

* src/GrampsDb/_GrampsBSDDB.py (load): Clean env for a new grdb
	file; do not attempt recovery for a new grdb file.
	* NEWS: Typo.



svn: r7707
This commit is contained in:
Alex Roitman 2006-11-26 19:47:34 +00:00
parent e64d32ebda
commit edf249ffd6
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-11-26 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (load): Clean env for a new grdb
file; do not attempt recovery for a new grdb file.
* NEWS: Typo.
2006-11-26 Don Allingham <don@gramps-project.org>
* src/docgen/ODFDoc.py: fix registration

View File

@ -348,9 +348,12 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
self.env.set_flags(db.DB_LOG_AUTOREMOVE,1) # clean up unused logs
# The DB_PRIVATE flag must go if we ever move to multi-user setup
env_flags = db.DB_CREATE|db.DB_RECOVER|db.DB_PRIVATE|\
env_flags = db.DB_CREATE|db.DB_PRIVATE|\
db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\
db.DB_INIT_LOG|db.DB_INIT_TXN|db.DB_THREAD
# Only do recovery for existing databases
if os.path.isfile(self.full_name):
env_flags = env_flags | db.DB_RECOVER
# Environment name is now based on the filename
env_name = os.path.join(os.path.expanduser(const.env_dir),
@ -367,6 +370,13 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
if os.path.isdir(common_env_name):
shutil.rmtree(env_name)
shutil.copytree(common_env_name,env_name)
else:
# For existing env and new database, clean the env
# (means the env dir remains from previous db
# with the same name)
if not os.path.isfile(self.full_name):
shutil.rmtree(env_name)
os.mkdir(env_name)
else:
env_flags = db.DB_CREATE|db.DB_PRIVATE|db.DB_INIT_MPOOL