StateProvider.onDataLossAsync(CancellationToken cancellationToken) 方法


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.

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.

public CompletableFuture<Boolean> onDataLossAsync(CancellationToken cancellationToken)



CancellationToken object to indicate the cancellation status of the operation.



Returns CompletableFuture of type java.lang.Boolean, that indicates whether the state provider as part of processing this notification has changed its state