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

Process events with identical TrackingToken together in the PooledStreamingEventProcessor #2275

Merged
merged 8 commits into from Jul 7, 2022

Conversation

smcvb
Copy link
Member

@smcvb smcvb commented Jul 6, 2022

This pull request can be regarded as a follow up for #2067, doing it right this time.
Pull request #2067 introduced an issue where one failing segment (read: WorkPackage) somewhere in the middle of the stream would cause the other segments to pick up the last event again.
This was in essence the issue of the Coordinator, as it would reset the event stream to the failing segment once it got picked up again.
Due to this, the stream was traversed again, causing the last handled event by all other segments to be scheduled again.
This scenario, followed by the WorkPackage accepting an event with an identical token (as introduced in PR #2067) caused duplicate handling of the last event.

This pull request resolves this predicament by very consciously moving into a different processing branch for event scheduling if subsequent events are present with the same token.
The Coordinator ensure they're grouped into a collection and provided together.
The WorkPackage will in turn group them to process them within the same batch.

The changes are accompanied by unit tests and an integration test to validate the correct process.

Add test case to ensure last event isn't handled twice. Also, fix the
WorkPackage, so that the test succeeds, but the multi-upcaster test
fails.

#bug/psep-upcasted-events
Both the Coordinator and WorkPackage should be aware subsequent events
may have the same TrackingToken. This happens whenever a Multi-upcaster
is used to split an event into several entries. As these events
originally where one, they should be handled in one transaction too. The
 coordinator should collect these and provide them together in a list to
  the WorkPackage. The WorkPackage should during processing ensure it
  combines these again, as otherwise processing entries are handled
  separately.

#bug/psep-upcasted-events
@smcvb 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 Jul 6, 2022
@smcvb smcvb added this to the Release 4.5.13 milestone Jul 6, 2022
@smcvb smcvb requested review from abuijze and gklijs July 6, 2022 14:49
@smcvb smcvb self-assigned this Jul 6, 2022
- Remove debugging system.out line
- Wrap assert in assertWithin as it failed a couple of times
- Introduce a Default- and BatchProcessingEntry. This for one ensure we
resolve a potential concurrency issue, where a Coordinator schedules
events while the WorkPackage is consuming them. Secondly, it simplifies
the processEvents() method and clarifies the change between default
processing and batch processing for the upcasted events.

#2275
@smcvb smcvb requested a review from abuijze July 7, 2022 10:13
smcvb added 3 commits July 7, 2022 13:17
Rename method for clarity and move assert operation into method

#2275
Adjust validation for resiliency. There's a window of opportunity that
the WorkPackage is fast and adds another trackerStatus in the mix. For
verification, we can come by with a single entry, though.

#2275
Adjust validation for resiliency. There's a window of opportunity that
the WorkPackages are fast and that one of them already failed before
this validation. This means there are 15 instead of 16 status' present.

#2275
Move adding entries to the ProcessingEntry. That way we do not have to
do an instanceof check.

#2275
@smcvb smcvb requested a review from abuijze July 7, 2022 13:54
Use a ProcessingEntry instead of a DefaultProcessingEntry

#2275
@sonarcloud
Copy link

sonarcloud bot commented Jul 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

84.9% 84.9% Coverage
0.0% 0.0% Duplication

@smcvb smcvb merged commit 8d792dc into axon-4.5.x Jul 7, 2022
@smcvb smcvb deleted the bug/psep-upcasted-events branch July 7, 2022 15:40
@smcvb 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 Jul 7, 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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants