wal: gr.Close()
This commit is contained in:
parent
cd9e9e9f45
commit
2ba3656ffd
|
@ -104,12 +104,12 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
|
||||||
// NOTE: This is just a sanity check. As far as we know things work fine without it,
|
// NOTE: This is just a sanity check. As far as we know things work fine without it,
|
||||||
// and Handshake could reuse ConsensusState if it weren't for this check (since we can crash after writing ENDHEIGHT).
|
// and Handshake could reuse ConsensusState if it weren't for this check (since we can crash after writing ENDHEIGHT).
|
||||||
gr, found, err := cs.wal.group.Search("#ENDHEIGHT: ", makeHeightSearchFunc(csHeight))
|
gr, found, err := cs.wal.group.Search("#ENDHEIGHT: ", makeHeightSearchFunc(csHeight))
|
||||||
if found {
|
|
||||||
return errors.New(Fmt("WAL should not contain #ENDHEIGHT %d.", csHeight))
|
|
||||||
}
|
|
||||||
if gr != nil {
|
if gr != nil {
|
||||||
gr.Close()
|
gr.Close()
|
||||||
}
|
}
|
||||||
|
if found {
|
||||||
|
return errors.New(Fmt("WAL should not contain #ENDHEIGHT %d.", csHeight))
|
||||||
|
}
|
||||||
|
|
||||||
// Search for last height marker
|
// Search for last height marker
|
||||||
gr, found, err = cs.wal.group.Search("#ENDHEIGHT: ", makeHeightSearchFunc(csHeight-1))
|
gr, found, err = cs.wal.group.Search("#ENDHEIGHT: ", makeHeightSearchFunc(csHeight-1))
|
||||||
|
@ -128,6 +128,7 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !found {
|
if !found {
|
||||||
|
gr.Close()
|
||||||
// if we upgraded from 0.9 to 0.9.1, we may have #HEIGHT instead
|
// if we upgraded from 0.9 to 0.9.1, we may have #HEIGHT instead
|
||||||
// TODO (0.10.0): remove this
|
// TODO (0.10.0): remove this
|
||||||
gr, found, err = cs.wal.group.Search("#HEIGHT: ", makeHeightSearchFunc(csHeight))
|
gr, found, err = cs.wal.group.Search("#HEIGHT: ", makeHeightSearchFunc(csHeight))
|
||||||
|
|
Loading…
Reference in New Issue