Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventSourcedBehavior.lastSequenceNumber incorrect values after recovery #32359

Open
aludwiko opened this issue Mar 21, 2024 · 1 comment
Open
Assignees
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted bug t:persistence t:typed

Comments

@aludwiko
Copy link
Contributor

aludwiko commented Mar 21, 2024

Calling EventSourcedBehavior.lastSequenceNumber in the event handler returns incorrect value after entity recovery:
Example for a new entity:

cmd handler: 0
evt handler: 0

cmd handler: 1
evt handler: 2

cmd handler: 2
evt handler: 3

After recovery:

evt handler: 1
evt handler: 2
evt handler: 3

cmd handler: 3
evt handler: 3

cmd handler: 4
evt handler: 5

When debugging, I've noticed that instead of the first event handler (after recovery) will still use akka.persistence.typed.internal.ReplayingEvents#currentSequenceNumber, and the following one will switch to akka.persistence.typed.internal.Running.HandlingCommands#currentSequenceNumber.

@patriknw patriknw added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:persistence bug t:typed labels Mar 21, 2024
@johanandren johanandren self-assigned this Apr 5, 2024
@johanandren
Copy link
Member

We have test coverage for sequence number on commands after recovery passing https://github.com/akka/akka/blob/main/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/scaladsl/EventSourcedSequenceNumberSpec.scala#L113 so there must be something more to what you observed. Was there anything special going on in the entity where you saw it @aludwiko ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted bug t:persistence t:typed
Projects
None yet
Development

No branches or pull requests

3 participants