mirror of
https://github.com/taigrr/bitcask
synced 2025-01-18 04:03:17 -08:00
Fix issue(db file Merge issue in windows env): (#15)
* Fix issue(windows env): 1. Run my program firstly, it will create my.db folder normaly. 2. Close my program and restart it again, I will receive an error. * Fix coding format issue * Change the last fixing with @prologic suggestion.
This commit is contained in:
parent
47ad6601f3
commit
fd2023ee38
@ -91,12 +91,14 @@ func (df *Datafile) Name() string {
|
||||
}
|
||||
|
||||
func (df *Datafile) Close() error {
|
||||
defer func() {
|
||||
df.ra.Close()
|
||||
df.r.Close()
|
||||
}()
|
||||
|
||||
// Readonly Datafile -- Nothing further to close on the write side
|
||||
if df.w == nil {
|
||||
err := df.ra.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return df.r.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
err := df.Sync()
|
||||
|
Loading…
x
Reference in New Issue
Block a user