Skip to content

Commit 516c1b3

Browse files
committed
set triedb.journal as a switch
Signed-off-by: jsvisa <[email protected]>
1 parent 1e59014 commit 516c1b3

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

cmd/utils/flags.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,10 @@ var (
448448
}
449449

450450
// Trie database settings
451-
TrieDBJournalFlag = &cli.StringFlag{
451+
TrieDBJournalFlag = &cli.BoolFlag{
452452
Name: "triedb.journal",
453-
Usage: "Path to the journal used for persisting trie data across node restarts",
454-
Value: ethconfig.Defaults.TrieDBJournal,
453+
Usage: "Enable persisting the trie database journal to disk (only used with pbss state scheme, default path: <datadir>/triedb.journal.rlp)",
454+
Value: true,
455455
Category: flags.TrieDatabaseCategory,
456456
}
457457

@@ -1654,6 +1654,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
16541654
if ctx.IsSet(StateSchemeFlag.Name) {
16551655
cfg.StateScheme = ctx.String(StateSchemeFlag.Name)
16561656
}
1657+
if !ctx.Bool(TrieDBJournalFlag.Name) {
1658+
cfg.TrieDBJournal = false
1659+
}
16571660
// Parse transaction history flag, if user is still using legacy config
16581661
// file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'.
16591662
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) {
16901693
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
16911694
cfg.SnapshotCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
16921695
}
1693-
if ctx.IsSet(TrieDBJournalFlag.Name) {
1694-
cfg.TrieDBJournal = ctx.String(TrieDBJournalFlag.Name)
1695-
}
16961696
if ctx.IsSet(CacheLogSizeFlag.Name) {
16971697
cfg.FilterLogCacheSize = ctx.Int(CacheLogSizeFlag.Name)
16981698
}
@@ -2216,12 +2216,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
22162216
options.Preimages = true
22172217
log.Info("Enabling recording of key preimages since archive mode is used")
22182218
}
2219-
journal := ethconfig.Defaults.TrieDBJournal
2220-
if ctx.IsSet(TrieDBJournalFlag.Name) {
2221-
journal = ctx.String(TrieDBJournalFlag.Name)
2222-
}
2223-
if journal != "" {
2224-
options.TrieDBJournal = stack.ResolvePath(journal)
2219+
if !ctx.Bool(TrieDBJournalFlag.Name) {
2220+
options.TrieDBJournal = stack.ResolvePath("triedb.journal.rlp")
22252221
}
22262222
if !ctx.Bool(SnapshotFlag.Name) {
22272223
options.SnapshotLimit = 0 // Disabled

eth/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
239239
VmConfig: vmConfig,
240240
}
241241
)
242-
if config.TrieDBJournal != "" {
243-
options.TrieDBJournal = stack.ResolvePath(config.TrieDBJournal)
242+
if config.TrieDBJournal {
243+
options.TrieDBJournal = stack.ResolvePath("triedb.journal.rlp")
244244
} else {
245245
log.Warn("Trie database journal is persisted within the database")
246246
}

eth/ethconfig/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ var Defaults = Config{
6060
TrieCleanCache: 154,
6161
TrieDirtyCache: 256,
6262
TrieTimeout: 60 * time.Minute,
63-
TrieDBJournal: "triedb.journal.rlp",
6463
SnapshotCache: 102,
6564
FilterLogCacheSize: 32,
6665
Miner: miner.DefaultConfig,
@@ -125,7 +124,7 @@ type Config struct {
125124
SnapshotCache int
126125
Preimages bool
127126
StateHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose state histories are reserved.
128-
TrieDBJournal string // Path to the journal used for persisting trie data across node restarts
127+
TrieDBJournal bool // Enable persisting the trie database journal to disk.
129128

130129
// State scheme represents the scheme used to store ethereum states and trie
131130
// nodes on top. It can be 'hash', 'path', or none which means use the scheme

eth/ethconfig/gen_config.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)