StampedRecord nextRecord(final RecordInfo info)
PartitionGroup
PartitionGroup is a collection of RecordQueues (one per every partition assigned to a StreamTask).
PartitionGroup is created exclusively for a StreamTask.
Creating PartitionGroup Instance
PartitionGroup takes the following to be created:
-
RecordQueues per Kafka TopicPartition (
Map<TopicPartition, RecordQueue>)
PartitionGroup initializes the internal properties.
Retrieving Next Stamped Record (Record with Timestamp) and RecordQueue — nextRecord Method
nextRecord…FIXME
|
Note
|
nextRecord is used exclusively when StreamTask is requested to process a single record.
|
Adding Records to RecordQueue For Given Partition — addRawRecords Method
int addRawRecords(
final TopicPartition partition,
final Iterable<ConsumerRecord<byte[], byte[]>> rawRecords)
addRawRecords looks up the RecordQueue for the input Kafka TopicPartition (in the partitionQueues).
addRawRecords requests the RecordQueue for the size and to add Kafka ConsumerRecords (as StampedRecords).
addRawRecords inserts the RecordQueue into the queuesByTime priority queue only if the RecordQueue was empty before.
addRawRecords adds the difference between the old and current sizes to totalBuffered.
In the end, addRawRecords returns the current size of the RecordQueue.
|
Note
|
addRawRecords is used exclusively when StreamTask is requested to buffer new records.
|
clear Method
void clear()
clear removes all of the elements from the queuesByTime and requests every RecordQueue (in the internal partitionQueues registry) to clear itself.
|
Note
|
clear is used exclusively when StreamTask is requested to closeTopology.
|
numBuffered Method
int numBuffered(final TopicPartition partition)
numBuffered…FIXME
|
Note
|
numBuffered is used when…FIXME
|
Minimum Partition Timestamp Across All Partitions — timestamp Method
long timestamp()
timestamp simply iterates over the TopicPartitions and requests every RecordQueue for the partition timestamp.
In the end, timestamp returns the oldest partition timestamp (time-wise).
|
Note
|
timestamp is used exclusively when StreamTask is requested to maybePunctuateStreamTime
|
Internal Properties
| Name | Description |
|---|---|
|
Flag that indicates whether all the RecordQueues have at least one record buffered ( Default: Enabled ( Disabled ( Used (as |
|
Java PriorityQueue that orders RecordQueues per tracked partition timestamp (and the initial capacity as the number of partitions in the partitionQueues) ( Used when * Add records to the RecordQueue for a given partition Cleared when |
|
Java PriorityQueue that is an unbounded priority queue that uses partition timestamps for ordering. |
|
Default: UNKNOWN |
|