-
Notifications
You must be signed in to change notification settings - Fork 179
Delete temp checkpoint folder on error. #415
Delete temp checkpoint folder on error. #415
Conversation
cc @codesome |
block.go
Outdated
@@ -212,7 +213,7 @@ func writeMetaFile(dir string, meta *BlockMeta) error { | |||
|
|||
// Make any changes to the file appear atomic. | |||
path := filepath.Join(dir, metaFilename) | |||
tmp := path + ".tmp" | |||
tmp := path + fileutil.TmpExt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of manually appending fileutil.TmpExt
everywhere, would it be better to have a function call like fileutil.TmpDir
which would take the dir
and append fileutil.TmpExt
to it? In case we want to change the logic of naming temp dir, this would come handy (example ioutil.TempDir
).
package fileutil
func TmpDir(dir string) string {
return dir + TmpExt
}
tmp := fileutil.TmpDir(path)
fileutil.TmpExt
would still be present if it is needed somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I like the idea, but I prefer to be more explicit and tmp := fileutil.TmpDir(path)
might be a bit strange. What does it do? create a tmp dir? copies to a tmp dir ?
refactoring is easy enough so lets keep as is and will change if needed.
26371af
to
5e39851
Compare
@gouthamve just when I was about to leave it to the windows users to fix 😜 |
1ae9c81
to
ae479c8
Compare
after having another look it is a terrible solution and very likely to brake but will keep it open as a reminder to think how ti fix properly for linux and windows. |
Signed-off-by: Krasi Georgiev <[email protected]>
ae479c8
to
3b34b81
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
Refactored with a different approach. |
cc @codesome |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.