Skip to content

Update acknowledger when we get assignments from the consumer group#8

Merged
nathanmonteleone merged 3 commits intomainfrom
reset_acknowledger
Apr 30, 2025
Merged

Update acknowledger when we get assignments from the consumer group#8
nathanmonteleone merged 3 commits intomainfrom
reset_acknowledger

Conversation

@nathanmonteleone
Copy link
Copy Markdown

@nathanmonteleone nathanmonteleone commented Apr 29, 2025

https://simplifi.atlassian.net/browse/INT-11275

This is a bugfix:

  • Consumer worker threads only live for a single assignment. Once assignments are revoked, those threads are destroyed...
  • BUT, there is another GenServer called the Acknowledger, that stays alive for the duration of the connection. The Acknowledger tracks the latest offset that it's seen for each partition...
  • Normally, when worker threads are started they get their beginning offset from the broker, BUT when they are restarted because of an unexpected crash (say, our json writers timing out) they attempt to restore their offset from the Acknowledger.

In the original code, this can cause a rewind if the worker crashes before actually acking any new offsets.

This PR fixes that by updating the Acknowledger's latest offset as soon as we see a new partition assignment from the broker.

Comment thread lib/elsa/group/acknowledger.ex Outdated
nathanmonteleone and others added 2 commits April 30, 2025 11:40
Co-authored-by: Liru Færs <lirusaito@gmail.com>
@nathanmonteleone nathanmonteleone merged commit 94ff633 into main Apr 30, 2025
3 checks passed
@nathanmonteleone nathanmonteleone deleted the reset_acknowledger branch April 30, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants