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
Saga Caching Enhancements #2531
Merged
Merged
Conversation
This file contains 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
Instead of using the SubscribingEventProcessor, the test suite should use a StreamingEventProcessor, like the TEP. Doing so, it will more closely mirror reality for our users. #enhancement/caching-saga-it
Wrap result of cache retrieval in a new HashSet. Otherwise, there's a window of opportunity that the cached result Set is adjusted while the SagaRepository uses the contents to add to the found sagas result #enhancement/caching-saga-it
smcvb
added
Type: Bug
Use to signal issues that describe a bug within the system.
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
Dec 23, 2022
Add more association adjustments #enhancement/caching-saga-it
Make WeakReferenceCache#computeIfPresent use EntryListeners, as that's intended for usage of the WeakReferenceCache. #enhancement/caching-saga-it
Use a Cache.EntryListener to validate instead of the Cache directly, as that provides additional certainty that the Cache hasn't been adjusted during the given/when phases of the tests. Doing so, we make the test cases more resilient. #enhancement/caching-saga-it
Fix wait times to be less extensive #enhancement/caching-saga-it
…sing concurrency on the CachingSagaStore
…ization on the associations cache
… the delegate in a synchronised set to prevent concurrency issues leading to a ConcurrentModificationException in some cases.
… check whether value is still not garbage collected or cleaned
…it-morlack Proposed changes to caching saga fix
Remove redundant empty lines #2531
Adjust indentation and naming of test case for clarity #2531
Due to the Saga default TEP configuration that isn't impacted by configuring a default TEP config for al TEP's, the provided configuration did not have any impact at all. #2531
As there's a window of opportunity that a Saga is searched for right after it's removed, the removed check may currently fail from time to time. As this deviation isn't important for the test cases, we can get rid of clearing out the removed set when an entry is added. Added, clean-up the validator a bit further for clarity. #2531
Increase timeouts for resiliency, since busier systems may fail due to the current timeouts. #2531
Replace await-call for assertTrue. The await-call was included to incorrectly resolve the occurrence where a saga was found right after deletion, causing it to turn back up in the created set, thus clearing out the removed set. With the adjustments in the EntryListenerValidator, this predicament no longer occurs though. #2531
Adjust indentation #2531
Kudos, SonarCloud Quality Gate passed! |
CodeDrivenMitch
approved these changes
Dec 29, 2022
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.
Looks good to me 👍
smcvb
added
Status: Resolved
Use to signal that work on this issue is done.
and removed
Status: In Progress
Use to signal this issue is actively worked on.
labels
Dec 29, 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.
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.
This pull request does a couple of things:
CachedSaga
instance to construct N associations. This is done, as the number of associations may impact the cache invocationsCachingIntegrationTestSuite
to use aTrackingEventProcessor
instead of aSubscribingEventProcessor
. This adjustments lets the IT mirror Saga Caching use cases more closely, as we recommend the use of aStreamingEventProcessor
(like theTrackingEventProcessor
) to our users. Furthermore, as this makes event handling asynchronous, the validation process is adjusted to wait for the expected amount of events to be handled.CachingIntegrationTestSuite
to use a customCache.EntryListener
to validate theCache
is accessed as expected.WeakReferenceCachce#computeIfPresent
invokes theCache.EntryListener
.Cache#computeIfAbsent
lambda invocation in theCachingSagaStore
to retrieve associations is wrapped into aCollections#synchronizedSet
. This resolves anyConcurrentModificationExceptions
that may occur upon invocation of theCachingSagaStore#findSagas
method, as the set within theCache
is replaced by a thread-safe variant.CachingSagaStoreTest
, validating theConcurrentModificationException
does not occur anymore.