You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in_kafka: improve offset commit timing to avoid data loss in edge cases
This patch refactors the Kafka input plugin’s offset commit logic when enable.auto.commit is disabled.
Previously, offsets were committed immediately after each individual message was processed, even before
it was flushed to the Fluent Bit pipeline. This introduced a small risk window where, in the event of a
crash or forced shutdown, messages could be acknowledged (via Kafka commit) without being fully ingested
resulting in potential data loss under extreme conditions.
This patch moves the offset commit logic to occur only after a successful batch flush (flb_input_log_append).
This ensures that:
- offsets are only committed if messages were actually encoded and flushed.
- we avoid committing unprocessed data, thereby improving correctness.
- we reduce the number of commits, improving efficiency in batch mode.
This change aligns commit timing with actual ingestion and eliminates the window of inconsistency between
processing and commit acknowledgment.
Signed-off-by: Eduardo Silva <[email protected]>
0 commit comments