consensus: wal.Flush() and cleanup replay tests

This commit is contained in:
Ethan Buchman
2016-12-17 23:43:17 -05:00
parent f33cc3fb3b
commit dcbb35089f
2 changed files with 35 additions and 38 deletions

View File

@ -79,7 +79,6 @@ func (wal *WAL) Save(wmsg WALMessage) {
if wal.light {
// in light mode we only write new steps, timeouts, and our own votes (no proposals, block parts)
if mi, ok := wmsg.(msgInfo); ok {
_ = mi
if mi.PeerKey != "" {
return
}
@ -97,6 +96,10 @@ func (wal *WAL) Save(wmsg WALMessage) {
if err != nil {
PanicQ(Fmt("Error writing msg to consensus wal. Error: %v \n\nMessage: %v", err, wmsg))
}
// TODO: only flush when necessary
if err := wal.group.Flush(); err != nil {
PanicQ(Fmt("Error flushing consensus wal buf to file. Error: %v \n", err))
}
}
func (wal *WAL) writeHeight(height int) {