From e3395609b1b2c31839eb326ea65629ed9991dea3 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 16 Jan 2006 22:07:24 +0000 Subject: [PATCH] * src/ViewManager: Remov unused code. * src/GrampsDb/_GrampsBSDDB.py: Do small txn during batch transaction; set db.DB_TXN_NOSYNC flag on an environment. svn: r5767 --- ChangeLog | 5 +++++ src/GrampsDb/_GrampsBSDDB.py | 22 ++++++++++++++-------- src/ViewManager.py | 3 --- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f1373bc7..18d98a019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +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. + 2006-01-16 Martin Hawlisch * src/PedView.py: Edit on doublecklick; only right click gives optionsmenu; Colors similar to tango icons diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 80121fea3..1596085b6 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -258,6 +258,7 @@ class GrampsBSDDB(GrampsDbBase): 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) # 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|\ @@ -682,7 +683,9 @@ class GrampsBSDDB(GrampsDbBase): return if transaction.batch: - self.reference_map.put(str(key),data,txn=self.txn) + the_txn = self.env.txn_begin() + self.reference_map.put(str(key),data,txn=the_txn) + the_txn.commit() else: transaction.add(REFERENCE_KEY,str(key),None,data) transaction.reference_add.append((str(key),data)) @@ -834,10 +837,11 @@ class GrampsBSDDB(GrampsDbBase): def set_name_group_mapping(self,name,group): if not self.readonly: name = str(name) - if not group and self.name_group.has_key(name): - self.name_group.delete(name) + data = self.name_group.get(name,txn=self.txn) + if not group and data: + self.name_group.delete(name,txn=self.txn) else: - self.name_group[name] = group + self.name_group.put(name,group,txn=self.txn) self.emit('person-rebuild') def get_surname_list(self): @@ -910,7 +914,9 @@ class GrampsBSDDB(GrampsDbBase): handle = str(obj.handle) if transaction.batch: - data_map.put(handle,obj.serialize(),txn=self.txn) + the_txn = self.env.txn_begin() + data_map.put(handle,obj.serialize(),txn=the_txn) + the_txn.commit() old_data = None else: old_data = data_map.get(handle,txn=self.txn) @@ -1043,13 +1049,13 @@ class GrampsBSDDB(GrampsDbBase): transaction_commit function of the this database object. """ - # Start BSD DB transaction -- DBTxn - self.txn = self.env.txn_begin() - return BdbTransaction(msg,self.undodb) def transaction_commit(self,transaction,msg): + # Start BSD DB transaction -- DBTxn + self.txn = self.env.txn_begin() + GrampsDbBase.transaction_commit(self,transaction,msg) for (key,data) in transaction.reference_add: diff --git a/src/ViewManager.py b/src/ViewManager.py index c4e399fe6..935c6e61f 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -772,9 +772,6 @@ class ViewManager: self.setup_bookmarks() - #self.state.db.set_undo_callback(self.undo_callback) - #self.state.db.set_redo_callback(self.redo_callback) - if self.state.db.need_upgrade(): if callback: callback(_('Upgrading database...'))