* 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
This commit is contained in:
Alex Roitman 2006-01-16 22:07:24 +00:00
parent f9b6172435
commit cc83b089cf
3 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2006-01-16 Alex Roitman <shura@gramps-project.org>
* 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 <Martin.Hawlisch@gmx.de> 2006-01-16 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/PedView.py: Edit on doublecklick; only right click gives * src/PedView.py: Edit on doublecklick; only right click gives
optionsmenu; Colors similar to tango icons optionsmenu; Colors similar to tango icons

View File

@ -258,6 +258,7 @@ class GrampsBSDDB(GrampsDbBase):
self.env.set_cachesize(0,0x2000000) # 2MB self.env.set_cachesize(0,0x2000000) # 2MB
self.env.set_lk_max_locks(10000) # 10K locks self.env.set_lk_max_locks(10000) # 10K locks
self.env.set_lk_max_objects(10000) # 10K lock objects 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 # The DB_PRIVATE flag must go if we ever move to multi-user setup
env_flags = db.DB_CREATE|db.DB_PRIVATE|\ env_flags = db.DB_CREATE|db.DB_PRIVATE|\
db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\ db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\
@ -682,7 +683,9 @@ class GrampsBSDDB(GrampsDbBase):
return return
if transaction.batch: 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: else:
transaction.add(REFERENCE_KEY,str(key),None,data) transaction.add(REFERENCE_KEY,str(key),None,data)
transaction.reference_add.append((str(key),data)) transaction.reference_add.append((str(key),data))
@ -834,10 +837,11 @@ class GrampsBSDDB(GrampsDbBase):
def set_name_group_mapping(self,name,group): def set_name_group_mapping(self,name,group):
if not self.readonly: if not self.readonly:
name = str(name) name = str(name)
if not group and self.name_group.has_key(name): data = self.name_group.get(name,txn=self.txn)
self.name_group.delete(name) if not group and data:
self.name_group.delete(name,txn=self.txn)
else: else:
self.name_group[name] = group self.name_group.put(name,group,txn=self.txn)
self.emit('person-rebuild') self.emit('person-rebuild')
def get_surname_list(self): def get_surname_list(self):
@ -910,7 +914,9 @@ class GrampsBSDDB(GrampsDbBase):
handle = str(obj.handle) handle = str(obj.handle)
if transaction.batch: 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 old_data = None
else: else:
old_data = data_map.get(handle,txn=self.txn) old_data = data_map.get(handle,txn=self.txn)
@ -1043,13 +1049,13 @@ class GrampsBSDDB(GrampsDbBase):
transaction_commit function of the this database object. transaction_commit function of the this database object.
""" """
# Start BSD DB transaction -- DBTxn
self.txn = self.env.txn_begin()
return BdbTransaction(msg,self.undodb) return BdbTransaction(msg,self.undodb)
def transaction_commit(self,transaction,msg): def transaction_commit(self,transaction,msg):
# Start BSD DB transaction -- DBTxn
self.txn = self.env.txn_begin()
GrampsDbBase.transaction_commit(self,transaction,msg) GrampsDbBase.transaction_commit(self,transaction,msg)
for (key,data) in transaction.reference_add: for (key,data) in transaction.reference_add:

View File

@ -772,9 +772,6 @@ class ViewManager:
self.setup_bookmarks() 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 self.state.db.need_upgrade():
if callback: if callback:
callback(_('Upgrading database...')) callback(_('Upgrading database...'))