diff --git a/nimbus/sync/snap/worker/pivot.nim b/nimbus/sync/snap/worker/pivot.nim index 46eafefe4..a9d87e766 100644 --- a/nimbus/sync/snap/worker/pivot.nim +++ b/nimbus/sync/snap/worker/pivot.nim @@ -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) # ------------------------------------------------------------------------------ diff --git a/nimbus/sync/snap/worker/pivot/swap_in.nim b/nimbus/sync/snap/worker/pivot/swap_in.nim index a9a4c3fec..8a214382e 100644 --- a/nimbus/sync/snap/worker/pivot/swap_in.nim +++ b/nimbus/sync/snap/worker/pivot/swap_in.nim @@ -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"):