I have a Stateful Service with backup logic implemented according to the corresponding documentation
Just like so:
protected override async Task RunAsync(CancellationToken cancellationToken)
{
// ...
while (true)
{
cancellationToken.ThrowIfCancellationRequested();
BackupDescription myBackupDescription = new BackupDescription(BackupOption.Full, this.BackupCallbackAsync);
await this.BackupAsync(myBackupDescription);
// ...
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
}
}
private async Task<bool> BackupCallbackAsync(BackupInfo backupInfo, CancellationToken cancellationToken)
{
var backupId = Guid.NewGuid();
// backup files copied to external storage here ...
return true;
}
Documentation suggests only one way to restore backups - with OnDataLossAsync
method. But I cannot provoke an invocation of this mehtod.
So, the question is: how may I restore the service state from my backup in case of full data loss?
For example, all the service fabric cluster nodes have been destroyed. The only thing I have is my backup. What should I do after redeployment to restore my services' state?
I checked Data
and Log
directories of Service Fabric cluster manager, but data format seems to be different comparing to the backup.