Kafka Streams 中数据乱序的原因

Out-of-order data cause in Kafka Streams

你能帮我理解这段摘录吗,摘自Kafka Streams documentation:

Within a stream task that may be processing multiple topic-partitions, if users configure the application to not wait for all partitions to contain some buffered data and pick from the partition with the smallest timestamp to process the next record, then later on when some records are fetched for other topic-partitions, their timestamps may be smaller than those processed records fetched from another topic-partition.

我不明白逻辑:如果您选择时间戳最小的分区,为什么以后会得到更小的时间戳?

我认为重要的部分是

if users configure the application to not wait for all partitions to contain some buffered data

由于我们不等待所有分区都有一些数据,因此对于流 S1S2 (T1 < T2) 可能会发生以下情况:

  1. I2 时间戳 T2 到达 S2
  2. 流读取 I2 因为没有其他数据可用
  3. I1 时间戳 T1 到达 S1
  4. 流读取 I1,其时间戳小于 I2,后者已被处理

如果我们等到所有流都有数据,我们将 select 所有可用项目中的最小项目。因为我们不存在时间戳较小的项目被延迟的可能性。