vendor: Update github.com/syndtr/goleveldb

This commit is contained in:
Jakob Borg 2017-03-07 11:57:45 +01:00
parent 4e3fdfaeef
commit 151004d645
5 changed files with 19 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

2
vendor/manifest vendored
View File

@ -265,7 +265,7 @@
"importpath": "github.com/syndtr/goleveldb",
"repository": "https://github.com/syndtr/goleveldb",
"vcs": "git",
"revision": "23851d93a2292dcc56e71a18ec9e0624d84a0f65",
"revision": "3c5717caf1475fd25964109a0fc640bd150fce43",
"branch": "master"
},
{