aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-05-22 16:12:52 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-22 16:12:52 +0800
commit6ce21a4744461fc35c05b1c5fcc92136761be747 (patch)
treefbb248c69b21976a5e492ee7ec9805bd96d92322 /ethdb
parent9af364e42b2fbbacf2febf9c43068ddb8a058b79 (diff)
downloaddexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.gz
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.bz2
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.lz
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.xz
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.zst
dexon-6ce21a4744461fc35c05b1c5fcc92136761be747.zip
vendor, ethdb: print warning log if leveldb is performing compaction (#16766)
* vendor: update leveldb package * ethdb: print warning log if db is performing compaction * ethdb: update annotation and log
Diffstat (limited to 'ethdb')
-rw-r--r--ethdb/database.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/ethdb/database.go b/ethdb/database.go
index 001d8f0bb..86dd21076 100644
--- a/ethdb/database.go
+++ b/ethdb/database.go
@@ -207,6 +207,7 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
delaystats [2]int64
lastWriteDelay time.Time
lastWriteDelayN time.Time
+ lastWritePaused time.Time
)
// Iterate ad infinitum and collect the stats
@@ -267,8 +268,9 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
delayN int64
delayDuration string
duration time.Duration
+ paused bool
)
- if n, err := fmt.Sscanf(writedelay, "DelayN:%d Delay:%s", &delayN, &delayDuration); n != 2 || err != nil {
+ if n, err := fmt.Sscanf(writedelay, "DelayN:%d Delay:%s Paused:%t", &delayN, &delayDuration, &paused); n != 3 || err != nil {
db.log.Error("Write delay statistic not found")
return
}
@@ -301,6 +303,14 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
lastWriteDelay = time.Now()
}
}
+ // If a warning that db is performing compaction has been displayed, any subsequent
+ // warnings will be withheld for one minute not to overwhelm the user.
+ if paused && delayN-delaystats[0] == 0 && duration.Nanoseconds()-delaystats[1] == 0 &&
+ time.Now().After(lastWritePaused.Add(writeDelayWarningThrottler)) {
+ db.log.Warn("Database compacting, degraded performance")
+ lastWritePaused = time.Now()
+ }
+
delaystats[0], delaystats[1] = delayN, duration.Nanoseconds()
// Retrieve the database iostats.