Package org.elasticsearch.index.seqno
Class SequenceNumbers
java.lang.Object
org.elasticsearch.index.seqno.SequenceNumbers
A utility class for handling sequence numbers.
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringstatic longRepresents no operations have been performed on the shard.static longRepresents an unassigned primary term (e.g., when a primary shard was not yet allocated)static longRepresents an unassigned sequence number (e.g., can be used on primary operations before they are executed).
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic SequenceNumbers.CommitInfoloadSeqNoInfoFromLuceneCommit(Iterable<Map.Entry<String,String>> commitData)Reads the sequence number stats from the commit data (maximum sequence number and local checkpoint).static longmax(long maxSeqNo, long seqNo)Compute the maximum of the given current maximum sequence number and the specified sequence number, accounting for the fact that the current maximum sequence number could beNO_OPS_PERFORMEDorUNASSIGNED_SEQ_NO.static longmin(long minSeqNo, long seqNo)Compute the minimum of the given current minimum sequence number and the specified sequence number, accounting for the fact that the current minimum sequence number could beNO_OPS_PERFORMEDorUNASSIGNED_SEQ_NO.
- 
Field Details- 
LOCAL_CHECKPOINT_KEY- See Also:
- Constant Field Values
 
- 
MAX_SEQ_NO- See Also:
- Constant Field Values
 
- 
UNASSIGNED_SEQ_NOpublic static final long UNASSIGNED_SEQ_NORepresents an unassigned sequence number (e.g., can be used on primary operations before they are executed).- See Also:
- Constant Field Values
 
- 
NO_OPS_PERFORMEDpublic static final long NO_OPS_PERFORMEDRepresents no operations have been performed on the shard. Initial value of a sequence number.- See Also:
- Constant Field Values
 
- 
UNASSIGNED_PRIMARY_TERMpublic static final long UNASSIGNED_PRIMARY_TERMRepresents an unassigned primary term (e.g., when a primary shard was not yet allocated)- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
SequenceNumberspublic SequenceNumbers()
 
- 
- 
Method Details- 
loadSeqNoInfoFromLuceneCommitpublic static SequenceNumbers.CommitInfo loadSeqNoInfoFromLuceneCommit(Iterable<Map.Entry<String,String>> commitData)Reads the sequence number stats from the commit data (maximum sequence number and local checkpoint).- Parameters:
- commitData- the commit data
- Returns:
- the sequence number stats
 
- 
minpublic static long min(long minSeqNo, long seqNo)Compute the minimum of the given current minimum sequence number and the specified sequence number, accounting for the fact that the current minimum sequence number could beNO_OPS_PERFORMEDorUNASSIGNED_SEQ_NO. When the current minimum sequence number is notNO_OPS_PERFORMEDnorUNASSIGNED_SEQ_NO, the specified sequence number must not beUNASSIGNED_SEQ_NO.- Parameters:
- minSeqNo- the current minimum sequence number
- seqNo- the specified sequence number
- Returns:
- the new minimum sequence number
 
- 
maxpublic static long max(long maxSeqNo, long seqNo)Compute the maximum of the given current maximum sequence number and the specified sequence number, accounting for the fact that the current maximum sequence number could beNO_OPS_PERFORMEDorUNASSIGNED_SEQ_NO. When the current maximum sequence number is notNO_OPS_PERFORMEDnorUNASSIGNED_SEQ_NO, the specified sequence number must not beUNASSIGNED_SEQ_NO.- Parameters:
- maxSeqNo- the current maximum sequence number
- seqNo- the specified sequence number
- Returns:
- the new maximum sequence number
 
 
-