Better logs3 (#976)

This commit is contained in:
Alex Sharov 2020-08-26 19:06:51 +07:00 committed by GitHub
parent 9091ce62bb
commit 714e5041e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -576,7 +576,6 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
if canRunCycleInOneTransaction {
tx = ethdb.NewTxDbWithoutTransaction(d.stateDB)
defer func() {
log.Info("cycle: rollback transaction")
tx.Rollback()
}()
writeDB = tx
@ -611,7 +610,6 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
return nil
}
log.Info("cycle: begin transaction")
var errTx error
tx, errTx = tx.Begin()
return errTx
@ -621,7 +619,7 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
return nil
}
log.Info("cycle: commit transaction")
log.Info("Commit blocks")
_, errTx := tx.Commit()
return errTx
})
@ -635,7 +633,6 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
if hasTx, ok := tx.(ethdb.HasTx); ok && hasTx.Tx() != nil {
return nil
}
log.Info("cycle unwind: begin transaction")
var errTx error
tx, errTx = tx.Begin()
return errTx
@ -647,7 +644,7 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
if hasTx, ok := tx.(ethdb.HasTx); ok && hasTx.Tx() == nil {
return nil
}
log.Info("cycle unwind: commit transaction")
log.Info("Commit blocks")
_, errCommit := tx.Commit()
return errCommit
})

View File

@ -324,8 +324,8 @@ func (db *LmdbKV) Update(ctx context.Context, f func(tx Tx) error) (err error) {
}
commitTook := time.Since(commitTimer)
if commitTook > 10*time.Second {
log.Info("Batch", "commit", commitTook)
if commitTook > 20*time.Second {
log.Info("Commit", "took", commitTook)
}
fsyncTimer := time.Now()
@ -333,8 +333,8 @@ func (db *LmdbKV) Update(ctx context.Context, f func(tx Tx) error) (err error) {
log.Warn("fsync after commit failed: \n", err)
}
fsyncTook := time.Since(fsyncTimer)
if fsyncTook > 10*time.Second {
log.Info("Batch", "fsync", fsyncTook)
if fsyncTook > 20*time.Second {
log.Info("Fsync", "took", fsyncTook)
}
return nil
}