From 2caf3dd35a9570f34588fc4fb6c713984cd2514e Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 15 Jun 2007 04:35:59 +0000 Subject: [PATCH] 2007-06-14 Don Allingham * src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore svn: r8554 --- ChangeLog | 3 +++ src/GrampsDbUtils/_Backup.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eeca8753e..09c382a9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-06-14 Don Allingham + * src/GrampsDbUtils/_Backup.py (__do_restore): use transactions during restore + 2007-06-14 Brian Matherly * src/docgen/SvgDrawDoc.py: improve text rendering (#0001072) diff --git a/src/GrampsDbUtils/_Backup.py b/src/GrampsDbUtils/_Backup.py index d1478bcba..c1a4cf91a 100644 --- a/src/GrampsDbUtils/_Backup.py +++ b/src/GrampsDbUtils/_Backup.py @@ -125,9 +125,19 @@ def __do_restore(database): try: while True: data = pickle.load(backup_table) - tbl[data[0]] = data[1] + if database.UseTXN: + txn = database.env.txn_begin() + else: + txn = None + tbl.put(data[0], data[1], txn=txn) + if txn: + txn.commit() except EOFError: + if not database.UseTXN: + tbl.sync() + backup_table.close() + database.rebuild_secondary() def __build_tbl_map(database):