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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

return index, previousOffset, nil
}
previousOffset = startingOffset
}
return -1, -1, errors.New("offset doesn't exsist")
}
Expand Down
Loading