Compare commits

..

2 Commits

Author SHA1 Message Date
c0c0b5369a Update CHANGELOG for v0.3.9 2020-11-17 19:30:54 +10:00
720f03c6c2 Fix a race condition around .Close() and .Sync() 2020-11-17 19:30:44 +10:00
2 changed files with 18 additions and 1 deletions

View File

@@ -1,6 +1,18 @@
<a name="v0.3.9"></a>
## [v0.3.9](https://github.com/prologic/bitcask/compare/v0.3.8...v0.3.9) (2020-11-17)
### Bug Fixes
* Fix a race condition around .Close() and .Sync()
<a name="v0.3.8"></a>
## [v0.3.8](https://github.com/prologic/bitcask/compare/v0.3.7...v0.3.8) (0001-01-01)
## [v0.3.8](https://github.com/prologic/bitcask/compare/v0.3.7...v0.3.8) (2020-11-17)
### Updates
* Update CHANGELOG for v0.3.8
<a name="v0.3.7"></a>

View File

@@ -87,7 +87,10 @@ func (b *Bitcask) Stats() (stats Stats, err error) {
// Close() as this is the only way to cleanup the lock held by the open
// database.
func (b *Bitcask) Close() error {
b.mu.RLock()
defer func() {
b.mu.RUnlock()
b.Flock.Unlock()
os.Remove(b.Flock.Path())
}()
@@ -107,6 +110,8 @@ func (b *Bitcask) Close() error {
// Sync flushes all buffers to disk ensuring all data is written
func (b *Bitcask) Sync() error {
b.mu.RLock()
defer b.mu.RUnlock()
return b.curr.Sync()
}