mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +00:00
Senders prune logging (#2645)
This commit is contained in:
parent
0d79c19f21
commit
fd69b509a5
@ -347,8 +347,12 @@ func UnwindSendersStage(s *UnwindState, tx kv.RwTx, cfg SendersCfg, ctx context.
|
||||
}
|
||||
|
||||
func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Context) (err error) {
|
||||
if !cfg.prune.TxIndex.Enabled() {
|
||||
return nil
|
||||
}
|
||||
logEvery := time.NewTicker(logInterval)
|
||||
defer logEvery.Stop()
|
||||
to := cfg.prune.TxIndex.PruneTo(s.ForwardProgress)
|
||||
|
||||
useExternalTx := tx != nil
|
||||
if !useExternalTx {
|
||||
tx, err = cfg.db.BeginRw(ctx)
|
||||
@ -357,7 +361,7 @@ func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Co
|
||||
}
|
||||
defer tx.Rollback()
|
||||
}
|
||||
if cfg.prune.TxIndex.Enabled() {
|
||||
|
||||
c, err := tx.RwCursor(kv.Senders)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create cursor for pruning %w", err)
|
||||
@ -369,6 +373,15 @@ func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Co
|
||||
return err
|
||||
}
|
||||
blockNum := binary.BigEndian.Uint64(k)
|
||||
|
||||
select {
|
||||
case <-logEvery.C:
|
||||
log.Info(fmt.Sprintf("[%s]", s.LogPrefix()), "table", kv.Senders, "block", blockNum)
|
||||
case <-ctx.Done():
|
||||
return common.ErrStopped
|
||||
default:
|
||||
}
|
||||
|
||||
if blockNum >= to {
|
||||
break
|
||||
}
|
||||
@ -376,7 +389,6 @@ func PruneSendersStage(s *PruneState, tx kv.RwTx, cfg SendersCfg, ctx context.Co
|
||||
return fmt.Errorf("failed to remove for block %d: %w", blockNum, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !useExternalTx {
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user