Optimize aggregate read operation#892
Merged
dmdashenkov merged 16 commits intomasterfrom Dec 11, 2018
Merged
Conversation
Contributor
Author
|
@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
Contributor
Author
|
@armiol, PTAL. |
armiol
requested changes
Dec 7, 2018
Contributor
armiol
left a comment
There was a problem hiding this comment.
@dmdashenkov let's discuss the naming. Other than that, LGTM — once, hopefully, the build passes.
| * | ||
| * @see AggregateStorage#readEventCountAfterLastSnapshot(Object) | ||
| */ | ||
| private int persistedEventCount = 0; |
Contributor
There was a problem hiding this comment.
To me, the name of the variable does not correspond to its description and usage.
Contributor
Author
|
@armiol, PTAL. |
armiol
approved these changes
Dec 7, 2018
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we make the
AggregateRepositoryread 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
eventCountAfterLastSnapshotin theAggregateinstance. This helps us not to re-fetch the value when appending the aggregate history.