RestoreContext.RestoreAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
RestoreAsync(RestoreDescription) |
Restores a backup described by RestoreDescription. |
RestoreAsync(RestoreDescription, CancellationToken) |
Restore a backup described by RestoreDescription. |
RestoreAsync(RestoreDescription)
Restores a backup described by RestoreDescription.
public System.Threading.Tasks.Task RestoreAsync (Microsoft.ServiceFabric.Data.RestoreDescription restoreDescription);
member this.RestoreAsync : Microsoft.ServiceFabric.Data.RestoreDescription -> System.Threading.Tasks.Task
Public Function RestoreAsync (restoreDescription As RestoreDescription) As Task
Parameters
- restoreDescription
- RestoreDescription
Description for the restore request.
Returns
Task that represents the asynchronous restore operation.
Exceptions
Indicates that the input backup folder does not contain a full backup. For a backup folder to be restorable, it must contain exactly one full backup and any number of incremental backups.
Indicates that one of the arguments is not valid. For example, when restoring a Reliable Service if RestorePolicy is set to Safe, but the input backup folder contains a version of the state that is older than the state maintained in the current replica.
When restoring an Actor Service this exception is thrown if specified BackupFolderPath is empty.
Indicates that the supplied restore directory does not exist.
Indicates that the replica is closing.
Indicates that current restore operation is not valid. For example, the ServicePartitionKind of the partition from where backup was taken is different than that of current partition being restored.
Indicates the expected backup files under the supplied restore directory is not found.
Indicates either the restore operation encountered an unexpected error or the backup files in restore directory are not valid. The ErrorCode property indicates the type of error that occurred.
- InvalidBackup: Indicates that the backup files supplied in the restore directory are either missing files or have extra unexpected files.
- InvalidRestoreData: Indicates that metadata files (restore.dat) present in restore directory is either corrupt or contains invalid information.
- InvalidBackupChain: Indicates that the backup chain (i.e. one full backup and zero or more contiguous incremental backups that were taken after it) supplied in the restore directory is broken.
- DuplicateBackups: Indicates that the backup chain (i.e. one full backup and zero or more contiguous incremental backups that were taken after it) supplied in the restore directory contains duplicate backups.
- RestoreSafeCheckFailed: If Safe is specified as part of RestoreDescription, it indicates that the backup provided for restore has older data than currently present in service.
Remarks
This API must be called from OnDataLossAsync method. Only one RestoreAsync API can be inflight per replica at any given point of time.
Note that exceptions thrown by this API differ depending on of underlying state provider. The exceptions that are currently documented for this API applies only to out-of-box state providers provided by Service Fabric for Reliable Services and Reliable Actors.
Following exceptions are thrown by this API when invoked in Reliable Service:
Following exceptions are thrown by this API when invoked in Actor Service with KvsActorStateProvider as its state provider (which is the default state provider for Reliable Actors):
- ArgumentException
- DirectoryNotFoundException
- FabricObjectClosedException
- InvalidOperationException
- FileNotFoundException
- FabricException
Applies to
RestoreAsync(RestoreDescription, CancellationToken)
Restore a backup described by RestoreDescription.
public System.Threading.Tasks.Task RestoreAsync (Microsoft.ServiceFabric.Data.RestoreDescription restoreDescription, System.Threading.CancellationToken cancellationToken);
member this.RestoreAsync : Microsoft.ServiceFabric.Data.RestoreDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function RestoreAsync (restoreDescription As RestoreDescription, cancellationToken As CancellationToken) As Task
Parameters
- restoreDescription
- RestoreDescription
Description for the restore request.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests.
Returns
Task that represents the asynchronous restore operation.
Exceptions
Indicates that the input backup folder does not contain a full backup. For a backup folder to be restorable, it must contain exactly one full backup and any number of incremental backups.
Indicates that one of the arguments is not valid. For example, when restoring a Reliable Service if RestorePolicy is set to Safe, but the input backup folder contains a version of the state that is older than the state maintained in the current replica.
When restoring an Actor Service this exception is thrown if specified BackupFolderPath is empty.
Indicates that the supplied restore directory does not exist.
Indicates that the replica is closing.
Indicates that current restore operation is not valid. For example, the ServicePartitionKind of the partition from where backup was taken is different than that of current partition being restored.
Indicates the expected backup files under the supplied restore directory is not found.
Indicates either the restore operation encountered an unexpected error or the backup files in restore directory are not valid. The ErrorCode property indicates the type of error that occurred.
- InvalidBackup: Indicates that the backup files supplied in the restore directory are either missing files or have extra unexpected files.
- InvalidRestoreData: Indicates that metadata files (restore.dat) present in restore directory is either corrupt or contains invalid information.
- InvalidBackupChain: Indicates that the backup chain (i.e. one full backup and zero or more contiguous incremental backups that were taken after it) supplied in the restore directory is broken.
- DuplicateBackups: Indicates that the backup chain (i.e. one full backup and zero or more contiguous incremental backups that were taken after it) supplied in the restore directory contains duplicate backups.
- RestoreSafeCheckFailed: If Safe is specified as part of RestoreDescription, it indicates that the backup provided for restore has older data than currently present in service.
Remarks
This API must be called from OnDataLossAsync method. Only one RestoreAsync API can be inflight per replica at any given point of time.
Note that exceptions thrown by this API differ depending on of underlying state provider. The exceptions that are currently documented for this API applies only to out-of-box state providers provided by Service Fabric for Reliable Services and Reliable Actors.
Following exceptions are thrown by this API when invoked in Reliable Service:
Following exceptions are thrown by this API when invoked in Actor Service with KvsActorStateProvider as its state provider (which is the default state provider for Reliable Actors):
- ArgumentException
- DirectoryNotFoundException
- FabricObjectClosedException
- InvalidOperationException
- FileNotFoundException
- FabricException