Added re-use of the backend across the operations in the backup step.
This should fix the AmzCD consistency issue where it does not wait for the listing after performing a delete.
This commit is contained in:
@@ -606,7 +606,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_Delete);
|
||||
m_result.DeleteResults = new DeleteResults(m_result);
|
||||
using(var db = new LocalDeleteDatabase(m_database))
|
||||
new DeleteHandler(backend.BackendUrl, m_options, (DeleteResults)m_result.DeleteResults).DoRun(db, ref m_transaction, true, currentIsSmall);
|
||||
new DeleteHandler(backend.BackendUrl, m_options, (DeleteResults)m_result.DeleteResults).DoRun(db, ref m_transaction, true, currentIsSmall, backend);
|
||||
|
||||
}
|
||||
else if (currentIsSmall && !m_options.NoAutoCompact)
|
||||
@@ -614,7 +614,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
m_result.OperationProgressUpdater.UpdatePhase(OperationPhase.Backup_Compact);
|
||||
m_result.CompactResults = new CompactResults(m_result);
|
||||
using(var db = new LocalDeleteDatabase(m_database))
|
||||
new CompactHandler(backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref m_transaction);
|
||||
new CompactHandler(backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref m_transaction, backend);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
Utility.UpdateOptionsFromDb(db, m_options);
|
||||
Utility.VerifyParameters(db, m_options);
|
||||
|
||||
var changed = DoCompact(db, false, ref tr);
|
||||
var changed = DoCompact(db, false, ref tr, null);
|
||||
|
||||
if (changed && m_options.UploadVerificationFile)
|
||||
FilelistProcessor.UploadVerificationFile(m_backendurl, m_options, m_result.BackendWriter, db, null);
|
||||
@@ -83,15 +83,17 @@ namespace Duplicati.Library.Main.Operation
|
||||
}
|
||||
}
|
||||
|
||||
internal bool DoCompact(LocalDeleteDatabase db, bool hasVerifiedBackend, ref System.Data.IDbTransaction transaction)
|
||||
internal bool DoCompact(LocalDeleteDatabase db, bool hasVerifiedBackend, ref System.Data.IDbTransaction transaction, BackendManager sharedBackend)
|
||||
{
|
||||
var report = db.GetCompactReport(m_options.VolumeSize, m_options.Threshold, m_options.SmallFileSize, m_options.SmallFileMaxCount, transaction);
|
||||
report.ReportCompactData(m_result);
|
||||
|
||||
if (report.ShouldReclaim || report.ShouldCompact)
|
||||
{
|
||||
using(var backend = new BackendManager(m_backendurl, m_options, m_result.BackendWriter, db))
|
||||
{
|
||||
// Workaround where we allow a running backendmanager to be used
|
||||
using(var bk = sharedBackend == null ? new BackendManager(m_backendurl, m_options, m_result.BackendWriter, db) : null)
|
||||
{
|
||||
var backend = bk ?? sharedBackend;
|
||||
if (!hasVerifiedBackend && !m_options.NoBackendverification)
|
||||
FilelistProcessor.VerifyRemoteList(backend, m_options, db, m_result.BackendWriter);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
Utility.UpdateOptionsFromDb(db, m_options);
|
||||
Utility.VerifyParameters(db, m_options);
|
||||
|
||||
DoRun(db, ref tr, false, false);
|
||||
DoRun(db, ref tr, false, false, null);
|
||||
|
||||
if (!m_options.Dryrun)
|
||||
{
|
||||
@@ -73,10 +73,13 @@ namespace Duplicati.Library.Main.Operation
|
||||
}
|
||||
}
|
||||
|
||||
public void DoRun(Database.LocalDeleteDatabase db, ref System.Data.IDbTransaction transaction, bool hasVerifiedBacked, bool forceCompact)
|
||||
{
|
||||
using(var backend = new BackendManager(m_backendurl, m_options, m_result.BackendWriter, db))
|
||||
public void DoRun(Database.LocalDeleteDatabase db, ref System.Data.IDbTransaction transaction, bool hasVerifiedBacked, bool forceCompact, BackendManager sharedManager)
|
||||
{
|
||||
// Workaround where we allow a running backendmanager to be used
|
||||
using(var bk = sharedManager == null ? new BackendManager(m_backendurl, m_options, m_result.BackendWriter, db) : null)
|
||||
{
|
||||
var backend = bk ?? sharedManager;
|
||||
|
||||
if (!hasVerifiedBacked && !m_options.NoBackendverification)
|
||||
FilelistProcessor.VerifyRemoteList(backend, m_options, db, m_result.BackendWriter);
|
||||
|
||||
@@ -142,7 +145,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
if (!m_options.NoAutoCompact && (forceCompact || (toDelete != null && toDelete.Length > 0)))
|
||||
{
|
||||
m_result.CompactResults = new CompactResults(m_result);
|
||||
new CompactHandler(m_backendurl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref transaction);
|
||||
new CompactHandler(m_backendurl, m_options, (CompactResults)m_result.CompactResults).DoCompact(db, true, ref transaction, sharedManager);
|
||||
}
|
||||
|
||||
m_result.SetResults(
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
opts.RawOptions["no-auto-compact"] = "true";
|
||||
|
||||
new DeleteHandler(m_backendurl, opts, (DeleteResults)m_result.DeleteResults)
|
||||
.DoRun(rmdb, ref deltr, true, false);
|
||||
.DoRun(rmdb, ref deltr, true, false, null);
|
||||
|
||||
if (!m_options.Dryrun)
|
||||
{
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Duplicati.Library.Main.Operation
|
||||
var tr = cdb.BeginTransaction();
|
||||
try
|
||||
{
|
||||
new CompactHandler(backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(cdb, true, ref tr);
|
||||
new CompactHandler(backend.BackendUrl, m_options, (CompactResults)m_result.CompactResults).DoCompact(cdb, true, ref tr, backend);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user