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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742330334a4423590.html

相关推荐

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

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

    14小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信