mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-13 03:26:38 +00:00
add prefetchworkers and blockingprefetch to ethconfig. add necessary plumbing that gets the values to the blockchain config when instantiating for main command
This commit is contained in:
parent
697fe91750
commit
ea42e30d59
5 changed files with 17 additions and 3 deletions
|
|
@ -255,6 +255,16 @@ func makeFullNode(ctx *cli.Context) *node.Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Eth.BlockingPrefetch = ctx.Bool(utils.BlockingPrefetchFlag.Name)
|
||||||
|
if ctx.IsSet(utils.PrefetchWorkersFlag.Name) {
|
||||||
|
prefetchWorkers := ctx.Uint(utils.PrefetchWorkersFlag.Name)
|
||||||
|
if prefetchWorkers == 0 {
|
||||||
|
prefetchWorkers = uint(runtime.NumCPU())
|
||||||
|
log.Warn(fmt.Sprintf("invalid value for --bal.prefetchworkers. got 0. sanitizing to %d", prefetchWorkers))
|
||||||
|
}
|
||||||
|
cfg.Eth.PrefetchWorkers = prefetchWorkers
|
||||||
|
}
|
||||||
|
|
||||||
// Start metrics export if enabled
|
// Start metrics export if enabled
|
||||||
utils.SetupMetrics(&cfg.Metrics)
|
utils.SetupMetrics(&cfg.Metrics)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ var (
|
||||||
utils.BeaconCheckpointFileFlag,
|
utils.BeaconCheckpointFileFlag,
|
||||||
utils.LogSlowBlockFlag,
|
utils.LogSlowBlockFlag,
|
||||||
utils.PrefetchWorkersFlag,
|
utils.PrefetchWorkersFlag,
|
||||||
utils.BlockingPrefetch,
|
utils.BlockingPrefetchFlag,
|
||||||
}, utils.NetworkFlags, utils.DatabaseFlags)
|
}, utils.NetworkFlags, utils.DatabaseFlags)
|
||||||
|
|
||||||
rpcFlags = []cli.Flag{
|
rpcFlags = []cli.Flag{
|
||||||
|
|
|
||||||
|
|
@ -721,7 +721,7 @@ var (
|
||||||
Category: flags.MiscCategory,
|
Category: flags.MiscCategory,
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockingPrefetch = &cli.BoolFlag{
|
BlockingPrefetchFlag = &cli.BoolFlag{
|
||||||
Name: "bal.blockingprefetch",
|
Name: "bal.blockingprefetch",
|
||||||
Usage: "only relevant when executing in parallel with a BAL: if true, the prefetcher will block tx/state-root calculation until all scheduled fetching tasks have completed.",
|
Usage: "only relevant when executing in parallel with a BAL: if true, the prefetcher will block tx/state-root calculation until all scheduled fetching tasks have completed.",
|
||||||
Category: flags.MiscCategory,
|
Category: flags.MiscCategory,
|
||||||
|
|
@ -2474,7 +2474,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
||||||
NodeFullValueCheckpoint: uint32(ctx.Uint(TrienodeHistoryFullValueCheckpointFlag.Name)),
|
NodeFullValueCheckpoint: uint32(ctx.Uint(TrienodeHistoryFullValueCheckpointFlag.Name)),
|
||||||
|
|
||||||
PrefetchWorkers: int(ctx.Uint(PrefetchWorkersFlag.Name)),
|
PrefetchWorkers: int(ctx.Uint(PrefetchWorkersFlag.Name)),
|
||||||
BlockingPrefetch: ctx.Bool(BlockingPrefetch.Name),
|
BlockingPrefetch: ctx.Bool(BlockingPrefetchFlag.Name),
|
||||||
// Disable transaction indexing/unindexing.
|
// Disable transaction indexing/unindexing.
|
||||||
TxLookupLimit: -1,
|
TxLookupLimit: -1,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
}
|
}
|
||||||
options.Overrides = &overrides
|
options.Overrides = &overrides
|
||||||
options.BALExecutionMode = config.BALExecutionMode
|
options.BALExecutionMode = config.BALExecutionMode
|
||||||
|
options.BlockingPrefetch = config.BlockingPrefetch
|
||||||
|
options.PrefetchWorkers = int(config.PrefetchWorkers)
|
||||||
|
|
||||||
eth.blockchain, err = core.NewBlockChain(chainDb, config.Genesis, eth.engine, options)
|
eth.blockchain, err = core.NewBlockChain(chainDb, config.Genesis, eth.engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,8 @@ type Config struct {
|
||||||
RangeLimit uint64 `toml:",omitempty"`
|
RangeLimit uint64 `toml:",omitempty"`
|
||||||
|
|
||||||
BALExecutionMode bal.BALExecutionMode
|
BALExecutionMode bal.BALExecutionMode
|
||||||
|
PrefetchWorkers uint
|
||||||
|
BlockingPrefetch bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateConsensusEngine creates a consensus engine for the given chain config.
|
// CreateConsensusEngine creates a consensus engine for the given chain config.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue