IStateProvider.OnDataLossAsync(CancellationToken) 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.

public System.Threading.Tasks.Task<bool> OnDataLossAsync (System.Threading.CancellationToken cancellationToken);
abstract member OnDataLossAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function OnDataLossAsync (cancellationToken As CancellationToken) As Task(Of Boolean)

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 the state provider as part of processing this notification has changed its state

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