vendor: pull in latest changes for goleveldb (#15090)

pull/15094/head
Péter Szilágyi 7 years ago committed by Felix Lange
parent c91f7beb53
commit cd6c861dc5
  1. 2
      vendor/github.com/syndtr/goleveldb/leveldb/db.go
  2. 4
      vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go
  3. 7
      vendor/github.com/syndtr/goleveldb/leveldb/db_state.go
  4. 9
      vendor/github.com/syndtr/goleveldb/leveldb/db_write.go
  5. 2
      vendor/github.com/syndtr/goleveldb/leveldb/doc.go
  6. 24
      vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go
  7. 1
      vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go
  8. 54
      vendor/vendor.json

@ -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 {

@ -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()
}
}

@ -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 {

@ -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
}

@ -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()

@ -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) {

@ -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)

54
vendor/vendor.json vendored

@ -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=",

Loading…
Cancel
Save