Better logs prune (#2543)

* prune log prefix

* prune log prefix
This commit is contained in:
Alex Sharov 2021-08-18 00:51:08 +07:00 committed by GitHub
parent ccc22c9f6a
commit 5e6549ac7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -91,7 +91,7 @@ type PruneState struct {
state *Sync
}
func (s *PruneState) LogPrefix() string { return s.state.LogPrefix() }
func (s *PruneState) LogPrefix() string { return s.state.LogPrefix() + " Prune" }
func (s *PruneState) Done(db kv.Putter) error {
return stages.SaveStagePruneProgress(db, s.ID, s.ForwardProgress)
}

View File

@ -484,7 +484,7 @@ func pruneCallTraces(tx kv.RwTx, logPrefix string, pruneTo uint64, ctx context.C
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.CallFromIndex, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.CallFromIndex, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:
@ -519,7 +519,7 @@ func pruneCallTraces(tx kv.RwTx, logPrefix string, pruneTo uint64, ctx context.C
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.CallToIndex, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.CallToIndex, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:

View File

@ -371,7 +371,7 @@ func pruneChangeSets(tx kv.RwTx, logPrefix string, table string, pruneTo uint64,
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", table, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", table, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:
@ -652,7 +652,7 @@ func pruneReceipts(tx kv.RwTx, logPrefix string, pruneTo uint64, logEvery *time.
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.Receipts, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.Receipts, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:
@ -678,7 +678,7 @@ func pruneReceipts(tx kv.RwTx, logPrefix string, pruneTo uint64, logEvery *time.
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.Log, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.Log, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:
@ -707,7 +707,7 @@ func pruneCallTracesSet(tx kv.RwTx, logPrefix string, pruneTo uint64, logEvery *
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.CallTraceSet, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.CallTraceSet, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:

View File

@ -445,7 +445,7 @@ func pruneHistoryIndex(tx kv.RwTx, csTable, logPrefix, tmpDir string, pruneTo ui
if err := collector.Load(logPrefix, tx, "", func(addr, _ []byte, table etl.CurrentTableReader, next etl.LoadNextFunc) error {
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", changeset.Mapper[csTable].IndexBucket, "key", fmt.Sprintf("%x", addr))
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", changeset.Mapper[csTable].IndexBucket, "key", fmt.Sprintf("%x", addr))
case <-ctx.Done():
return common.ErrStopped
default:

View File

@ -357,7 +357,7 @@ func pruneOldLogChunks(tx kv.RwTx, bucket string, inMem map[string]struct{}, pru
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.AccountsHistory, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.AccountsHistory, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default:
@ -426,7 +426,7 @@ func pruneLogIndex(logPrefix string, tx kv.RwTx, tmpDir string, pruneTo uint64,
}
select {
case <-logEvery.C:
log.Info(fmt.Sprintf("[%s] Mode", logPrefix), "table", kv.Log, "block", blockNum)
log.Info(fmt.Sprintf("[%s]", logPrefix), "table", kv.Log, "block", blockNum)
case <-ctx.Done():
return common.ErrStopped
default: