Skip to content

Commit

Permalink
avoid deleting WAL with inconsistent state; #32 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Preetam authored Jun 28, 2017
1 parent 6127274 commit 94a55df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lm2.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,10 @@ func (c *Collection) Close() {
defer c.metaLock.Unlock()
c.f.Close()
c.wal.Close()
c.wal.Destroy()
if atomic.LoadUint32(&c.internalState) == 0 {
// Internal state is OK. Safe to delete WAL.
c.wal.Destroy()
}
}

// Version returns the last committed version.
Expand Down

0 comments on commit 94a55df

Please sign in to comment.