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

fix: destFile may be not exist #243

Merged
merged 8 commits into from
Aug 2, 2023
Merged

fix: destFile may be not exist #243

merged 8 commits into from
Aug 2, 2023

Conversation

Jeremy-Run
Copy link
Contributor

fix bug destFile may be not exist.

merge.go Outdated
@@ -275,6 +275,15 @@ func loadMergeFiles(dirPath string) error {
// should be moved to the original data directory, and the original data files should be deleted.
for fileId := uint32(1); fileId <= mergeFinSegmentId; fileId++ {
destFile := wal.SegmentFileName(dirPath, dataFileNameSuffix, fileId)
_, err = os.Stat(destFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

if _, err = os.Stat(destFile); os.IsNotExist(err) {
   contine
}

this will be more clear?

Or you can add a utility function named FileExists(or something like this) in util/file.go.

BTW, we just skip to remove the file, but I also want to make sure is there any other logic bugs in this case?
Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'll add a unit test

@roseduan roseduan merged commit 95dd220 into rosedblabs:main Aug 2, 2023
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