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.


svn: r5768
This commit is contained in:
Alex Roitman 2006-01-16 22:49:49 +00:00
parent e3395609b1
commit c09e8ba99d
3 changed files with 17 additions and 6 deletions

View File

@ -1,7 +1,11 @@
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.
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 <Martin.Hawlisch@gmx.de>
* src/PedView.py: Edit on doublecklick; only right click gives

View File

@ -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 = {

View File

@ -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')