mirror of
https://github.com/etcd-io/bbolt.git
synced 2025-05-31 11:42:30 +00:00
Wait to clear db.path until just before db.close returns.
The Windows version of funlock needs the db.path to delete the corresponding .lock file.
This commit is contained in:
parent
831b652a7f
commit
5816124570
6
db.go
6
db.go
@ -94,7 +94,7 @@ type DB struct {
|
|||||||
path string
|
path string
|
||||||
file *os.File
|
file *os.File
|
||||||
lockfile *os.File // windows only
|
lockfile *os.File // windows only
|
||||||
dataref []byte // mmap'ed readonly, write throws SEGV
|
dataref []byte // mmap'ed readonly, write throws SEGV
|
||||||
data *[maxMapSize]byte
|
data *[maxMapSize]byte
|
||||||
datasz int
|
datasz int
|
||||||
filesz int // current on disk file size
|
filesz int // current on disk file size
|
||||||
@ -383,11 +383,10 @@ func (db *DB) close() error {
|
|||||||
if !db.opened {
|
if !db.opened {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
db.opened = false
|
db.opened = false
|
||||||
|
|
||||||
db.freelist = nil
|
db.freelist = nil
|
||||||
db.path = ""
|
|
||||||
|
|
||||||
// Clear ops.
|
// Clear ops.
|
||||||
db.ops.writeAt = nil
|
db.ops.writeAt = nil
|
||||||
@ -414,6 +413,7 @@ func (db *DB) close() error {
|
|||||||
db.file = nil
|
db.file = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.path = ""
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user