mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 21:04:11 +00:00
Snap sync fix ticker crash (#1393)
* Fix SEGFAULT showstopper * Update logging
This commit is contained in:
parent
bd42ebb193
commit
0f132c1d01
@ -180,9 +180,11 @@ proc tickerStats*(
|
|||||||
var
|
var
|
||||||
pivotBlock = none(BlockNumber)
|
pivotBlock = none(BlockNumber)
|
||||||
stoQuLen = none(int)
|
stoQuLen = none(int)
|
||||||
|
procChunks = 0
|
||||||
if not env.isNil:
|
if not env.isNil:
|
||||||
pivotBlock = some(env.stateHeader.blockNumber)
|
pivotBlock = some(env.stateHeader.blockNumber)
|
||||||
stoQuLen = some(env.fetchStorageFull.len + env.fetchStoragePart.len)
|
stoQuLen = some(env.fetchStorageFull.len + env.fetchStoragePart.len)
|
||||||
|
procChunks = env.fetchAccounts.processed.chunks
|
||||||
|
|
||||||
TickerStats(
|
TickerStats(
|
||||||
pivotBlock: pivotBlock,
|
pivotBlock: pivotBlock,
|
||||||
@ -190,7 +192,7 @@ proc tickerStats*(
|
|||||||
nAccounts: meanStdDev(aSum, aSqSum, count),
|
nAccounts: meanStdDev(aSum, aSqSum, count),
|
||||||
nSlotLists: meanStdDev(sSum, sSqSum, count),
|
nSlotLists: meanStdDev(sSum, sSqSum, count),
|
||||||
accountsFill: (accFill[0], accFill[1], accCoverage),
|
accountsFill: (accFill[0], accFill[1], accCoverage),
|
||||||
nAccountStats: env.fetchAccounts.processed.chunks,
|
nAccountStats: procChunks,
|
||||||
nStorageQueue: stoQuLen)
|
nStorageQueue: stoQuLen)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -137,14 +137,18 @@ proc uncoveredEnvelopes(
|
|||||||
## Compile the complement of the union of the `processed` intervals and
|
## Compile the complement of the union of the `processed` intervals and
|
||||||
## express this complement as a list of envelopes of sub-tries.
|
## express this complement as a list of envelopes of sub-tries.
|
||||||
##
|
##
|
||||||
|
var decomposed = "n/a"
|
||||||
let rc = processed.hexaryEnvelopeDecompose(rootKey, getFn)
|
let rc = processed.hexaryEnvelopeDecompose(rootKey, getFn)
|
||||||
if rc.isOk:
|
if rc.isOk:
|
||||||
# Remove non-allocated nodes
|
# Remove non-allocated nodes
|
||||||
result = rc.value.filterIt(0 < it.nodeKey.ByteArray32.getFn().len)
|
result = rc.value.filterIt(0 < it.nodeKey.ByteArray32.getFn().len)
|
||||||
|
|
||||||
|
when extraTraceMessages:
|
||||||
|
decomposed = rc.value.toPC
|
||||||
|
|
||||||
when extraTraceMessages:
|
when extraTraceMessages:
|
||||||
trace logTxt "decomposed result", processed, nProcessed=processed.chunks,
|
trace logTxt "uncovered envelopes", processed, nProcessed=processed.chunks,
|
||||||
nResult=result.len, result=result.toPC
|
decomposed, nResult=result.len, result=result.toPC
|
||||||
|
|
||||||
|
|
||||||
proc otherProcessedRanges(
|
proc otherProcessedRanges(
|
||||||
@ -229,17 +233,17 @@ proc swapIn(
|
|||||||
merged += processed.merge iv # Import range as processed
|
merged += processed.merge iv # Import range as processed
|
||||||
unprocessed.reduce iv # No need to re-fetch
|
unprocessed.reduce iv # No need to re-fetch
|
||||||
|
|
||||||
|
when extraTraceMessages:
|
||||||
|
trace logTxt "inherited ranges", lapCount, nCheckNodes=checkNodes.len,
|
||||||
|
merged=((merged.to(float) / (2.0^256)).toPC(3)),
|
||||||
|
allMerged=((allMerged.to(float) / (2.0^256)).toPC(3))
|
||||||
|
|
||||||
if merged == 0: # Loop control
|
if merged == 0: # Loop control
|
||||||
break
|
break
|
||||||
|
|
||||||
lapCount.inc
|
lapCount.inc
|
||||||
allMerged += merged # Statistics, logging
|
allMerged += merged # Statistics, logging
|
||||||
|
|
||||||
when extraTraceMessages:
|
|
||||||
trace logTxt "inherited ranges", lapCount, nCheckNodes=checkNodes.len,
|
|
||||||
merged=((merged.to(float) / (2.0^256)).toPC(3)),
|
|
||||||
allMerged=((allMerged.to(float) / (2.0^256)).toPC(3))
|
|
||||||
|
|
||||||
# End while()
|
# End while()
|
||||||
|
|
||||||
(swappedIn,lapCount)
|
(swappedIn,lapCount)
|
||||||
@ -259,6 +263,7 @@ proc swapInAccounts*(
|
|||||||
return # nothing to do
|
return # nothing to do
|
||||||
|
|
||||||
let
|
let
|
||||||
|
pivot = "#" & $env.stateHeader.blockNumber # Logging & debugging
|
||||||
rootKey = env.stateHeader.stateRoot.to(NodeKey)
|
rootKey = env.stateHeader.stateRoot.to(NodeKey)
|
||||||
getFn = ctx.data.snapDb.getAccountFn
|
getFn = ctx.data.snapDb.getAccountFn
|
||||||
|
|
||||||
@ -277,12 +282,11 @@ proc swapInAccounts*(
|
|||||||
return # nothing to do
|
return # nothing to do
|
||||||
|
|
||||||
when extraTraceMessages:
|
when extraTraceMessages:
|
||||||
let pivot = "#" & $env.stateHeader.blockNumber # for logging
|
|
||||||
trace logTxt "accounts start", pivot, nOthers=others.len
|
trace logTxt "accounts start", pivot, nOthers=others.len
|
||||||
|
|
||||||
var
|
var
|
||||||
nLaps = 0 # Logging & debugging
|
nLaps = 0 # Logging & debugging
|
||||||
nSlotAccounts = 0 # Logging & debugging
|
nSlotAccounts = 0 # Logging & debugging
|
||||||
swappedIn: seq[NodeTagRangeSet]
|
swappedIn: seq[NodeTagRangeSet]
|
||||||
|
|
||||||
noKeyErrorOrExceptionOops("swapInAccounts"):
|
noKeyErrorOrExceptionOops("swapInAccounts"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user