Class ConsumerPollTracker
java.lang.Object
com.linkedin.davinci.kafka.consumer.ConsumerPollTracker
This class maintains a map of all the subscribed topic partitions and the timestamp when it was subscribed. The
intention is to detect topic partitions that are subscribed but received no messages for an extended period of time
due to any of the following reasons:
1. Starvation due to shared consumer
2. Pub-sub broker or client issues
3. Code bug
All subscribed topic partitions are expected to receive messages from polls because:
1. RT topics have heartbeat messages produced to them periodically. VT for hybrid stores will receive them too.
2. VT for batch only stores should unsubscribe after completion (EOP received).
Once message(s) are received the corresponding topic partition is removed from the tracking map.
TODO: Currently the tracker is unable to differentiate RT topic subscriptions across different versions. e.g. current
version and future version leader for a given partition is on the same host and subscribed to different offset of the
RT topic. Current version is able to poll successfully and future version cannot. The current implementation is
able to detect this but unable to report exactly which subscription is having trouble polling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetStaleTopicPartitions
(long thresholdTimestamp) void
recordMessageReceived
(PubSubTopicPartition pubSubTopicPartition) void
recordSubscribed
(PubSubTopicPartition pubSubTopicPartition) Record the subscribe timestamp for a given topic partition.void
removeTopicPartition
(PubSubTopicPartition pubSubTopicPartition)
-
Constructor Details
-
ConsumerPollTracker
-
-
Method Details
-
recordSubscribed
Record the subscribe timestamp for a given topic partition.- Parameters:
pubSubTopicPartition
- to record the activity for.
-
recordMessageReceived
-
removeTopicPartition
-
getStaleTopicPartitions
- Parameters:
thresholdTimestamp
- to get topic partitions with older last activity timestamp than the threshold timestamp.- Returns:
- a map of topic partitions with last successful activity timestamp older than the provided timestamp.
-