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

Update wal.go #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update wal.go #7

wants to merge 1 commit into from

Conversation

yanmaipian
Copy link
Contributor

fix previousOffset is always less than offset

logic error
@yanmaipian
Copy link
Contributor Author

Fix the logic error that previousOffset is always less than offset

@@ -389,10 +389,10 @@ func (wal *WriteAheadLog) findStartingLogFile(offset int64, files []string) (i i
if err != nil {
return -1, -1, err
}
if previousOffset <= offset && offset <= startingOffset {

if offset <= startingOffset {
Copy link
Owner

Choose a reason for hiding this comment

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

The format for the file name is wal.{file_Count}.{starting_offset_in_wal_file}
Here starting_offset_in_wal_file tells us what offset the file starts from. We later increment this in the func (wal *WriteAheadLog) Replay. This offset helps us to maintain the track of the offset so far.

With the changes you have proposed, we are not updating this offset.

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.

2 participants