From e88f74bb9bb9edb9c311f256037fcca217b45ab6 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 9 Apr 2018 16:32:43 +0200 Subject: [PATCH] remove wal_light setting Closes #1428 --- CHANGELOG.md | 2 ++ config/config.go | 8 +++----- config/toml.go | 1 - consensus/replay_test.go | 4 ++-- consensus/state.go | 2 +- consensus/wal.go | 15 ++------------- consensus/wal_test.go | 2 +- docs/specification/configuration.rst | 1 - 8 files changed, 11 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f54c9805d..e96dd4cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ See github.com/tendermint/go-amino for details on the new format. See `scripts/wire2amino.go` for a tool to upgrade genesis/priv_validator/node_key JSON files. +- [config] removed `wal_light` setting + ## 0.18.0 (April 6th, 2018) BREAKING: diff --git a/config/config.go b/config/config.go index e83e9e51d..b76f5ed19 100644 --- a/config/config.go +++ b/config/config.go @@ -367,10 +367,9 @@ func (cfg *MempoolConfig) WalDir() string { // ConsensusConfig defines the confuguration for the Tendermint consensus service, // including timeouts and details about the WAL and the block structure. type ConsensusConfig struct { - RootDir string `mapstructure:"home"` - WalPath string `mapstructure:"wal_file"` - WalLight bool `mapstructure:"wal_light"` - walFile string // overrides WalPath if set + RootDir string `mapstructure:"home"` + WalPath string `mapstructure:"wal_file"` + walFile string // overrides WalPath if set // All timeouts are in milliseconds TimeoutPropose int `mapstructure:"timeout_propose"` @@ -401,7 +400,6 @@ type ConsensusConfig struct { func DefaultConsensusConfig() *ConsensusConfig { return &ConsensusConfig{ WalPath: filepath.Join(defaultDataDir, "cs.wal", "wal"), - WalLight: false, TimeoutPropose: 3000, TimeoutProposeDelta: 500, TimeoutPrevote: 1000, diff --git a/config/toml.go b/config/toml.go index f10c08ab3..a084cc592 100644 --- a/config/toml.go +++ b/config/toml.go @@ -178,7 +178,6 @@ wal_dir = "{{ .Mempool.WalPath }}" [consensus] wal_file = "{{ .Consensus.WalPath }}" -wal_light = {{ .Consensus.WalLight }} # All timeouts are in milliseconds timeout_propose = {{ .Consensus.TimeoutPropose }} diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 75f208bb6..c706cef0c 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -17,7 +17,7 @@ import ( "github.com/tendermint/abci/example/kvstore" abci "github.com/tendermint/abci/types" - "github.com/tendermint/go-crypto" + crypto "github.com/tendermint/go-crypto" auto "github.com/tendermint/tmlibs/autofile" cmn "github.com/tendermint/tmlibs/common" dbm "github.com/tendermint/tmlibs/db" @@ -327,7 +327,7 @@ func testHandshakeReplay(t *testing.T, nBlocks int, mode uint) { privVal := pvm.LoadFilePV(config.PrivValidatorFile()) - wal, err := NewWAL(walFile, false) + wal, err := NewWAL(walFile) if err != nil { t.Fatal(err) } diff --git a/consensus/state.go b/consensus/state.go index 2e97c4953..bd069f70c 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -293,7 +293,7 @@ func (cs *ConsensusState) Wait() { // OpenWAL opens a file to log all consensus messages and timeouts for deterministic accountability func (cs *ConsensusState) OpenWAL(walFile string) (WAL, error) { - wal, err := NewWAL(walFile, cs.config.WalLight) + wal, err := NewWAL(walFile) if err != nil { cs.Logger.Error("Failed to open WAL for consensus state", "wal", walFile, "err", err) return nil, err diff --git a/consensus/wal.go b/consensus/wal.go index 694e2516e..d22c3ea1f 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -10,7 +10,7 @@ import ( "github.com/pkg/errors" - "github.com/tendermint/go-amino" + amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/types" auto "github.com/tendermint/tmlibs/autofile" cmn "github.com/tendermint/tmlibs/common" @@ -67,12 +67,11 @@ type baseWAL struct { cmn.BaseService group *auto.Group - light bool // ignore block parts enc *WALEncoder } -func NewWAL(walFile string, light bool) (*baseWAL, error) { +func NewWAL(walFile string) (*baseWAL, error) { err := cmn.EnsureDir(filepath.Dir(walFile), 0700) if err != nil { return nil, errors.Wrap(err, "failed to ensure WAL directory is in place") @@ -84,7 +83,6 @@ func NewWAL(walFile string, light bool) (*baseWAL, error) { } wal := &baseWAL{ group: group, - light: light, enc: NewWALEncoder(group), } wal.BaseService = *cmn.NewBaseService(nil, "baseWAL", wal) @@ -117,15 +115,6 @@ func (wal *baseWAL) Save(msg WALMessage) { return } - if wal.light { - // in light mode we only write new steps, timeouts, and our own votes (no proposals, block parts) - if mi, ok := msg.(msgInfo); ok { - if mi.PeerID != "" { - return - } - } - } - // Write the wal message if err := wal.enc.Encode(&TimedWALMessage{time.Now(), msg}); err != nil { cmn.PanicQ(cmn.Fmt("Error writing msg to consensus wal: %v \n\nMessage: %v", err, msg)) diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 45af36e12..eebbc85a2 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -47,7 +47,7 @@ func TestWALSearchForEndHeight(t *testing.T) { } walFile := tempWALWithData(walBody) - wal, err := NewWAL(walFile, false) + wal, err := NewWAL(walFile) if err != nil { t.Fatal(err) } diff --git a/docs/specification/configuration.rst b/docs/specification/configuration.rst index 2a9ad794e..6b52dbd1e 100644 --- a/docs/specification/configuration.rst +++ b/docs/specification/configuration.rst @@ -140,7 +140,6 @@ like the file below, however, double check by inspecting the [consensus] wal_file = "data/cs.wal/wal" - wal_light = false # All timeouts are in milliseconds timeout_propose = 3000