aboutsummaryrefslogtreecommitdiffstats
path: root/vendor
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 /vendor
parent9af364e42b2fbbacf2febf9c43068ddb8a058b79 (diff)
downloadgo-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar
go-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.gz
go-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.bz2
go-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.lz
go-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.xz
go-tangerine-6ce21a4744461fc35c05b1c5fcc92136761be747.tar.zst
go-tangerine-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 'vendor')
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db.go73
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db_write.go4
-rw-r--r--vendor/vendor.json6
3 files changed, 79 insertions, 4 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db.go b/vendor/github.com/syndtr/goleveldb/leveldb/db.go
index 3655418ad..e7ac06541 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db.go
@@ -35,6 +35,7 @@ type DB struct {
// Stats. Need 64-bit alignment.
cWriteDelay int64 // The cumulative duration of write delays
cWriteDelayN int32 // The cumulative number of write delays
+ inWritePaused int32 // The indicator whether write operation is paused by compaction
aliveSnaps, aliveIters int32
// Session.
@@ -967,7 +968,8 @@ func (db *DB) GetProperty(name string) (value string, err error) {
float64(db.s.stor.writes())/1048576.0)
case p == "writedelay":
writeDelayN, writeDelay := atomic.LoadInt32(&db.cWriteDelayN), time.Duration(atomic.LoadInt64(&db.cWriteDelay))
- value = fmt.Sprintf("DelayN:%d Delay:%s", writeDelayN, writeDelay)
+ paused := atomic.LoadInt32(&db.inWritePaused) == 1
+ value = fmt.Sprintf("DelayN:%d Delay:%s Paused:%t", writeDelayN, writeDelay, paused)
case p == "sstables":
for level, tables := range v.levels {
value += fmt.Sprintf("--- level %d ---\n", level)
@@ -996,6 +998,75 @@ func (db *DB) GetProperty(name string) (value string, err error) {
return
}
+// DBStats is database statistics.
+type DBStats struct {
+ WriteDelayCount int32
+ WriteDelayDuration time.Duration
+ WritePaused bool
+
+ AliveSnapshots int32
+ AliveIterators int32
+
+ IOWrite uint64
+ IORead uint64
+
+ BlockCacheSize int
+ OpenedTablesCount int
+
+ LevelSizes []int64
+ LevelTablesCounts []int
+ LevelRead []int64
+ LevelWrite []int64
+ LevelDurations []time.Duration
+}
+
+// Stats populates s with database statistics.
+func (db *DB) Stats(s *DBStats) error {
+ err := db.ok()
+ if err != nil {
+ return err
+ }
+
+ s.IORead = db.s.stor.reads()
+ s.IOWrite = db.s.stor.writes()
+ s.WriteDelayCount = atomic.LoadInt32(&db.cWriteDelayN)
+ s.WriteDelayDuration = time.Duration(atomic.LoadInt64(&db.cWriteDelay))
+ s.WritePaused = atomic.LoadInt32(&db.inWritePaused) == 1
+
+ s.OpenedTablesCount = db.s.tops.cache.Size()
+ if db.s.tops.bcache != nil {
+ s.BlockCacheSize = db.s.tops.bcache.Size()
+ } else {
+ s.BlockCacheSize = 0
+ }
+
+ s.AliveIterators = atomic.LoadInt32(&db.aliveIters)
+ s.AliveSnapshots = atomic.LoadInt32(&db.aliveSnaps)
+
+ s.LevelDurations = s.LevelDurations[:0]
+ s.LevelRead = s.LevelRead[:0]
+ s.LevelWrite = s.LevelWrite[:0]
+ s.LevelSizes = s.LevelSizes[:0]
+ s.LevelTablesCounts = s.LevelTablesCounts[:0]
+
+ v := db.s.version()
+ defer v.release()
+
+ for level, tables := range v.levels {
+ duration, read, write := db.compStats.getStat(level)
+ if len(tables) == 0 && duration == 0 {
+ continue
+ }
+ s.LevelDurations = append(s.LevelDurations, duration)
+ s.LevelRead = append(s.LevelRead, read)
+ s.LevelWrite = append(s.LevelWrite, write)
+ s.LevelSizes = append(s.LevelSizes, tables.size())
+ s.LevelTablesCounts = append(s.LevelTablesCounts, len(tables))
+ }
+
+ return nil
+}
+
// SizeOf calculates approximate sizes of the given key ranges.
// The length of the returned sizes are equal with the length of the given
// ranges. The returned sizes measure storage space usage, so if the user
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
index 31f4bc5ef..db0c1bece 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
@@ -89,7 +89,11 @@ func (db *DB) flush(n int) (mdb *memDB, mdbFree int, err error) {
return false
case tLen >= pauseTrigger:
delayed = true
+ // Set the write paused flag explicitly.
+ atomic.StoreInt32(&db.inWritePaused, 1)
err = db.compTriggerWait(db.tcompCmdC)
+ // Unset the write paused flag.
+ atomic.StoreInt32(&db.inWritePaused, 0)
if err != nil {
return false
}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index fdc778936..dc46b182a 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -418,10 +418,10 @@
"revisionTime": "2017-07-05T02:17:15Z"
},
{
- "checksumSHA1": "k13cCuMJO7+KhR8ZXx5oUqDKGQA=",
+ "checksumSHA1": "TJV50D0q8E3vtc90ibC+qOYdjrw=",
"path": "github.com/syndtr/goleveldb/leveldb",
- "revision": "ae970a0732be3a1f5311da86118d37b9f4bd2a5a",
- "revisionTime": "2018-05-02T07:23:49Z"
+ "revision": "59047f74db0d042c8d8dd8e30bb030bc774a7d7a",
+ "revisionTime": "2018-05-21T04:45:49Z"
},
{
"checksumSHA1": "EKIow7XkgNdWvR/982ffIZxKG8Y=",