Snap sync fix ticker crash (#1393)

* Fix SEGFAULT showstopper

* Update logging
This commit is contained in:
Jordan Hrycaj 2022-12-20 15:38:57 +00:00 committed by GitHub
parent bd42ebb193
commit 0f132c1d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 11 deletions

View File

@ -180,9 +180,11 @@ proc tickerStats*(
var
pivotBlock = none(BlockNumber)
stoQuLen = none(int)
procChunks = 0
if not env.isNil:
pivotBlock = some(env.stateHeader.blockNumber)
stoQuLen = some(env.fetchStorageFull.len + env.fetchStoragePart.len)
procChunks = env.fetchAccounts.processed.chunks
TickerStats(
pivotBlock: pivotBlock,
@ -190,7 +192,7 @@ proc tickerStats*(
nAccounts: meanStdDev(aSum, aSqSum, count),
nSlotLists: meanStdDev(sSum, sSqSum, count),
accountsFill: (accFill[0], accFill[1], accCoverage),
nAccountStats: env.fetchAccounts.processed.chunks,
nAccountStats: procChunks,
nStorageQueue: stoQuLen)
# ------------------------------------------------------------------------------

View File

@ -137,14 +137,18 @@ proc uncoveredEnvelopes(
## Compile the complement of the union of the `processed` intervals and
## express this complement as a list of envelopes of sub-tries.
##
var decomposed = "n/a"
let rc = processed.hexaryEnvelopeDecompose(rootKey, getFn)
if rc.isOk:
# Remove non-allocated nodes
result = rc.value.filterIt(0 < it.nodeKey.ByteArray32.getFn().len)
when extraTraceMessages:
decomposed = rc.value.toPC
when extraTraceMessages:
trace logTxt "decomposed result", processed, nProcessed=processed.chunks,
nResult=result.len, result=result.toPC
trace logTxt "uncovered envelopes", processed, nProcessed=processed.chunks,
decomposed, nResult=result.len, result=result.toPC
proc otherProcessedRanges(
@ -229,17 +233,17 @@ proc swapIn(
merged += processed.merge iv # Import range as processed
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
break
lapCount.inc
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()
(swappedIn,lapCount)
@ -259,6 +263,7 @@ proc swapInAccounts*(
return # nothing to do
let
pivot = "#" & $env.stateHeader.blockNumber # Logging & debugging
rootKey = env.stateHeader.stateRoot.to(NodeKey)
getFn = ctx.data.snapDb.getAccountFn
@ -277,12 +282,11 @@ proc swapInAccounts*(
return # nothing to do
when extraTraceMessages:
let pivot = "#" & $env.stateHeader.blockNumber # for logging
trace logTxt "accounts start", pivot, nOthers=others.len
var
nLaps = 0 # Logging & debugging
nSlotAccounts = 0 # Logging & debugging
nLaps = 0 # Logging & debugging
nSlotAccounts = 0 # Logging & debugging
swappedIn: seq[NodeTagRangeSet]
noKeyErrorOrExceptionOops("swapInAccounts"):