java.lang.Object
org.elasticsearch.index.seqno.LocalCheckpointTracker
This class generates sequences numbers and keeps track of the so-called "local checkpoint" which is the highest number for which all
 previous sequence numbers have been processed (inclusive).
- 
Constructor SummaryConstructorsConstructorDescriptionLocalCheckpointTracker(long maxSeqNo, long localCheckpoint) Initialize the local checkpoint service.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadvanceMaxSeqNo(long seqNo) Marks the provided sequence number as seen and updates the max_seq_no if needed.longIssue the next sequence number.longThe maximum sequence number issued so far.longThe current persisted checkpoint which can be advanced bymarkSeqNoAsPersisted(long).longThe current checkpoint which can be advanced bymarkSeqNoAsProcessed(long).getStats(long globalCheckpoint) constructs aSeqNoStatsobject, using local state and the supplied global checkpoint This is needed to make sure the persisted local checkpoint and max seq no are consistentbooleanhasProcessed(long seqNo) Checks if the given sequence number was marked as processed in this tracker.voidmarkSeqNoAsPersisted(long seqNo) Marks the provided sequence number as persisted and updates the checkpoint if possible.voidmarkSeqNoAsProcessed(long seqNo) Marks the provided sequence number as processed and updates the processed checkpoint if possible.
- 
Constructor Details- 
LocalCheckpointTrackerpublic LocalCheckpointTracker(long maxSeqNo, long localCheckpoint) Initialize the local checkpoint service. ThemaxSeqNoshould be set to the last sequence number assigned, orSequenceNumbers.NO_OPS_PERFORMEDandlocalCheckpointshould be set to the last known local checkpoint, orSequenceNumbers.NO_OPS_PERFORMED.- Parameters:
- maxSeqNo- the last sequence number assigned, or- SequenceNumbers.NO_OPS_PERFORMED
- localCheckpoint- the last known local checkpoint, or- SequenceNumbers.NO_OPS_PERFORMED
 
 
- 
- 
Method Details- 
generateSeqNopublic long generateSeqNo()Issue the next sequence number.- Returns:
- the next assigned sequence number
 
- 
advanceMaxSeqNopublic void advanceMaxSeqNo(long seqNo) Marks the provided sequence number as seen and updates the max_seq_no if needed.
- 
markSeqNoAsProcessedpublic void markSeqNoAsProcessed(long seqNo) Marks the provided sequence number as processed and updates the processed checkpoint if possible.- Parameters:
- seqNo- the sequence number to mark as processed
 
- 
markSeqNoAsPersistedpublic void markSeqNoAsPersisted(long seqNo) Marks the provided sequence number as persisted and updates the checkpoint if possible.- Parameters:
- seqNo- the sequence number to mark as persisted
 
- 
getProcessedCheckpointpublic long getProcessedCheckpoint()The current checkpoint which can be advanced bymarkSeqNoAsProcessed(long).- Returns:
- the current checkpoint
 
- 
getPersistedCheckpointpublic long getPersistedCheckpoint()The current persisted checkpoint which can be advanced bymarkSeqNoAsPersisted(long).- Returns:
- the current persisted checkpoint
 
- 
getMaxSeqNopublic long getMaxSeqNo()The maximum sequence number issued so far.- Returns:
- the maximum sequence number
 
- 
getStatsconstructs aSeqNoStatsobject, using local state and the supplied global checkpoint This is needed to make sure the persisted local checkpoint and max seq no are consistent
- 
hasProcessedpublic boolean hasProcessed(long seqNo) Checks if the given sequence number was marked as processed in this tracker.
 
-