Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Delay clearing db.path until just before db.close returns. #550

Merged
merged 1 commit into from
Apr 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type DB struct {
path string
file *os.File
lockfile *os.File // windows only
dataref []byte // mmap'ed readonly, write throws SEGV
dataref []byte // mmap'ed readonly, write throws SEGV
data *[maxMapSize]byte
datasz int
filesz int // current on disk file size
Expand Down Expand Up @@ -383,11 +383,10 @@ func (db *DB) close() error {
if !db.opened {
return nil
}

db.opened = false

db.freelist = nil
db.path = ""

// Clear ops.
db.ops.writeAt = nil
Expand All @@ -414,6 +413,7 @@ func (db *DB) close() error {
db.file = nil
}

db.path = ""
return nil
}

Expand Down