line/decaton

asyncCommitInFlight concurrency

Closed this issue · 2 comments

Non-volatile field CommitManager.asyncCommitInFlight is updated from

  • CommitManager.commitAsync (decaton subscription thread)
  • consumer.commitAsync callback (kafka background I/O thread)

To ensure it is always correctly updated, it should be atomic or at least volatile.

Against the name commitAsync, the callback is ensured to be triggered on consumer-loop's thread (i.e. subscription thread) at least as of current kafka-clients version.

Also we are checking it just in case:
https://github.com/line/decaton/blob/master/processor/src/main/java/com/linecorp/decaton/processor/runtime/internal/CommitManager.java#L134-L139

I misunderstood the Kafka docs. There is no problem.