最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

apache kafka - App producing 2 messages for only 1 input - Stack Overflow

programmeradmin2浏览0评论

I'm trying to debug a problem in our production Kafka Streams app. The (simplified) topology looks something like this

builder.stream("input").groupByKey().reduce(
  (agg, val) -> "bar",
  Materialized.as("saved_store")
);

99% of our incoming messages on the "input" topic seem to work fine, but I found some cases that didn't. I see a single message for a particular key 123 in "input"

"123": "foo"

but when I look at the private Kafka topic that "saved_store" is materializing to, there are two messages there and both of them look like

"123": "bar"

What could be causing this? I would expect the saved store to only have a single message AND for value to be "foo", since the reducer is not supposed to be called when the key is seen for the first time.

I'm trying to debug a problem in our production Kafka Streams app. The (simplified) topology looks something like this

builder.stream("input").groupByKey().reduce(
  (agg, val) -> "bar",
  Materialized.as("saved_store")
);

99% of our incoming messages on the "input" topic seem to work fine, but I found some cases that didn't. I see a single message for a particular key 123 in "input"

"123": "foo"

but when I look at the private Kafka topic that "saved_store" is materializing to, there are two messages there and both of them look like

"123": "bar"

What could be causing this? I would expect the saved store to only have a single message AND for value to be "foo", since the reducer is not supposed to be called when the key is seen for the first time.

Share Improve this question edited Nov 20, 2024 at 20:54 Rob 15.2k30 gold badges48 silver badges73 bronze badges asked Nov 20, 2024 at 20:32 EgorEgor 1,66013 silver badges26 bronze badges 1
  • Did you try disable caching to remove one moving piece? – Matthias J. Sax Commented Dec 29, 2024 at 18:11
Add a comment  | 

1 Answer 1

Reset to default 0

look at the private Kafka topic that "saved_store" is materializing to,

That's the wrong way to view a store. Compacted topics back stores. Compacted topics do not guarantee unique keys within an open segment, before a log cleaner thread runs

"Uncompacted' topics Vs compacted topics

发布评论

评论列表(0)

  1. 暂无评论