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

[FIXED] Clustering: restore snapshot with some messages no longer avail #835

Merged
merged 1 commit into from
May 14, 2019

Conversation

kozlovic
Copy link
Member

When a snapshot is performed prior to messages being removed (either
expired or remove due to count/size limits), a node that would
restore from this snapshot would ask the leader to send messages
which indexes (first/last) are in the snapshot.
Both leader and node would stop the restore when the first unavail
message was found.

Resolves #834

Signed-off-by: Ivan Kozlovic ivan@synadia.com

When a snapshot is performed prior to messages being removed (either
expired or remove due to count/size limits), a node that would
restore from this snapshot would ask the leader to send messages
which indexes (first/last) are in the snapshot.
Both leader and node would stop the restore when the first unavail
message was found.

Resolves #834

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 92.043% when pulling 6689b0b on fix_834 into f03fa10 on master.

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kozlovic kozlovic merged commit 7b9c7fe into master May 14, 2019
@kozlovic kozlovic deleted the fix_834 branch May 14, 2019 16:47
kozlovic added a commit that referenced this pull request May 21, 2019
PR #835 fixed an issue with restoreMsgsFromSnapshot when there
were unavailable messages (expired or removed due to limits).
However, the implementation was not optimized when lots of
messages are no longer available. Also, it would not be backward
compatible with older servers.

This change detects if two servers are 0.14.1+ and can then
send the first available sequence if the leader does not find
the requested message.
With this code change, a follower that requests messages to a
leader that is of previous version will handle unavailable
messages in an optimized way. It will first send few requests
starting at the next sequence but then will try to do a binary
search but first ask the leader for the last message on its
range. If this message is not found, then that means all messages
in the range have expired.

After several releases, when we deem reasonable that all servers
should be at 0.14.2+, we could remove some of the complexity
in this PR.

Resolves #834

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
kozlovic added a commit that referenced this pull request May 21, 2019
PR #835 fixed an issue with restoreMsgsFromSnapshot when there
were unavailable messages (expired or removed due to limits).
However, the implementation was not optimized when lots of
messages are no longer available. Also, it would not be backward
compatible with older servers.

This change detects if two servers are 0.14.1+ and can then
send the first available sequence if the leader does not find
the requested message.
With this code change, a follower that requests messages to a
leader that is of previous version will handle unavailable
messages in an optimized way. It will first send few requests
starting at the next sequence but then will try to do a binary
search but first ask the leader for the last message on its
range. If this message is not found, then that means all messages
in the range have expired.

After several releases, when we deem reasonable that all servers
should be at 0.14.2+, we could remove some of the complexity
in this PR.

Resolves #834

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clustering: snapshot not properly restored if oldest messages no longer avail
3 participants