You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.4 KiB

  1. # WAL
  2. Consensus module writes every message to the WAL (write-ahead log).
  3. It also issues fsync syscall through
  4. [File#Sync](https://golang.org/pkg/os/#File.Sync) for messages signed by this
  5. node (to prevent double signing).
  6. Under the hood, it uses
  7. [autofile.Group](https://godoc.org/github.com/tendermint/tmlibs/autofile#Group),
  8. which rotates files when those get too big (> 10MB).
  9. The total maximum size is 1GB. We only need the latest block and the block before it,
  10. but if the former is dragging on across many rounds, we want all those rounds.
  11. ## Replay
  12. Consensus module will replay all the messages of the last height written to WAL
  13. before a crash (if such occurs).
  14. The private validator may try to sign messages during replay because it runs
  15. somewhat autonomously and does not know about replay process.
  16. For example, if we got all the way to precommit in the WAL and then crash,
  17. after we replay the proposal message, the private validator will try to sign a
  18. prevote. But it will fail. That's ok because we’ll see the prevote later in the
  19. WAL. Then it will go to precommit, and that time it will work because the
  20. private validator contains the `LastSignBytes` and then we’ll replay the
  21. precommit from the WAL.
  22. Make sure to read about [WAL corruption](https://github.com/tendermint/tendermint/blob/master/docs/tendermint-core/running-in-production.md#wal-corruption)
  23. and recovery strategies.