Repository navigation
cmd/utils: disabled transaction unindexing for archive node by default - #3624
Conversation
Thanks for the PR — the problem is real and worth fixing, but I'd suggest a different approach. Why not merge this:
The root cause is in Suggested fix in if ctx.String(GCModeFlag.Name) == "archive" {
if cfg.TransactionHistory == ethconfig.Defaults.TransactionHistory {
cfg.TransactionHistory = 0
}
} |
|
@allformless I thought of that first, but since PR #32103 was closed upstream for doing something similar, I'm trying a different way. For PR #32103 -> remove this |
a little different with PR32103 |
|
@allformless Sure I will follow your guide. Thank you. Will complete this PR soon. |
|
@allformless Thank you. I just double-checked and you’re right—the instructions are spot on. This will: |
Description
Exclude background transaction indexing from the
SyncProgress.Done()check so thateth.syncingreturnsfalseonce block sync and state indexing are complete, without waiting for the full transaction index to be built.Rationale
When running a node with
--gcmode=archive, the flag handler forcesTransactionHistory=0(index entire chain). For a node bootstrapped from a snapshot (e.g. at block ~88M on BSC), the tx indexer must index ~86 million historical blocks — a process that can take days or weeks.During this time,
SyncProgress.Done()returnsfalsebecause it requiresTxIndexRemainingBlocks == 0, soeth.syncingnever returnsfalseeven though block sync completed long ago and the node can fully serve current data.Transaction indexing is a background maintenance task, not part of the initial chain sync. State indexing (
StateIndexRemaining) is kept in the check because it is bounded by--history.stateand finishes in reasonable time.Note: upstream
go-ethereumPR #32103 attempted to fix this by removing the archive modeTransactionHistoryoverride inflags.go, but was rejected because transaction unindexing is very slow and causes significant I/O load. This fix takes a different approach by only changing the sync completion criteria.Example
Before (archive node started from snapshot, block sync done):
After:
Changes
Notable changes:
TxIndexRemainingBlocks == 0fromSyncProgress.Done()ininterfaces.goStateIndexRemaining == 0check is preserved — state indexing is bounded and completes in reasonable timetxIndexFinishedBlocksandtxIndexRemainingBlocksfields are still included in theeth_syncingresponse for monitoringBlockChain.TxIndexDone()) uses a separateTxIndexProgress.Done()method and is unaffectedFlow
Flow with step
api.b.SyncProgress(ctx)fetches the progress (which merges block sync + tx index + state index data)progress.Done()-- this calls our changed method in interfaces.goDone()returns true --> returns false (meaning "not syncing")Done()returns false --> returns the full progress map (the object the issue reporter sees with all those fields liketxIndexRemainingBlocks: 86132452)-> this is use config in #3621
Fixes #3621