Subhdeep Saha
01/31/2025, 6:19 PMKafkaSourceFooBarData fooBarSource = KafkaSource.FooBarDatabuilder()
.setTopics("foobar")
.setGroupId("foobar")
.setStartingOffsets(
OffsetsInitializer.committedOffsets(OffsetResetStrategy.EARLIEST))
.setValueOnlyDeserializer(new JsonDeserializationSchemaFooBarData(FooBarData.class))
.build();
Config-2
KafkaSourceFooBarData fooBarSource = KafkaSource.FooBarDatabuilder()
.setTopics("foobar")
.setGroupId("foobar")
.setStartingOffsets(OffsetsInitializer.latest())
.setValueOnlyDeserializer(new JsonDeserializationSchemaFooBarData(FooBarData.class))
.build();
This is how my Flink Job looks, where the TimeCountTrigger throws Exception when batch size is 20 (Its a self injected exception to test Job recovery).
Approximate time taken to form a batch of 40 will be ~40secs.
KafkaSource<> ... // as described above
SingleOutputStreamOperator<ListString> batchedStream = fooBarStream
.windowAll(GlobalWindows.create())
.trigger(new TimeCountTrigger<>(40L /*batchSize*/, 60*1000L /*batchInterval*/))
.process(new BatchWindowFn());
So, in Config-1 I am observing that the checkpointing in Windowing operator is always failing even if I have configured to checkpoint at every 10secs.
In Config-2 I am observing that the checkpointing is happening successfully every 10secs and state is restored on Job restart.
Can someone please explain this behaviour, as the only difference in Config-1 and Config-2 is how the offset is initialized in the Kafka Source? Any directions on how to understand this will be highly appreciated.Subhdeep Saha
02/11/2025, 8:24 AM