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

Snapshots are not considered during loading of an Aggregate using Axon-Server-Connector #2285

Closed
zambrovski opened this issue Jul 13, 2022 · 3 comments · Fixed by #2286
Closed
Assignees
Labels
Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Status: Resolved Use to signal that work on this issue is done. Type: Bug Use to signal issues that describe a bug within the system.

Comments

@zambrovski
Copy link
Contributor

Basic information

  • Axon Framework version: 4.5.13
  • Axon Server version: 4.5.13-CE (docker)
  • JDK version: 11
  • Complete executable reproducer if available (e.g. GitHub Repo):

Steps to reproduce

I asked the question in the form here: https://discuss.axoniq.io/t/restoring-es-aggregates-from-aggregatesnapshot/4242

The snapshotter is storing events in Axon Server, but during the load of the aggregate the snapshots are not considered, but the entire event stream is loaded. Switching the event store from Axon Server to for example JPA Event Store fixes the problem. In JPA Event Store the latest snapshot is loaded followed by the sequence of events occurred after the snapshot only.

Expected behaviour

Axon Server Connector uses snapshots to load the state of the aggregate and applies the events occurred after snapshot only.

Actual behaviour

Axon Server Connector is ignoring snapshots to load the state of the aggregate and applies the events from the initial to the latest.

@zambrovski zambrovski added the Type: Bug Use to signal issues that describe a bug within the system. label Jul 13, 2022
@zambrovski
Copy link
Contributor Author

zambrovski commented Jul 13, 2022

As described in the discussion, I believe that this piece of code is not correct:

} else if (firstSequenceNumber == ALLOW_SNAPSHOTS_MAGIC_VALUE && !snapshotFilterSet) {

It should be rather snapshotFilterSet (which is true by default) and not !snapshotFilterSet.

@MGathier
Copy link
Member

The reason for the check is that if there is no snapshot filter, Axon Server will read the snapshot internally and return a stream of events starting with the latest snapshot (if available). However in your case, there is a snapshot filter, and the event store should first read the snapshot from Axon Server, apply the filter and then read the events.

MGathier added a commit that referenced this issue Jul 14, 2022
@smcvb smcvb added Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Status: In Progress Use to signal this issue is actively worked on. labels Jul 14, 2022
@smcvb smcvb added this to the Release 4.5.14 milestone Jul 14, 2022
@close-label close-label bot added the Status: Resolved Use to signal that work on this issue is done. label Jul 14, 2022
@smcvb smcvb removed the Status: In Progress Use to signal this issue is actively worked on. label Jul 14, 2022
@smcvb
Copy link
Member

smcvb commented Jul 14, 2022

Closing this issue as it's resolved by pull request #2286.

@smcvb smcvb closed this as completed Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Status: Resolved Use to signal that work on this issue is done. Type: Bug Use to signal issues that describe a bug within the system.
Projects
None yet
3 participants