mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
set triedb.journal as a switch
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
fef157dde2
commit
3cc8e23b6a
4 changed files with 13 additions and 18 deletions
|
|
@ -448,10 +448,10 @@ var (
|
|||
}
|
||||
|
||||
// Trie database settings
|
||||
TrieDBJournalFlag = &cli.StringFlag{
|
||||
TrieDBJournalFlag = &cli.BoolFlag{
|
||||
Name: "triedb.journal",
|
||||
Usage: "Path to the journal used for persisting trie data across node restarts",
|
||||
Value: ethconfig.Defaults.TrieDBJournal,
|
||||
Usage: "Enable persisting the trie database journal to disk (only used with pbss state scheme, default path: <datadir>/triedb.journal.rlp)",
|
||||
Value: true,
|
||||
Category: flags.TrieDatabaseCategory,
|
||||
}
|
||||
|
||||
|
|
@ -1654,6 +1654,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
if ctx.IsSet(StateSchemeFlag.Name) {
|
||||
cfg.StateScheme = ctx.String(StateSchemeFlag.Name)
|
||||
}
|
||||
if !ctx.Bool(TrieDBJournalFlag.Name) {
|
||||
cfg.TrieDBJournal = false
|
||||
}
|
||||
// Parse transaction history flag, if user is still using legacy config
|
||||
// file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'.
|
||||
if cfg.TransactionHistory == ethconfig.Defaults.TransactionHistory && cfg.TxLookupLimit != ethconfig.Defaults.TxLookupLimit {
|
||||
|
|
@ -1690,9 +1693,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
|
||||
cfg.SnapshotCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
|
||||
}
|
||||
if ctx.IsSet(TrieDBJournalFlag.Name) {
|
||||
cfg.TrieDBJournal = ctx.String(TrieDBJournalFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(CacheLogSizeFlag.Name) {
|
||||
cfg.FilterLogCacheSize = ctx.Int(CacheLogSizeFlag.Name)
|
||||
}
|
||||
|
|
@ -2216,12 +2216,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
|||
options.Preimages = true
|
||||
log.Info("Enabling recording of key preimages since archive mode is used")
|
||||
}
|
||||
journal := ethconfig.Defaults.TrieDBJournal
|
||||
if ctx.IsSet(TrieDBJournalFlag.Name) {
|
||||
journal = ctx.String(TrieDBJournalFlag.Name)
|
||||
}
|
||||
if journal != "" {
|
||||
options.TrieDBJournal = stack.ResolvePath(journal)
|
||||
if !ctx.Bool(TrieDBJournalFlag.Name) {
|
||||
options.TrieDBJournal = stack.ResolvePath("triedb.journal.rlp")
|
||||
}
|
||||
if !ctx.Bool(SnapshotFlag.Name) {
|
||||
options.SnapshotLimit = 0 // Disabled
|
||||
|
|
|
|||
|
|
@ -238,8 +238,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
},
|
||||
}
|
||||
)
|
||||
if config.TrieDBJournal != "" {
|
||||
options.TrieDBJournal = stack.ResolvePath(config.TrieDBJournal)
|
||||
if config.TrieDBJournal {
|
||||
options.TrieDBJournal = stack.ResolvePath("triedb.journal.rlp")
|
||||
} else {
|
||||
log.Warn("Trie database journal is persisted within the database")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ var Defaults = Config{
|
|||
TrieCleanCache: 154,
|
||||
TrieDirtyCache: 256,
|
||||
TrieTimeout: 60 * time.Minute,
|
||||
TrieDBJournal: "triedb.journal.rlp",
|
||||
SnapshotCache: 102,
|
||||
FilterLogCacheSize: 32,
|
||||
Miner: miner.DefaultConfig,
|
||||
|
|
@ -125,7 +124,7 @@ type Config struct {
|
|||
SnapshotCache int
|
||||
Preimages bool
|
||||
StateHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose state histories are reserved.
|
||||
TrieDBJournal string // Path to the journal used for persisting trie data across node restarts
|
||||
TrieDBJournal bool // Enable persisting the trie database journal to disk.
|
||||
|
||||
// State scheme represents the scheme used to store ethereum states and trie
|
||||
// nodes on top. It can be 'hash', 'path', or none which means use the scheme
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
|||
SnapshotCache int
|
||||
Preimages bool
|
||||
StateHistory uint64 `toml:",omitempty"`
|
||||
TrieDBJournal string
|
||||
TrieDBJournal bool
|
||||
StateScheme string `toml:",omitempty"`
|
||||
FilterLogCacheSize int
|
||||
Miner miner.Config
|
||||
|
|
@ -130,7 +130,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
|||
SnapshotCache *int
|
||||
Preimages *bool
|
||||
StateHistory *uint64 `toml:",omitempty"`
|
||||
TrieDBJournal *string
|
||||
TrieDBJournal *bool
|
||||
StateScheme *string `toml:",omitempty"`
|
||||
FilterLogCacheSize *int
|
||||
Miner *miner.Config
|
||||
|
|
|
|||
Loading…
Reference in a new issue