* src/GrampsDb/_DbUtils.py (db_copy): Use batch transaction.

* src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Proper indentation.


svn: r6606
This commit is contained in:
Alex Roitman 2006-05-10 14:23:38 +00:00
parent e81ba544cb
commit 1e3b85f27f
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-05-10 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_DbUtils.py (db_copy): Use batch transaction.
* src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Proper indentation.
2006-05-09 Don Allingham <don@gramps-project.org> 2006-05-09 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: search bar implementation * src/DataViews/_PersonView.py: search bar implementation
* src/PeopleModel.py: search bar implementation * src/PeopleModel.py: search bar implementation

View File

@ -193,6 +193,9 @@ def db_copy(from_db,to_db,callback):
oldval = 0 oldval = 0
count = 0 count = 0
# Start batch transaction to use async TXN and other tricks
trans = to_db.transaction_begin("",batch=True)
for table_name in primary_tables.keys(): for table_name in primary_tables.keys():
cursor_func = primary_tables[table_name]['cursor_func'] cursor_func = primary_tables[table_name]['cursor_func']
table = primary_tables[table_name]['table'] table = primary_tables[table_name]['table']
@ -207,6 +210,9 @@ def db_copy(from_db,to_db,callback):
update(callback,count,oldval,total) update(callback,count,oldval,total)
cursor.close() cursor.close()
# Commit batch transaction: does nothing, except undoing the tricks
to_db.transaction_commit(trans,"")
# The metadata is always transactionless, # The metadata is always transactionless,
# and the table is small, so using key iteration is OK here. # and the table is small, so using key iteration is OK here.
for handle in from_db.metadata.keys(): for handle in from_db.metadata.keys():

View File

@ -1076,7 +1076,7 @@ class GrampsBSDDB(GrampsDbBase):
if transaction.batch: if transaction.batch:
if self.UseTXN: if self.UseTXN:
self.env.txn_checkpoint() self.env.txn_checkpoint()
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
if self.secondary_connected and not transaction.no_magic: if self.secondary_connected and not transaction.no_magic:
# Disconnect unneeded secondary indices # Disconnect unneeded secondary indices