VolatileActorStateProvider.updateEpochAsync(Epoch epoch, SequenceNumber previousEpochLastSequenceNumber, CancellationToken cancellationToken) 方法

定义

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.

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 epoch, SequenceNumber previousEpochLastSequenceNumber, CancellationToken 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.

public CompletableFuture<?> updateEpochAsync(Epoch epoch, SequenceNumber previousEpochLastSequenceNumber, CancellationToken cancellationToken)

参数

epoch
Epoch

The new Epoch.

previousEpochLastSequenceNumber
SequenceNumber

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

cancellationToken
CancellationToken

CancellationToken object to indicate the cancellation status of the operation.

返回

CompletableFuture<?>

Returns Task.

替代

适用于