다음을 통해 공유


VolatileActorStateProvider.IStateProvider.UpdateEpochAsync Method

Definition

Indicates to a replica that the configuration of a replica set has changed due to a change or attempted change to the Primary replica. The change occurs due to failure or load balancing of the previous Primary replica. Epoch changes act as a barrier by segmenting operations into the exact configuration periods in which they were sent by a specific Primary replica.

System.Threading.Tasks.Task IStateProvider.UpdateEpochAsync (System.Fabric.Epoch epoch, long previousEpochLastSequenceNumber, System.Threading.CancellationToken cancellationToken);
abstract member System.Fabric.IStateProvider.UpdateEpochAsync : System.Fabric.Epoch * int64 * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.System.Fabric.IStateProvider.UpdateEpochAsync : System.Fabric.Epoch * int64 * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Function UpdateEpochAsync (epoch As Epoch, previousEpochLastSequenceNumber As Long, cancellationToken As CancellationToken) As Task Implements IStateProvider.UpdateEpochAsync

Parameters

epoch
Epoch

The new Epoch.

previousEpochLastSequenceNumber
Int64

The maximum sequence number (LSN) that should have been observed in the previous epoch.

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.

Implements

Remarks

This method is called because the Primary replica of the replica set has changed, or a change was attempted. Secondary replicas receive this method either when they are about to become the new Primary replica, or, if they are not the new Primary replica, they receive it when they attempt to get the first operation from the new Primary replica from the replication stream. Primary replicas might occasionally receive this method if there is an attempt to swap the Primary replica, which fails.

The information in the UpdateEpochAsync(Epoch, Int64, CancellationToken) method enables the service to maintain a progress vector, which is a list of each epoch that the replica has received, and the maximum LSN that they contained. The progress vector data along with the current applied maximum LSN is useful for a Secondary replica to send during the copy operation to describe how far the operation has progressed. Comparing progress vectors that are received from Secondary replicas during the copy operation enables Primary replicas to determine whether the Secondary replica is up-to-date, what state must be sent to the Secondary replica, and whether the Secondary replica has made false progress. False progress means that an LSN in a previous epoch was greater than the LSN that the Primary replica receives.

Applies to