diff options
author | Martin Holst Swende <martin@swende.se> | 2018-01-29 22:17:59 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-01-29 22:17:59 +0800 |
commit | 59a852e4188e18e587b6d54f646a6780f4d1f12c (patch) | |
tree | 0f1326c9775d9e3cc76396b081417923ec9dcb00 /vendor/github.com/syndtr/goleveldb/leveldb/db.go | |
parent | dd7a715d73a09f8358ba8e6866f5ae1c3135d0fe (diff) | |
download | dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.gz dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.bz2 dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.lz dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.xz dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.zst dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.zip |
vendor: update leveldb to 211f780 (poolfix) (#15988)
Diffstat (limited to 'vendor/github.com/syndtr/goleveldb/leveldb/db.go')
-rw-r--r-- | vendor/github.com/syndtr/goleveldb/leveldb/db.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db.go b/vendor/github.com/syndtr/goleveldb/leveldb/db.go index b0cdcb3d0..ea5595eb3 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db.go @@ -32,6 +32,11 @@ type DB struct { // Need 64-bit alignment. seq uint64 + // Stats. Need 64-bit alignment. + cWriteDelay int64 // The cumulative duration of write delays + cWriteDelayN int32 // The cumulative number of write delays + aliveSnaps, aliveIters int32 + // Session. s *session @@ -49,9 +54,6 @@ type DB struct { snapsMu sync.Mutex snapsList *list.List - // Stats. - aliveSnaps, aliveIters int32 - // Write. batchPool sync.Pool writeMergeC chan writeMerge @@ -321,7 +323,7 @@ func recoverTable(s *session, o *opt.Options) error { } } err = iter.Error() - if err != nil { + if err != nil && !errors.IsCorrupted(err) { return } err = tw.Close() @@ -392,7 +394,7 @@ func recoverTable(s *session, o *opt.Options) error { } imax = append(imax[:0], key...) } - if err := iter.Error(); err != nil { + if err := iter.Error(); err != nil && !errors.IsCorrupted(err) { iter.Release() return err } @@ -904,6 +906,8 @@ func (db *DB) GetSnapshot() (*Snapshot, error) { // Returns the number of files at level 'n'. // leveldb.stats // Returns statistics of the underlying DB. +// leveldb.writedelay +// Returns cumulative write delay caused by compaction. // leveldb.sstables // Returns sstables list for each level. // leveldb.blockpool @@ -955,6 +959,9 @@ func (db *DB) GetProperty(name string) (value string, err error) { level, len(tables), float64(tables.size())/1048576.0, duration.Seconds(), float64(read)/1048576.0, float64(write)/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) case p == "sstables": for level, tables := range v.levels { value += fmt.Sprintf("--- level %d ---\n", level) |