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
Fix broken watermark counters in unordered mapUsingServiceAsync [HZ-1928] #23271
Merged
k-jamroz
merged 9 commits into
hazelcast:master
from
k-jamroz:mapUsingServiceAsync-broken-watermarks-and-counters
Jan 12, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cad71e7
Add regression tests for problems with watermark counters in unordere…
k-jamroz 89c80fe
Make watermark test for the same item deterministic
k-jamroz 31c9b6f
Fix warnings
k-jamroz 8fd69d0
Use correct count of asynchronous operations for checking completion …
k-jamroz 671dbec
Fix comments. Remove redundant calculation of size when updating last…
k-jamroz 8fa663d
Fix cooperativeTimeout configuration in Jet TestSupport.
k-jamroz 62ea016
Grammar and minor changes
viliam-durina 9d76898
Restore warn time limit check for cooperative processor. Fix comment.
k-jamroz c707f34
Update comment
viliam-durina File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
@viliam-durina I think that watermark duplication is allowed. Is that true?
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.
It's not allowed, they must be strictly monotonic.
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.
Watermark order with regards to items is preserved.
After a lot of debugging I confirmed that WM duplication is partially caused by the fact that we do not store
lastEmittedWms
in the snapshot. So if at the time of getting snapshot we have:then, after restore we get:
lastReceivedWms
Long.MIN_VALUE
) even though to be strict it should be related to the WM (lastReceivedWms
field is updated after restored items are sent for processing)lastReceivedWms
(check inwatermarkCount.isEmpty() && lastReceivedWms[i] > lastEmittedWms[i]
) which seems to make sense at least for other casesI think this actually may be by design that given WM can be repeated after snapshot because, as the comment says:
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.
also the duplication does not occur during single execution, duplicated WM is emitted after restore from snapshot. But because of "we restart at the oldest WM any instance was at the time of snapshot" it probably can go backwards.
Still, emitting WM after unrelated item seems at least counter-intuitive.
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.
I debugged it too and yes, the observed output is legal. The duplicate WMs aren't emitted from a single instance of a processor (that wouldn't be legal), but from the processor after restore.
We save a simplified state to the snapshot. Before saving, we know exactly which item was received before which WM. But we can't save it exactly like this, because after restore, the WM can go back in at-least-once mode, and items can be re-partitioned, and we can't re-partition the
watermarkCounts
. I think we don't even have to savelastReceivedWm
at all, we can just rely on the new WMs received after restore, but it's not too important to change, I can be wrong here.