Class TriangleOrderManager
java.lang.Object
org.infinispan.distribution.TriangleOrderManager
It manages the order of updates from the primary owner to backup owner.
It depends on the cache topology id. The primary owner assigns the sequence number to the backup command and then sends it to the backup owner. In the backup owner, the command awaits until it is its turn to be executed.
If the command topology id does not match, it throws an OutdatedTopologyException.
The sequence order starts with 1 and it is per segment based. This allows segments to be updated concurrently.
- Since:
- 9.0
- Author:
- Pedro Ruivo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisNext(int segmentId, long sequenceNumber, int commandTopologyId) longlatestSent(int segmentId, int topologyId) Meant for testing only.voidmarkDelivered(int segmentId, long sequenceNumber, int commandTopologyId) longnext(int segmentId, int commandTopologyId) Returns the next sequence number ofsegmentIdfor the topologycommandTopologyId.
-
Constructor Details
-
TriangleOrderManager
public TriangleOrderManager(int segments)
-
-
Method Details
-
next
public long next(int segmentId, int commandTopologyId) Returns the next sequence number ofsegmentIdfor the topologycommandTopologyId.The topology is checked before the sequence number is taken. Once this method returns, the sequence number is consumed and the backups wait for it until they install a newer topology. The caller must send a backup write or a
BackupNoopCommandwith it, even if a later topology check fails.- Throws:
org.infinispan.statetransfer.OutdatedTopologyException- if the topology id of the command is not the current one, or is older than the one of the last sequence number taken for the segment.
-
isNext
public boolean isNext(int segmentId, long sequenceNumber, int commandTopologyId) -
markDelivered
public void markDelivered(int segmentId, long sequenceNumber, int commandTopologyId) -
latestSent
public long latestSent(int segmentId, int topologyId) Meant for testing only.- Returns:
- The latest sequence number sent for segment
segmentIdin topologytopologyId.
-