diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4930dd827..852a650b6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-05-10 Alex Roitman + * src/GrampsDb/_DbUtils.py (db_copy): Use batch transaction. + * src/GrampsDb/_GrampsBSDDB.py (transaction_begin): Proper indentation. + 2006-05-09 Don Allingham * src/DataViews/_PersonView.py: search bar implementation * src/PeopleModel.py: search bar implementation diff --git a/gramps2/src/GrampsDb/_DbUtils.py b/gramps2/src/GrampsDb/_DbUtils.py index eabeddb5b..f94505402 100644 --- a/gramps2/src/GrampsDb/_DbUtils.py +++ b/gramps2/src/GrampsDb/_DbUtils.py @@ -193,6 +193,9 @@ def db_copy(from_db,to_db,callback): oldval = 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(): cursor_func = primary_tables[table_name]['cursor_func'] table = primary_tables[table_name]['table'] @@ -207,6 +210,9 @@ def db_copy(from_db,to_db,callback): update(callback,count,oldval,total) cursor.close() + # Commit batch transaction: does nothing, except undoing the tricks + to_db.transaction_commit(trans,"") + # The metadata is always transactionless, # and the table is small, so using key iteration is OK here. for handle in from_db.metadata.keys(): diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 5375e1cc9..021b775fc 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -1076,7 +1076,7 @@ class GrampsBSDDB(GrampsDbBase): if transaction.batch: if self.UseTXN: 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: # Disconnect unneeded secondary indices