diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2020-11-30 01:30:05 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2020-12-01 06:55:20 +0300 |
commit | 9952babf0bf52c0fa88894b156329bd1441abe72 (patch) | |
tree | ffb9b8f71f9e5c536e2e018ae90b59e9e64fd73b /Duplicati/Library | |
parent | 1c3065aa814d6253ed033d3584c7171708fc9bf0 (diff) |
Commit or rollback transaction before beginning new ones.
The PurgeFilesHandler begins new transactions using the same database
connection. During a dry-run, these transactions are rolled back, and a
subsequent attempt to rollback in the PurgeBrokenFilesHandler then
resulted in an exception.
To avoid this, we perform the rollback in the PurgeBrokenFilesHandler as
soon as we can.
I'm not entirely confident that this is the correct fix, but it appears
to resolve issue #4379.
This fixes #4379.
Diffstat (limited to 'Duplicati/Library')
-rw-r--r-- | Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs b/Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs index 7458477c1..e90a44070 100644 --- a/Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs +++ b/Duplicati/Library/Main/Operation/PurgeBrokenFilesHandler.cs @@ -85,6 +85,11 @@ namespace Duplicati.Library.Main.Operation SetCount = db.GetFilesetFileCount(x.Item2, tr)
}).ToArray();
+ if (m_options.Dryrun)
+ tr.Rollback();
+ else
+ tr.Commit();
+
var fully_emptied = compare_list.Where(x => x.RemoveCount == x.SetCount).ToArray();
var to_purge = compare_list.Where(x => x.RemoveCount != x.SetCount).ToArray();
@@ -167,11 +172,6 @@ namespace Duplicati.Library.Main.Operation }
}
- if (m_options.Dryrun)
- tr.Rollback();
- else
- tr.Commit();
-
m_result.OperationProgressUpdater.UpdateProgress(0.95f);
if (!m_options.Dryrun && db.RepairInProgress)
|