Class InactiveTopicPartitionChecker
- All Implemented Interfaces:
Closeable
,AutoCloseable
This checker runs periodically to:
- Identify topic partitions that haven't been successfully polled within a configured threshold
- Pause inactive topic partitions to prevent them from blocking consumption of active topic partitions
- Resume previously paused topic partitions that have become active again
The service maintains state about which topic partitions are currently paused for each consumer and makes intelligent decisions about when to pause/resume based on the current activity status.
This is particularly useful in scenarios where some topic partitions may become temporarily unavailable or slow, preventing the consumer from making progress on other healthy topic partitions.
The checker uses per-topic-partition statistics from ConsumptionTask
to determine activity,
specifically looking at the last successful poll timestamp for each topic partition.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
Constructor Summary
ConstructorsConstructorDescriptionInactiveTopicPartitionChecker
(IndexedMap<com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer, com.linkedin.davinci.kafka.consumer.ConsumptionTask> consumerToConsumptionTask, long inactiveTopicPartitionCheckIntervalInSeconds, long inactiveTopicPartitionThresholdInSeconds) Creates a new InactiveTopicPartitionChecker. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Starts the inactive topic partition checker service.void
Stops the inactive topic partition checker service.
-
Constructor Details
-
InactiveTopicPartitionChecker
public InactiveTopicPartitionChecker(IndexedMap<com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer, com.linkedin.davinci.kafka.consumer.ConsumptionTask> consumerToConsumptionTask, long inactiveTopicPartitionCheckIntervalInSeconds, long inactiveTopicPartitionThresholdInSeconds) Creates a new InactiveTopicPartitionChecker.- Parameters:
consumerToConsumptionTask
- map of consumers to their consumption tasks, used to check topic partition activity statusinactiveTopicPartitionCheckIntervalInSeconds
- how often to check for inactive topic partitions (in milliseconds)inactiveTopicPartitionThresholdInSeconds
- threshold after which a topic partition is considered inactive (in milliseconds)
-
-
Method Details
-
startInner
Starts the inactive topic partition checker service.This method schedules a periodic task that will run every
inactiveTopicPartitionCheckIntervalInMs
milliseconds to check for and handle inactive topic partitions.- Specified by:
startInner
in classAbstractVeniceService
- Returns:
- true if the service started successfully
- Throws:
Exception
- if there's an error starting the service
-
stopInner
Stops the inactive topic partition checker service.This method gracefully shuts down the scheduled executor service, waiting up to 5 seconds for running tasks to complete before forcing shutdown.
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
Exception
- if there's an error stopping the service
-