aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-09-05 21:04:32 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-09-05 21:04:32 +0800
commitcd6c861dc567478adb64b7efef327a4aceda97f5 (patch)
treeba7b5520af5c2fb8a6715b80954a75a4153b8c61
parentc91f7beb53ff1ab0376d9aa5fab5a8de8b04631c (diff)
downloadgo-tangerine-cd6c861dc567478adb64b7efef327a4aceda97f5.tar.gz
go-tangerine-cd6c861dc567478adb64b7efef327a4aceda97f5.tar.zst
go-tangerine-cd6c861dc567478adb64b7efef327a4aceda97f5.zip
vendor: pull in latest changes for goleveldb (#15090)
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db.go2
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go4
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db_state.go7
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/db_write.go9
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/doc.go2
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go24
-rw-r--r--vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go1
-rw-r--r--vendor/vendor.json54
8 files changed, 68 insertions, 35 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db.go b/vendor/github.com/syndtr/goleveldb/leveldb/db.go
index a02cb2c50..b0cdcb3d0 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db.go
@@ -844,7 +844,7 @@ func (db *DB) Get(key []byte, ro *opt.ReadOptions) (value []byte, err error) {
// Has returns true if the DB does contains the given key.
//
-// It is safe to modify the contents of the argument after Get returns.
+// It is safe to modify the contents of the argument after Has returns.
func (db *DB) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) {
err = db.ok()
if err != nil {
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go
index 2d0ad0753..b6563e87e 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go
@@ -289,7 +289,7 @@ func (db *DB) memCompaction() {
close(resumeC)
resumeC = nil
case <-db.closeC:
- return
+ db.compactionExitTransact()
}
var (
@@ -338,7 +338,7 @@ func (db *DB) memCompaction() {
case <-resumeC:
close(resumeC)
case <-db.closeC:
- return
+ db.compactionExitTransact()
}
}
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go
index 85b02d24b..65e1c54bb 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_state.go
@@ -7,6 +7,7 @@
package leveldb
import (
+ "errors"
"sync/atomic"
"time"
@@ -15,6 +16,10 @@ import (
"github.com/syndtr/goleveldb/leveldb/storage"
)
+var (
+ errHasFrozenMem = errors.New("has frozen mem")
+)
+
type memDB struct {
db *DB
*memdb.DB
@@ -126,7 +131,7 @@ func (db *DB) newMem(n int) (mem *memDB, err error) {
defer db.memMu.Unlock()
if db.frozenMem != nil {
- panic("still has frozen mem")
+ return nil, errHasFrozenMem
}
if db.journal == nil {
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
index cc428b695..5b6cb487d 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
@@ -32,15 +32,24 @@ func (db *DB) writeJournal(batches []*Batch, seq uint64, sync bool) error {
}
func (db *DB) rotateMem(n int, wait bool) (mem *memDB, err error) {
+ retryLimit := 3
+retry:
// Wait for pending memdb compaction.
err = db.compTriggerWait(db.mcompCmdC)
if err != nil {
return
}
+ retryLimit--
// Create new memdb and journal.
mem, err = db.newMem(n)
if err != nil {
+ if err == errHasFrozenMem {
+ if retryLimit <= 0 {
+ panic("BUG: still has frozen memdb")
+ }
+ goto retry
+ }
return
}
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/doc.go b/vendor/github.com/syndtr/goleveldb/leveldb/doc.go
index 53f13bb24..be768e573 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/doc.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/doc.go
@@ -8,6 +8,8 @@
//
// Create or open a database:
//
+// // 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/storage/file_storage.go b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go
index e53434cab..1189decac 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go
@@ -234,14 +234,30 @@ func (fs *fileStorage) SetMeta(fd FileDesc) (err error) {
return
}
_, err = fmt.Fprintln(w, fsGenName(fd))
- // Close the file first.
- if cerr := w.Close(); cerr != nil {
- fs.log(fmt.Sprintf("close CURRENT.%d: %v", fd.Num, cerr))
+ if err != nil {
+ fs.log(fmt.Sprintf("write CURRENT.%d: %v", fd.Num, err))
+ return
+ }
+ if err = w.Sync(); err != nil {
+ fs.log(fmt.Sprintf("flush CURRENT.%d: %v", fd.Num, err))
+ return
+ }
+ if err = w.Close(); err != nil {
+ fs.log(fmt.Sprintf("close CURRENT.%d: %v", fd.Num, err))
+ return
}
if err != nil {
return
}
- return rename(path, filepath.Join(fs.path, "CURRENT"))
+ if err = rename(path, filepath.Join(fs.path, "CURRENT")); err != nil {
+ fs.log(fmt.Sprintf("rename CURRENT.%d: %v", fd.Num, err))
+ return
+ }
+ // Sync root directory.
+ if err = syncDir(fs.path); err != nil {
+ fs.log(fmt.Sprintf("syncDir: %v", err))
+ }
+ return
}
func (fs *fileStorage) GetMeta() (fd FileDesc, err error) {
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go b/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go
index c5be420b3..16cfbaa00 100644
--- a/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go
+++ b/vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go
@@ -581,6 +581,7 @@ func (r *Reader) readRawBlock(bh blockHandle, verifyChecksum bool) ([]byte, erro
case blockTypeSnappyCompression:
decLen, err := snappy.DecodedLen(data[:bh.length])
if err != nil {
+ r.bpool.Put(data)
return nil, r.newErrCorruptedBH(bh, err.Error())
}
decData := r.bpool.Get(decLen)
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 56c95e341..a9de0ec72 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -334,76 +334,76 @@
"revisionTime": "2016-06-18T19:32:21Z"
},
{
- "checksumSHA1": "QvOrAO5S37PL/6XZVWIVGyAbn60=",
+ "checksumSHA1": "yHbyLpI/Meh0DGrmi8x6FrDxxUY=",
"path": "github.com/syndtr/goleveldb/leveldb",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "EKIow7XkgNdWvR/982ffIZxKG8Y=",
"path": "github.com/syndtr/goleveldb/leveldb/cache",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "5KPgnvCPlR0ysDAqo6jApzRQ3tw=",
"path": "github.com/syndtr/goleveldb/leveldb/comparer",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "1DRAxdlWzS4U0xKN/yQ/fdNN7f0=",
"path": "github.com/syndtr/goleveldb/leveldb/errors",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "eqKeD6DS7eNCtxVYZEHHRKkyZrw=",
"path": "github.com/syndtr/goleveldb/leveldb/filter",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "8dXuAVIsbtaMiGGuHjzGR6Ny/5c=",
"path": "github.com/syndtr/goleveldb/leveldb/iterator",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "gJY7bRpELtO0PJpZXgPQ2BYFJ88=",
"path": "github.com/syndtr/goleveldb/leveldb/journal",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "j+uaQ6DwJ50dkIdfMQu1TXdlQcY=",
"path": "github.com/syndtr/goleveldb/leveldb/memdb",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "UmQeotV+m8/FduKEfLOhjdp18rs=",
"path": "github.com/syndtr/goleveldb/leveldb/opt",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
- "checksumSHA1": "/Wvv9HeJTN9UUjdjwUlz7X4ioIo=",
+ "checksumSHA1": "tQ2AqXXAEy9icbZI9dLVdZGvWMw=",
"path": "github.com/syndtr/goleveldb/leveldb/storage",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
- "checksumSHA1": "JTJA+u8zk7EXy1UUmpFPNGvtO2A=",
+ "checksumSHA1": "gWFPMz8OQeul0t54RM66yMTX49g=",
"path": "github.com/syndtr/goleveldb/leveldb/table",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "4zil8Gwg8VPkDn1YzlgCvtukJFU=",
"path": "github.com/syndtr/goleveldb/leveldb/util",
- "revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
- "revisionTime": "2016-12-27T11:05:19Z"
+ "revision": "b89cc31ef7977104127d34c1bd31ebd1a9db2199",
+ "revisionTime": "2017-07-25T06:48:36Z"
},
{
"checksumSHA1": "TT1rac6kpQp2vz24m5yDGUNQ/QQ=",