1
0
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:
panyun 2019-07-23 11:27:14 +08:00 committed by James Mills
parent 47ad6601f3
commit fd2023ee38

View File

@ -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()