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

fix: Use new state in snapshotWhen #32462

Merged
merged 1 commit into from
Jul 4, 2024
Merged

Conversation

patriknw
Copy link
Member

@patriknw patriknw commented Jul 3, 2024

No description provided.

@@ -574,6 +572,8 @@ private[akka] object Running {
}

currentState = currentState.applyEvent(setup, event)
if (shouldSnapshotAfterPersist == NoSnapshot)
shouldSnapshotAfterPersist = setup.shouldSnapshot(currentState.state, event, _currentSequenceNumber)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's correct for persist of one event, but not for this persistAll case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is the case (and I do believe you), are we missing a test case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in case of persistAll, we were saying an out-of-date state? 😱

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, only the shouldSnapshot predicate did get passed in the old state, before the event was applied.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is the case (and I do believe you), are we missing a test case?

Probably not much testing on that detail. I'm afraid I don't have time to add any before my vacation. I'm confident that this is correct and can be merged, but feel free to follow up with more tests.

Copy link
Member

@octonato octonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -574,6 +572,8 @@ private[akka] object Running {
}

currentState = currentState.applyEvent(setup, event)
if (shouldSnapshotAfterPersist == NoSnapshot)
shouldSnapshotAfterPersist = setup.shouldSnapshot(currentState.state, event, _currentSequenceNumber)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in case of persistAll, we were saying an out-of-date state? 😱

Copy link
Contributor

@sebastian-alfers sebastian-alfers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw added the bug label Jul 4, 2024
@patriknw patriknw added this to the 2.9.5 milestone Jul 4, 2024
@patriknw patriknw merged commit 3f3213f into main Jul 4, 2024
5 checks passed
@patriknw patriknw deleted the wip-snapshotWhen-state-patriknw branch July 4, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants