Skip to content

Update logs for blsync (Fixes #31968 ) #32046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion core/rawdb/chain_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ func unindexTransactionsForTesting(db ethdb.Database, from uint64, to uint64, in

// PruneTransactionIndex removes all tx index entries below a certain block number.
func PruneTransactionIndex(db ethdb.Database, pruneBlock uint64) {
var removedsize int64
tail := ReadTxIndexTail(db)
if tail == nil || *tail > pruneBlock {
return // no index, or index ends above pruneBlock
Expand All @@ -378,17 +379,21 @@ func PruneTransactionIndex(db ethdb.Database, pruneBlock uint64) {
if count%10000000 == 0 {
log.Info("Pruning tx index", "count", count, "removed", removed)
}
if len(v) > 8 {
size := len(v)
if size > 8 {
log.Error("Skipping legacy tx index entry", "hash", txhash)
return false
}
bn := decodeNumber(v)
if bn < pruneBlock {
removed++
removedsize += int64(size)
return true
}
return false
})

log.Info("Pruned total txs", "removed", removed, "size", removedsize, "count", count)
WriteTxIndexTail(db, pruneBlock)
}

Expand Down
7 changes: 6 additions & 1 deletion core/rawdb/freezer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,12 +826,17 @@ func (t *freezerTable) truncateTail(items uint64) error {
return err
}
}

// Retrieve the new size and update the total size counter
newSize, err := t.sizeNolock()
if err != nil {
return err
}
t.sizeGauge.Dec(int64(oldSize - newSize))
// Calculate how much data has been removed
delta := oldSize - newSize
t.sizeGauge.Dec(int64(delta))
//log how much data has been removed
log.Info("Pruned disk usage", "bytesFreed", delta)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion eth/downloader/skeleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (s *skeleton) sync(head *types.Header) (*types.Header, error) {
defer close(done)
filled := s.filler.suspend()
if filled == nil {
log.Error("Latest filled block is not available")
log.Warn("Latest filled block is not available")
return
}
// If something was filled, try to delete stale sync helpers. If
Expand Down