diff --git a/ChangeLog b/ChangeLog index 18d98a019..b1d98234e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ 2006-01-16 Alex Roitman * src/ViewManager: Remov unused code. * src/GrampsDb/_GrampsBSDDB.py: Do small txn during batch - transaction; set db.DB_TXN_NOSYNC flag on an environment. + transaction; set db.DB_TXN_NOSYNC flag on an environment; + Remove lock limits; set db.DB_LOG_AUTOREMOVE flag; add checkpoints + on: open, batch transaction start and end; close. + * src/GrampsDb/_GrampsDbBase.py (change_database, no_database): + close existing db before changing to the new one. 2006-01-16 Martin Hawlisch * src/PedView.py: Edit on doublecklick; only right click gives diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 1596085b6..d8dd0122b 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -253,12 +253,11 @@ class GrampsBSDDB(GrampsDbBase): self.readonly = mode == "r" callback(0.25) - + self.env = db.DBEnv() - self.env.set_cachesize(0,0x2000000) # 2MB - self.env.set_lk_max_locks(10000) # 10K locks - self.env.set_lk_max_objects(10000) # 10K lock objects - self.env.set_flags(db.DB_TXN_NOSYNC,1) + self.env.set_cachesize(0,0x2000000) # 2MB + self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn + 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_PRIVATE|\ db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\ @@ -269,6 +268,7 @@ class GrampsBSDDB(GrampsDbBase): if not os.path.isdir(env_name): os.mkdir(env_name) self.env.open(env_name,env_flags) + self.env.txn_checkpoint() self.full_name = os.path.abspath(name) self.brief_name = os.path.basename(name) @@ -783,6 +783,7 @@ class GrampsBSDDB(GrampsDbBase): self.pid_trans.close() self.reference_map_primary_map.close() self.reference_map_referenced_map.close() + self.env.txn_checkpoint() self.env.close() if not self.readonly: @@ -1066,6 +1067,8 @@ class GrampsBSDDB(GrampsDbBase): # Commit BSD DB transaction -- DBTxn self.txn.commit() + if transaction.batch: + self.env.txn_checkpoint() self.txn = None def undo(self): @@ -1476,6 +1479,8 @@ class BdbTransaction(Transaction): Transaction.__init__(self,msg,db) self.reference_del = [] self.reference_add = [] + if self.batch: + self.env.txn_checkpoint() _attribute_conversion_9 = { diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index c67c341ec..39285e7a0 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -1885,11 +1885,13 @@ class DbState(GrampsDBCallback): return self.active def change_database(self,db): + self.db.close() self.db = db self.open = True self.emit('database-changed',(self.db,)) def no_database(self): + self.db.close() self.db = GrampsDbBase() self.open = False self.emit('no-database')