Browse Source

consensus: open target WAL as read/write during autorepair (#5536)

Fixes #5422. That turned out to be a whole lot easier than expected.
pull/5543/head
Erik Grinaker 4 years ago
committed by GitHub
parent
commit
17383be202
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      CHANGELOG_PENDING.md
  2. +3
    -3
      consensus/state.go

+ 1
- 1
CHANGELOG_PENDING.md View File

@ -28,6 +28,6 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
- [blockchain/v2] \#5499 Fix "duplicate block enqueued by processor" panic (@melekes)
- [abci/grpc] \#5520 Return async responses in order, to avoid mempool panics. (@erikgrinaker)
- [types] \#5523 Change json naming of `PartSetHeader` within `BlockID` from `parts` to `part_set_header` (@marbar3778)
- [blockchain/v2] \#5530 Fix "processed height 4541 but expected height 4540" panic (@melekes)
- [consensus/wal] Fix WAL autorepair by opening target WAL in read/write mode (@erikgrinaker)

+ 3
- 3
consensus/state.go View File

@ -328,7 +328,7 @@ func (cs *State) OnStart() error {
return err
}
cs.Logger.Info("WAL file is corrupted. Attempting repair", "err", err)
cs.Logger.Error("WAL file is corrupted, attempting repair", "err", err)
// 1) prep work
if err := cs.wal.Stop(); err != nil {
@ -345,7 +345,7 @@ func (cs *State) OnStart() error {
// 3) try to repair (WAL file will be overwritten!)
if err := repairWalFile(corruptedFile, cs.config.WalFile()); err != nil {
cs.Logger.Error("Repair failed", "err", err)
cs.Logger.Error("WAL repair failed", "err", err)
return err
}
cs.Logger.Info("Successful repair")
@ -2215,7 +2215,7 @@ func repairWalFile(src, dst string) error {
}
defer in.Close()
out, err := os.Open(dst)
out, err := os.Create(dst)
if err != nil {
return err
}


Loading…
Cancel
Save