问题描述:

I have Backup and Restore implemented with service fabric.

My backups go into folders on azure with time stamp and the service name.

At the moment I just search the latest backup, but what if I want to restore to an older version?

I invoke the data loss using

 await fabricClient.TestManager.StartPartitionDataLossAsync(operationId, partitionSelector, DataLossMode.FullDataLoss);

This triggers the data loss here.

protected override async Task<bool> OnDataLossAsync(RestoreContext restoreCtx, CancellationToken cancellationToken)

{

await this.SetupBackupManager(null);

try

{

string backupFolder = await this.backupManager.RestoreLatestBackupToTempLocation(cancellationToken);

RestoreDescription restoreRescription = new RestoreDescription(backupFolder, RestorePolicy.Force);

await restoreCtx.RestoreAsync(restoreRescription, cancellationToken);

DirectoryInfo tempRestoreDirectory = new DirectoryInfo(backupFolder);

tempRestoreDirectory.Delete(true);

return true;

}

catch (Exception e)

{

throw;

}

}

I have my code in my backup manager to handle it, but I can't think/find a way to pass anything to OnDataLossAsync.

RestoreLatestBackupToTempLocation finds the latest backup.

相关阅读:
Top