Share via


VolatileActorStateProvider.IStateProvider.OnDataLossAsync Method

Definition

Indicates that a write quorum of replicas in this replica set has been lost, and that therefore data loss might have occurred. The replica set consists of a majority of replicas, which includes the Primary replica.

System.Threading.Tasks.Task<bool> IStateProvider.OnDataLossAsync (System.Threading.CancellationToken cancellationToken);
abstract member System.Fabric.IStateProvider.OnDataLossAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.System.Fabric.IStateProvider.OnDataLossAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Function OnDataLossAsync (cancellationToken As CancellationToken) As Task(Of Boolean) Implements IStateProvider.OnDataLossAsync

Parameters

cancellationToken
CancellationToken

The CancellationToken object that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation might still be completed even if it is canceled.

Returns

Returns Task<TResult> of type Boolean, that indicates whether state changed. When it changed, the method returns true or when it did not change, the method returns false.

Implements

Remarks

When the Service Fabric runtime observes the failure of a quorum of replicas, which includes the Primary replica, it elects a new Primary replica and immediately calls this method on the new Primary replica. A Primary replica that is informed of possible data loss can choose to restore its state from some external data source or can continue to run with the state that it currently has. If the service continues to run with its current state, it should return false from this method, which indicates that no state change has been made. If it has restored or altered its state, such as rolling back incomplete work, it should return true. If true is returned, then the state in other replicas must be assumed to be incorrect. Therefore, the Service Fabric runtime removes the other replicas from the replica set and recreates them.

Applies to