fix: backtracking when fallback is enabled #166
Merged
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.
The
QueryDao
NPEs when backtracking over fallback breadcrumb items, as it expects theEventSerId
attribute to be set, when it's not.Fix is to use a
dummyzero serializer ID for breadcrumb items when backtracking. Since the only query for events which backtracks is theeventsBySlice
query which only uses the serializer ID to:FilteredPayload
serializer ID to mark the resulting envelope as filteredany serializer ID would do; zero is chosen as it's Akka-reserved but otherwise unused
but (for the absolute avoidance of confusion), this fix selects (on encountering the first fallback breadcrumb while backtracking) a serializer ID which is not bound to a serializer (since there are 4 billion legal serializer IDs (assuming negative IDs are allowed) and it's unlikely that a real system has even 4 thousand serializers (thus the chances are likely better than 999,999 in a million that any guess finds an unbound ID), it should be quick to find such an ID). Since the by-slice queries emit event envelopes and envelopes from backtracking leave the event empty, this dummy serializer ID doesn't get exposed to the user.