aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-01-29 22:17:59 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-01-29 22:17:59 +0800
commit59a852e4188e18e587b6d54f646a6780f4d1f12c (patch)
tree0f1326c9775d9e3cc76396b081417923ec9dcb00 /vendor/github.com
parentdd7a715d73a09f8358ba8e6866f5ae1c3135d0fe (diff)
downloaddexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.gz
dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.tar.zst
dexon-59a852e4188e18e587b6d54f646a6780f4d1f12c.zip
vendor: update leveldb to 211f780 (poolfix) (#15988)
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/syndtr/goleveldb/.travis.yml12
-rw-r--r--vendor/github.com/syndtr/goleveldb/README.md4
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db.go17
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db_write.go10
4 files changed, 24 insertions, 19 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/.travis.yml b/vendor/github.com/syndtr/goleveldb/.travis.yml
deleted file mode 100644
index 82de37735..000000000
--- a/vendor/github.com/syndtr/goleveldb/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: go
-
-go:
- - 1.4
- - 1.5
- - 1.6
- - 1.7
- - tip
-
-script:
- - go test -timeout 1h ./...
- - go test -timeout 30m -race -run "TestDB_(Concurrent|GoleveldbIssue74)" ./leveldb
diff --git a/vendor/github.com/syndtr/goleveldb/README.md b/vendor/github.com/syndtr/goleveldb/README.md
index 259286f55..41a47614c 100644
--- a/vendor/github.com/syndtr/goleveldb/README.md
+++ b/vendor/github.com/syndtr/goleveldb/README.md
@@ -10,13 +10,15 @@ Installation
Requirements
-----------
-* Need at least `go1.4` or newer.
+* Need at least `go1.5` or newer.
Usage
-----------
Create or open a database:
```go
+// The returned DB instance is safe for concurrent use. Which mean that all
+// DB's methods may be called concurrently from multiple goroutine.
db, err := leveldb.OpenFile("path/to/db", nil)
...
defer db.Close()
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)
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
index 5b6cb487d..31f4bc5ef 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
@@ -7,6 +7,7 @@
package leveldb
import (
+ "sync/atomic"
"time"
"github.com/syndtr/goleveldb/leveldb/memdb"
@@ -117,6 +118,8 @@ func (db *DB) flush(n int) (mdb *memDB, mdbFree int, err error) {
db.writeDelayN++
} else if db.writeDelayN > 0 {
db.logf("db@write was delayed N·%d T·%v", db.writeDelayN, db.writeDelay)
+ atomic.AddInt32(&db.cWriteDelayN, int32(db.writeDelayN))
+ atomic.AddInt64(&db.cWriteDelay, int64(db.writeDelay))
db.writeDelay = 0
db.writeDelayN = 0
}
@@ -143,7 +146,7 @@ func (db *DB) unlockWrite(overflow bool, merged int, err error) {
}
}
-// ourBatch if defined should equal with batch.
+// ourBatch is batch that we can modify.
func (db *DB) writeLocked(batch, ourBatch *Batch, merge, sync bool) error {
// Try to flush memdb. This method would also trying to throttle writes
// if it is too fast and compaction cannot catch-up.
@@ -212,6 +215,11 @@ func (db *DB) writeLocked(batch, ourBatch *Batch, merge, sync bool) error {
}
}
+ // Release ourBatch if any.
+ if ourBatch != nil {
+ defer db.batchPool.Put(ourBatch)
+ }
+
// Seq number.
seq := db.seq + 1