-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(storagenode): accept SyncInit sent from trimmed source to new des…
…tination Storage nodes can be trimmed and synchronized. However, there is some bug in that a new destination replica joined into the log stream rejects SyncInit RPC sent from the trimmed source replica. Those replicas are all empty and have no log entries; however, the source replica has a commit context indicating the last committed LLSN. In this situation, the destination replica must accept SyncInit to receive the commit context from the source replica, but it does not. This PR fixes the above issue. To solve the problem, it changes the condition that the destination replica decides whether they are already synchronized. ```go // Previous code: https://github.com/kakao/varlog/blob/5269481c0e80c2eebf8214116a2d1544a26cb443/internal/storagenode/logstream/sync.go#L297-L302 // // NOTE: When the replica has all log entries, it returns its range of logs and non-error results. // In this case, this replica remains executorStateSealing. // Breaking change: previously it returns ErrExist when the replica has all log entries to replicate. if dstLastCommittedLLSN == srcRange.LastLLSN && !invalid { return snpb.SyncRange{}, status.Errorf(codes.AlreadyExists, "already synchronized") } ``` Since both replicas have no log entries, the condition `dstLastCommittedLLSN == srcRange.LastLLSN` is not enough. This PR changed the condition to be `dstLastCommittedLLSN == srcLastCommittedLLSN && dstLastCommittedLLSN == srcRange.LastLLSN`. Since the `srcLastCommittedLLSN` is valid regardless of log entries in the source replica, the destination replica will accept the SyncInit. Resolve #478
- Loading branch information
Showing
5 changed files
with
164 additions
and
48 deletions.
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