mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 05:25:35 +00:00
config: Move discard_abci_responses flag into its own storage section (#9275)
* config: Move discard_abci_responses flag into its own storage section Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update config comment to highlight space saving tradeoff Signed-off-by: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -78,7 +78,7 @@ func loadStateAndBlockStore(config *cfg.Config) (*store.BlockStore, state.Store,
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
stateStore := state.NewStore(stateDB, state.StoreOptions{
|
stateStore := state.NewStore(stateDB, state.StoreOptions{
|
||||||
DiscardABCIResponses: config.RPC.DiscardABCIResponses,
|
DiscardABCIResponses: config.Storage.DiscardABCIResponses,
|
||||||
})
|
})
|
||||||
|
|
||||||
return blockStore, stateStore, nil
|
return blockStore, stateStore, nil
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ type Config struct {
|
|||||||
StateSync *StateSyncConfig `mapstructure:"statesync"`
|
StateSync *StateSyncConfig `mapstructure:"statesync"`
|
||||||
FastSync *FastSyncConfig `mapstructure:"fastsync"`
|
FastSync *FastSyncConfig `mapstructure:"fastsync"`
|
||||||
Consensus *ConsensusConfig `mapstructure:"consensus"`
|
Consensus *ConsensusConfig `mapstructure:"consensus"`
|
||||||
|
Storage *StorageConfig `mapstructure:"storage"`
|
||||||
TxIndex *TxIndexConfig `mapstructure:"tx_index"`
|
TxIndex *TxIndexConfig `mapstructure:"tx_index"`
|
||||||
Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"`
|
Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"`
|
||||||
}
|
}
|
||||||
@@ -88,6 +89,7 @@ func DefaultConfig() *Config {
|
|||||||
StateSync: DefaultStateSyncConfig(),
|
StateSync: DefaultStateSyncConfig(),
|
||||||
FastSync: DefaultFastSyncConfig(),
|
FastSync: DefaultFastSyncConfig(),
|
||||||
Consensus: DefaultConsensusConfig(),
|
Consensus: DefaultConsensusConfig(),
|
||||||
|
Storage: DefaultStorageConfig(),
|
||||||
TxIndex: DefaultTxIndexConfig(),
|
TxIndex: DefaultTxIndexConfig(),
|
||||||
Instrumentation: DefaultInstrumentationConfig(),
|
Instrumentation: DefaultInstrumentationConfig(),
|
||||||
}
|
}
|
||||||
@@ -103,6 +105,7 @@ func TestConfig() *Config {
|
|||||||
StateSync: TestStateSyncConfig(),
|
StateSync: TestStateSyncConfig(),
|
||||||
FastSync: TestFastSyncConfig(),
|
FastSync: TestFastSyncConfig(),
|
||||||
Consensus: TestConsensusConfig(),
|
Consensus: TestConsensusConfig(),
|
||||||
|
Storage: TestStorageConfig(),
|
||||||
TxIndex: TestTxIndexConfig(),
|
TxIndex: TestTxIndexConfig(),
|
||||||
Instrumentation: TestInstrumentationConfig(),
|
Instrumentation: TestInstrumentationConfig(),
|
||||||
}
|
}
|
||||||
@@ -405,11 +408,6 @@ type RPCConfig struct {
|
|||||||
|
|
||||||
// pprof listen address (https://golang.org/pkg/net/http/pprof)
|
// pprof listen address (https://golang.org/pkg/net/http/pprof)
|
||||||
PprofListenAddress string `mapstructure:"pprof_laddr"`
|
PprofListenAddress string `mapstructure:"pprof_laddr"`
|
||||||
|
|
||||||
// Set false to ensure ABCI responses are persisted.
|
|
||||||
// ABCI responses are required for /BlockResults RPC queries, and
|
|
||||||
// to reindex events in the command-line tool.
|
|
||||||
DiscardABCIResponses bool `mapstructure:"discard_abci_responses"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultRPCConfig returns a default configuration for the RPC server
|
// DefaultRPCConfig returns a default configuration for the RPC server
|
||||||
@@ -434,9 +432,8 @@ func DefaultRPCConfig() *RPCConfig {
|
|||||||
MaxBodyBytes: int64(1000000), // 1MB
|
MaxBodyBytes: int64(1000000), // 1MB
|
||||||
MaxHeaderBytes: 1 << 20, // same as the net/http default
|
MaxHeaderBytes: 1 << 20, // same as the net/http default
|
||||||
|
|
||||||
TLSCertFile: "",
|
TLSCertFile: "",
|
||||||
TLSKeyFile: "",
|
TLSKeyFile: "",
|
||||||
DiscardABCIResponses: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1076,6 +1073,34 @@ func (cfg *ConsensusConfig) ValidateBasic() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// StorageConfig
|
||||||
|
|
||||||
|
// StorageConfig allows more fine-grained control over certain storage-related
|
||||||
|
// behavior.
|
||||||
|
type StorageConfig struct {
|
||||||
|
// Set to false to ensure ABCI responses are persisted. ABCI responses are
|
||||||
|
// required for `/block_results` RPC queries, and to reindex events in the
|
||||||
|
// command-line tool.
|
||||||
|
DiscardABCIResponses bool `mapstructure:"discard_abci_responses"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultStorageConfig returns the default configuration options relating to
|
||||||
|
// Tendermint storage optimization.
|
||||||
|
func DefaultStorageConfig() *StorageConfig {
|
||||||
|
return &StorageConfig{
|
||||||
|
DiscardABCIResponses: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestStorageConfig returns storage configuration that can be used for
|
||||||
|
// testing.
|
||||||
|
func TestStorageConfig() *StorageConfig {
|
||||||
|
return &StorageConfig{
|
||||||
|
DiscardABCIResponses: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// TxIndexConfig
|
// TxIndexConfig
|
||||||
// Remember that Event has the following structure:
|
// Remember that Event has the following structure:
|
||||||
|
|||||||
@@ -263,9 +263,6 @@ tls_key_file = "{{ .RPC.TLSKeyFile }}"
|
|||||||
# pprof listen address (https://golang.org/pkg/net/http/pprof)
|
# pprof listen address (https://golang.org/pkg/net/http/pprof)
|
||||||
pprof_laddr = "{{ .RPC.PprofListenAddress }}"
|
pprof_laddr = "{{ .RPC.PprofListenAddress }}"
|
||||||
|
|
||||||
# Flag that enables discarding of abci responses
|
|
||||||
discard_abci_responses = {{ .RPC.DiscardABCIResponses}}
|
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
### P2P Configuration Options ###
|
### P2P Configuration Options ###
|
||||||
#######################################################
|
#######################################################
|
||||||
@@ -483,6 +480,16 @@ create_empty_blocks_interval = "{{ .Consensus.CreateEmptyBlocksInterval }}"
|
|||||||
peer_gossip_sleep_duration = "{{ .Consensus.PeerGossipSleepDuration }}"
|
peer_gossip_sleep_duration = "{{ .Consensus.PeerGossipSleepDuration }}"
|
||||||
peer_query_maj23_sleep_duration = "{{ .Consensus.PeerQueryMaj23SleepDuration }}"
|
peer_query_maj23_sleep_duration = "{{ .Consensus.PeerQueryMaj23SleepDuration }}"
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
### Storage Configuration Options ###
|
||||||
|
#######################################################
|
||||||
|
|
||||||
|
# Set to true to discard ABCI responses from the state store, which can save a
|
||||||
|
# considerable amount of disk space. Set to false to ensure ABCI responses are
|
||||||
|
# persisted. ABCI responses are required for /block_results RPC queries, and to
|
||||||
|
# reindex events in the command-line tool.
|
||||||
|
discard_abci_responses = {{ .Storage.DiscardABCIResponses}}
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
### Transaction Indexer Configuration Options ###
|
### Transaction Indexer Configuration Options ###
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ func createEvidenceReactor(config *cfg.Config, dbProvider DBProvider,
|
|||||||
}
|
}
|
||||||
evidenceLogger := logger.With("module", "evidence")
|
evidenceLogger := logger.With("module", "evidence")
|
||||||
evidencePool, err := evidence.NewPool(evidenceDB, sm.NewStore(stateDB, sm.StoreOptions{
|
evidencePool, err := evidence.NewPool(evidenceDB, sm.NewStore(stateDB, sm.StoreOptions{
|
||||||
DiscardABCIResponses: config.RPC.DiscardABCIResponses,
|
DiscardABCIResponses: config.Storage.DiscardABCIResponses,
|
||||||
}), blockStore)
|
}), blockStore)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@@ -720,7 +720,7 @@ func NewNode(config *cfg.Config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
stateStore := sm.NewStore(stateDB, sm.StoreOptions{
|
stateStore := sm.NewStore(stateDB, sm.StoreOptions{
|
||||||
DiscardABCIResponses: config.RPC.DiscardABCIResponses,
|
DiscardABCIResponses: config.Storage.DiscardABCIResponses,
|
||||||
})
|
})
|
||||||
|
|
||||||
state, genDoc, err := LoadStateFromDBOrGenesisDocProvider(stateDB, genesisDocProvider)
|
state, genDoc, err := LoadStateFromDBOrGenesisDocProvider(stateDB, genesisDocProvider)
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ func createEvidenceReactor(config *cfg.Config, dbProvider DBProvider,
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
stateStore := sm.NewStore(stateDB, sm.StoreOptions{
|
stateStore := sm.NewStore(stateDB, sm.StoreOptions{
|
||||||
DiscardABCIResponses: config.RPC.DiscardABCIResponses,
|
DiscardABCIResponses: config.Storage.DiscardABCIResponses,
|
||||||
})
|
})
|
||||||
evidenceLogger := logger.With("module", "evidence")
|
evidenceLogger := logger.With("module", "evidence")
|
||||||
evidencePool, err := evidence.NewPool(evidenceDB, stateStore, blockStore)
|
evidencePool, err := evidence.NewPool(evidenceDB, stateStore, blockStore)
|
||||||
|
|||||||
Reference in New Issue
Block a user