forked from mirror/ledisdb
closure defer not works as I think
This commit is contained in:
parent
1583ae90fc
commit
e3c2102080
|
@ -46,21 +46,22 @@ func (l *Ledis) Dump(w io.Writer) error {
|
||||||
var commitID uint64
|
var commitID uint64
|
||||||
var snap *store.Snapshot
|
var snap *store.Snapshot
|
||||||
|
|
||||||
{
|
l.wLock.Lock()
|
||||||
l.wLock.Lock()
|
|
||||||
defer l.wLock.Unlock()
|
|
||||||
|
|
||||||
if l.r != nil {
|
if l.r != nil {
|
||||||
if commitID, err = l.r.LastCommitID(); err != nil {
|
if commitID, err = l.r.LastCommitID(); err != nil {
|
||||||
return err
|
l.wLock.Unlock()
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if snap, err = l.ldb.NewSnapshot(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if snap, err = l.ldb.NewSnapshot(); err != nil {
|
||||||
|
l.wLock.Unlock()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
l.wLock.Unlock()
|
||||||
|
|
||||||
wb := bufio.NewWriterSize(w, 4096)
|
wb := bufio.NewWriterSize(w, 4096)
|
||||||
|
|
||||||
h := &DumpHead{commitID}
|
h := &DumpHead{commitID}
|
||||||
|
|
Loading…
Reference in New Issue