Browse Source

defer gr.Close() fixes

pull/449/head
Jae Kwon 8 years ago
committed by Ethan Buchman
parent
commit
cf4074cc80
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      consensus/replay.go

+ 4
- 2
consensus/replay.go View File

@ -126,9 +126,10 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
} }
} else if err != nil { } else if err != nil {
return err return err
} else {
defer gr.Close()
} }
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))
@ -137,12 +138,13 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
return nil return nil
} else if err != nil { } else if err != nil {
return err return err
} else {
defer gr.Close()
} }
// TODO (0.10.0): uncomment // TODO (0.10.0): uncomment
// return errors.New(Fmt("Cannot replay height %d. WAL does not contain #ENDHEIGHT for %d.", csHeight, csHeight-1)) // return errors.New(Fmt("Cannot replay height %d. WAL does not contain #ENDHEIGHT for %d.", csHeight, csHeight-1))
} }
defer gr.Close()
log.Notice("Catchup by replaying consensus messages", "height", csHeight) log.Notice("Catchup by replaying consensus messages", "height", csHeight)


Loading…
Cancel
Save