-
-
Notifications
You must be signed in to change notification settings - Fork 80
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: Add tolerance to MemberListTimestamp (#5366) #5376
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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
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
Oops, something went wrong.
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.
This assumes that the sender is online? Otherwise if the sender removes someone locally from the group, sets timestamp to now + 60 seconds, but only gets online an hour later, nobody else even have a chance to receive the message about member removal.
Or the other way round, you are online, remove someone from the group and set timestamp to now + 60 seconds. 5 minutes later someone who is offline sends a message without receiving your message about the change, it will appear as new according to
Date
but it was constructed for an outdated member list.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 don't think looking at the
Date
of incoming message can solve this. What we are interested in is not whether the incoming message is newer than previous change (by 60 seconds or any other margin), but if the sender of the message have seen this previous change when the message was constructed.Maybe instead of adding 60-second margin it is sufficient to look at the date of the parent message instead of the message itself when we consider whether to apply the change?
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 think this is ok. If there are newer messages in the group, the sender will "sync back" the removed member and (optionally) retry to remove it. The removal was done based on the outdated state anyway.
This is a problem, yes, but maybe my message was lost at all, so i can't know whether the message i received was constructed for an "outdated" member list. Maybe i'm the only one who has the "updated" member list.
The parent message could be sent offline too.
I think adding the proposed tolerance has sense as it improves some scenarios in the tests, but to improve the consistency algo further, i'd suggest to add a new
msgs.timestamp_members
column:timestamp_members
is inherited from the parent message.timestamp_members = max(timestamp_members + 1, timestamp_sent)
.timestamp_members
>=MemberListTimestamp
of the chat, updateMemberListTimestamp
and the member list from the message.But even then adding some tolerance makes sense to allow unordered parallel changes.