Merge pull request #10827 from filecoin-project/10585-address-review-comments
10585 address review comments
This commit is contained in:
commit
e6c8072f50
@ -1,5 +1,11 @@
|
||||
# Lotus changelog
|
||||
|
||||
# UNRELEASED
|
||||
|
||||
## New features
|
||||
- feat: Added new environment variable `LOTUS_EXEC_TRACE_CACHE_SIZE` to configure execution trace cache size ([filecoin-project/lotus#10585](https://github.com/filecoin-project/lotus/pull/10585))
|
||||
- If unset, we default to caching 16 most recent execution traces. Node operatores may want to set this to 0 while exchanges may want to crank it up.
|
||||
|
||||
# v1.23.0 / 2023-04-21
|
||||
|
||||
This is the stable feature release for the upcoming MANDATORY network upgrade at `2023-04-27T13:00:00Z`, epoch `2809800`. This feature release delivers the nv19 Lighting and nv20 Thunder network upgrade for mainnet, and includes numerous improvements and enhancements for node operators, ETH RPC-providers and storage providers.
|
||||
|
@ -131,7 +131,7 @@ func (sm *StateManager) ExecutionTrace(ctx context.Context, ts *types.TipSet) (c
|
||||
tsKey := ts.Key()
|
||||
|
||||
// check if we have the trace for this tipset in the cache
|
||||
if defaultExecTraceCacheSize > 0 {
|
||||
if execTraceCacheSize > 0 {
|
||||
sm.execTraceCacheLock.Lock()
|
||||
if entry, ok := sm.execTraceCache.Get(tsKey); ok {
|
||||
// we have to make a deep copy since caller can modify the invocTrace
|
||||
@ -149,7 +149,7 @@ func (sm *StateManager) ExecutionTrace(ctx context.Context, ts *types.TipSet) (c
|
||||
return cid.Undef, nil, err
|
||||
}
|
||||
|
||||
if defaultExecTraceCacheSize > 0 {
|
||||
if execTraceCacheSize > 0 {
|
||||
invocTraceCopy := makeDeepCopy(invocTrace)
|
||||
|
||||
sm.execTraceCacheLock.Lock()
|
||||
|
@ -42,7 +42,7 @@ import (
|
||||
const LookbackNoLimit = api.LookbackNoLimit
|
||||
const ReceiptAmtBitwidth = 3
|
||||
|
||||
var defaultExecTraceCacheSize = 16
|
||||
var execTraceCacheSize = 16
|
||||
var log = logging.Logger("statemgr")
|
||||
|
||||
type StateManagerAPI interface {
|
||||
@ -76,12 +76,12 @@ func (m *migrationResultCache) keyForMigration(root cid.Cid) dstore.Key {
|
||||
}
|
||||
|
||||
func init() {
|
||||
if s := os.Getenv("LOTUS_EXEC_TRACE_CACHE"); s != "" {
|
||||
if s := os.Getenv("LOTUS_EXEC_TRACE_CACHE_SIZE"); s != "" {
|
||||
letc, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
log.Errorf("failed to parse 'LOTUS_EXEC_TRACE_CACHE' env var: %s", err)
|
||||
log.Errorf("failed to parse 'LOTUS_EXEC_TRACE_CACHE_SIZE' env var: %s", err)
|
||||
} else {
|
||||
defaultExecTraceCacheSize = letc
|
||||
execTraceCacheSize = letc
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,11 +212,11 @@ func NewStateManager(cs *store.ChainStore, exec Executor, sys vm.SyscallBuilder,
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("execTraceCache size: %d", defaultExecTraceCacheSize)
|
||||
log.Debugf("execTraceCache size: %d", execTraceCacheSize)
|
||||
var execTraceCache *lru.ARCCache[types.TipSetKey, tipSetCacheEntry]
|
||||
var err error
|
||||
if defaultExecTraceCacheSize > 0 {
|
||||
execTraceCache, err = lru.NewARC[types.TipSetKey, tipSetCacheEntry](defaultExecTraceCacheSize)
|
||||
if execTraceCacheSize > 0 {
|
||||
execTraceCache, err = lru.NewARC[types.TipSetKey, tipSetCacheEntry](execTraceCacheSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user