我的一项 samza 任务有一个令人费解的问题。除了一个分区上的消息外,它可以正常工作。我有 9 个关于该主题的分区。如果我发送 1000 条消息,我只会收到大约 890 条消息。
我已经检查了 kafka-console-consumer 的分区键,我知道我的 samza 作业不会处理这些分区键,并且控制台消费者确实看到了该消息,所以我知道它正在被写入主题,并且至少一个普通消费者可以看看就好了。
我在 samza 上启用了调试日志记录,并且有很多消息org.apache.samza.checkpoint.kafka.KafkaCheckpointManager
说:
为 taskName Partition 4 添加检查点 Checkpoint [offsets={SystemStreamPartition [kafka, com.mycompany.indexing.document, 4]=448}]
分区 4 总是显示 448。分区 0 有类似的日志,但在显示 448 的地方,它是一个稳定增长的数字。
我很乐意分享任何有趣的配置信息来帮助缩小范围,但现在,我对我什至会分享什么感到有点迷惑。
我正在运行ThreadJobFactory
:
samza-kafka_2.10 版本 0.9.1
客户端上的kafka_2.10版本0.8.2.1
卡夫卡经纪人 0.9.0.0
更新
我使用相同的分区键查看了上游 samza 作业,发现上游分区 4 存在问题。使用 kafkacat 检查 samza 检查点主题,我看到分区 4 的检查点没有推进。首先我看到:
{"SystemStreamPartition [kafka, resource.mutation, 6]":{"system":"kafka","partition":"6","offset":"96639","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 3]":{"system":"kafka","partition":"3","offset":"47135","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 0]":{"system":"kafka","partition":"0","offset":"49476","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 4]":{"system":"kafka","partition":"4","offset":"2556","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 8]":{"system":"kafka","partition":"8","offset":"62263","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 1]":{"system":"kafka","partition":"1","offset":"52151","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 7]":{"system":"kafka","partition":"7","offset":"58081","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 5]":{"system":"kafka","partition":"5","offset":"47712","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 2]":{"system":"kafka","partition":"2","offset":"45831","stream":"resource.mutation"}}
% Reached end of topic __samza_checkpoint_ver_1_for_resource-normalizer_1 [0] at offset 81713
然后一分钟后我看到:
{"SystemStreamPartition [kafka, resource.mutation, 6]":{"system":"kafka","partition":"6","offset":"96624","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 3]":{"system":"kafka","partition":"3","offset":"47115","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 0]":{"system":"kafka","partition":"0","offset":"49462","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 4]":{"system":"kafka","partition":"4","offset":"2556","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 8]":{"system":"kafka","partition":"8","offset":"62252","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 1]":{"system":"kafka","partition":"1","offset":"52134","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 7]":{"system":"kafka","partition":"7","offset":"58063","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 5]":{"system":"kafka","partition":"5","offset":"47696","stream":"resource.mutation"}}
{"SystemStreamPartition [kafka, resource.mutation, 2]":{"system":"kafka","partition":"2","offset":"45817","stream":"resource.mutation"}}
% Reached end of topic __samza_checkpoint_ver_1_for_resource-normalizer_1 [0] at offset 81722
该数字没有超过 2556。但是,查看resource.mutation
分区 4 上的实际主题,最后一个偏移量的范围与其他偏移量相似,截至目前约为 61000 并且还在增长。
根本没有错误消息或警告消息。它只是停止从分区 4 消费。