-
Notifications
You must be signed in to change notification settings - Fork 12
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
Optimize aggregate read operation #892
Conversation
@armiol, PTAL. |
Codecov Report
@@ Coverage Diff @@
## master #892 +/- ##
===========================================
+ Coverage 93.39% 93.4% +<.01%
- Complexity 3868 3870 +2
===========================================
Files 529 529
Lines 12627 12637 +10
Branches 704 704
===========================================
+ Hits 11793 11803 +10
+ Misses 606 605 -1
- Partials 228 229 +1 |
# Conflicts: # config # server/src/main/java/io/spine/server/aggregate/AggregateRepository.java
@armiol, PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmdashenkov let's discuss the naming. Other than that, LGTM — once, hopefully, the build passes.
* | ||
* @see AggregateStorage#readEventCountAfterLastSnapshot(Object) | ||
*/ | ||
private int persistedEventCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, the name of the variable does not correspond to its description and usage.
@armiol, PTAL. |
In this PR we make the
AggregateRepository
read the required amount of history events, even if this number is greater than the snapshot trigger.Previously, the number of read events was always equal to the snapshot trigger.
Also, now we cache the
eventCountAfterLastSnapshot
in theAggregate
instance. This helps us not to re-fetch the value when appending the aggregate history.