public class TierTopicSnapshotManager extends Object implements Runnable
Constructor and Description |
---|
TierTopicSnapshotManager(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer,
TierObjectStore objectStore,
Integer leaderEpoch,
Short tierNumPartitions,
Long checkpointIntervalMs,
Long maxRecordsPerSnapshot,
Integer retentionHours,
org.apache.kafka.common.utils.Time time,
org.apache.kafka.common.metrics.Metrics metrics)
Manages the snapshot consumer which periodically uploads the Tier Topic partition events snapshot
|
Modifier and Type | Method and Description |
---|---|
static List<SequencedObject> |
convertObjListToSeqList(Map<String,List<VersionInformation>> objects) |
protected void |
initialize()
Fetches the latest checkpoint file from object store and seek the consumer offset for various
|
boolean |
isShutdown() |
protected List<SequencedObject> |
latestSnapshots() |
Integer |
leaderEpoch()
Returns the current leader epoch associated with the running instance.
|
void |
run()
Continuous loop for buffering and checkpointing TierTopicPartition events.
|
void |
shutdown()
Shutdown is called in the leadership change context of associated topic partition.
|
protected TierTopicPartitionSnapshot |
snapshot(SequencedObject snapshotObject) |
void |
start()
Consumer thread is spawned.
|
public TierTopicSnapshotManager(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer, TierObjectStore objectStore, Integer leaderEpoch, Short tierNumPartitions, Long checkpointIntervalMs, Long maxRecordsPerSnapshot, Integer retentionHours, org.apache.kafka.common.utils.Time time, org.apache.kafka.common.metrics.Metrics metrics)
consumer
- consumerobjectStore
- object storeleaderEpoch
- epoch of the leadertierNumPartitions
- number of tier partitionscheckpointIntervalMs
- interval for checkpointing to object storemaxRecordsPerSnapshot
- maximum number of records per snapshotretentionHours
- retention in hours per snapshottime
- timemetrics
- metricspublic Integer leaderEpoch()
public void start() throws IOException
IOException
- if any I/O error occurspublic void shutdown()
public boolean isShutdown()
public void run()
protected void initialize() throws IOException, InterruptedException
IOException
- if any I/O error occursInterruptedException
- when shutdown is calledprotected TierTopicPartitionSnapshot snapshot(SequencedObject snapshotObject) throws IOException, InterruptedException
IOException
InterruptedException
protected List<SequencedObject> latestSnapshots() throws InterruptedException
InterruptedException
public static List<SequencedObject> convertObjListToSeqList(Map<String,List<VersionInformation>> objects)