Update goleveldb vendored dependency (see #662)

This commit is contained in:
Andrey Smirnov
2017-11-08 00:49:56 +03:00
parent 67c26368ee
commit 5a1d006850
8 changed files with 31 additions and 10 deletions
Generated
+1 -1
View File
@@ -166,7 +166,7 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
branch = "master" branch = "master"
name = "github.com/syndtr/goleveldb" name = "github.com/syndtr/goleveldb"
packages = ["leveldb","leveldb/cache","leveldb/comparer","leveldb/errors","leveldb/filter","leveldb/iterator","leveldb/journal","leveldb/memdb","leveldb/opt","leveldb/storage","leveldb/table","leveldb/util"] packages = ["leveldb","leveldb/cache","leveldb/comparer","leveldb/errors","leveldb/filter","leveldb/iterator","leveldb/journal","leveldb/memdb","leveldb/opt","leveldb/storage","leveldb/table","leveldb/util"]
revision = "3c5717caf1475fd25964109a0fc640bd150fce43" revision = "549b6d6b1c0419617182954dd77770f2e2685ed5"
[[projects]] [[projects]]
name = "github.com/ugorji/go" name = "github.com/ugorji/go"
+2
View File
@@ -17,6 +17,8 @@ Usage
Create or open a database: Create or open a database:
```go ```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) db, err := leveldb.OpenFile("path/to/db", nil)
... ...
defer db.Close() defer db.Close()
+1 -1
View File
@@ -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. // 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) { func (db *DB) Has(key []byte, ro *opt.ReadOptions) (ret bool, err error) {
err = db.ok() err = db.ok()
if err != nil { if err != nil {
+3 -2
View File
@@ -2247,12 +2247,12 @@ func TestDB_GoleveldbIssue72and83(t *testing.T) {
k1checksum0 := binary.LittleEndian.Uint32(k1[len(k1)-4:]) k1checksum0 := binary.LittleEndian.Uint32(k1[len(k1)-4:])
k1checksum1 := util.NewCRC(k1[:len(k1)-4]).Value() k1checksum1 := util.NewCRC(k1[:len(k1)-4]).Value()
if k1checksum0 != k1checksum1 { if k1checksum0 != k1checksum1 {
t.Fatalf("READER0 #%d.%d W#%d invalid K1 checksum: %#x != %#x", i, k, k1checksum0, k1checksum0) t.Fatalf("READER0 #%d.%d W#%d invalid K1 checksum: %#x != %#x", i, k, writei, k1checksum0, k1checksum0)
} }
k2checksum0 := binary.LittleEndian.Uint32(k2[len(k2)-4:]) k2checksum0 := binary.LittleEndian.Uint32(k2[len(k2)-4:])
k2checksum1 := util.NewCRC(k2[:len(k2)-4]).Value() k2checksum1 := util.NewCRC(k2[:len(k2)-4]).Value()
if k2checksum0 != k2checksum1 { if k2checksum0 != k2checksum1 {
t.Fatalf("READER0 #%d.%d W#%d invalid K2 checksum: %#x != %#x", i, k, k2checksum0, k2checksum1) t.Fatalf("READER0 #%d.%d W#%d invalid K2 checksum: %#x != %#x", i, k, writei, k2checksum0, k2checksum1)
} }
kwritei := int(binary.LittleEndian.Uint32(k2[len(k2)-8:])) kwritei := int(binary.LittleEndian.Uint32(k2[len(k2)-8:]))
if writei != kwritei { if writei != kwritei {
@@ -2840,6 +2840,7 @@ func TestDB_BulkInsertDelete(t *testing.T) {
} }
} }
h.waitCompaction()
if tot := h.totalTables(); tot > 10 { if tot := h.totalTables(); tot > 10 {
t.Fatalf("too many uncompacted tables: %d (%s)", tot, h.getTablesPerLevel()) t.Fatalf("too many uncompacted tables: %d (%s)", tot, h.getTablesPerLevel())
} }
+2
View File
@@ -8,6 +8,8 @@
// //
// Create or open a database: // 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) // db, err := leveldb.OpenFile("path/to/db", nil)
// ... // ...
// defer db.Close() // defer db.Close()
+1 -1
View File
@@ -88,7 +88,7 @@ type Iterator interface {
// its contents may change on the next call to any 'seeks method'. // its contents may change on the next call to any 'seeks method'.
Key() []byte Key() []byte
// Value returns the key of the current key/value pair, or nil if done. // Value returns the value of the current key/value pair, or nil if done.
// The caller should not modify the contents of the returned slice, and // The caller should not modify the contents of the returned slice, and
// its contents may change on the next call to any 'seeks method'. // its contents may change on the next call to any 'seeks method'.
Value() []byte Value() []byte
+1 -1
View File
@@ -329,7 +329,7 @@ func (p *DB) Delete(key []byte) error {
h := p.nodeData[node+nHeight] h := p.nodeData[node+nHeight]
for i, n := range p.prevNode[:h] { for i, n := range p.prevNode[:h] {
m := n + 4 + i m := n + nNext + i
p.nodeData[m] = p.nodeData[p.nodeData[m]+nNext+i] p.nodeData[m] = p.nodeData[p.nodeData[m]+nNext+i]
} }
+20 -4
View File
@@ -234,14 +234,30 @@ func (fs *fileStorage) SetMeta(fd FileDesc) (err error) {
return return
} }
_, err = fmt.Fprintln(w, fsGenName(fd)) _, err = fmt.Fprintln(w, fsGenName(fd))
// Close the file first. if err != nil {
if cerr := w.Close(); cerr != nil { fs.log(fmt.Sprintf("write CURRENT.%d: %v", fd.Num, err))
fs.log(fmt.Sprintf("close CURRENT.%d: %v", fd.Num, cerr)) 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 { if err != nil {
return 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) { func (fs *fileStorage) GetMeta() (fd FileDesc, err error) {