Update goleveldb (fixes #1414)

This commit is contained in:
Jakob Borg 2015-03-08 07:49:02 +01:00
parent aeb3a3f7b5
commit 2fdc578a88
5 changed files with 40 additions and 24 deletions

2
Godeps/Godeps.json generated
View File

@ -35,7 +35,7 @@
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb", "ImportPath": "github.com/syndtr/goleveldb/leveldb",
"Rev": "63c9e642efad852f49e20a6f90194cae112fd2ac" "Rev": "e3f32eb300aa1e514fe8ba58d008da90a062273d"
}, },
{ {
"ImportPath": "github.com/syndtr/gosnappy/snappy", "ImportPath": "github.com/syndtr/gosnappy/snappy",

View File

@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// +build go1.3 // +build !go1.2
package leveldb package leveldb

View File

@ -0,0 +1,30 @@
// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// +build !go1.2
package cache
import (
"math/rand"
"testing"
)
func BenchmarkLRUCache(b *testing.B) {
c := NewCache(NewLRU(10000))
b.SetParallelism(10)
b.RunParallel(func(pb *testing.PB) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for pb.Next() {
key := uint64(r.Intn(1000000))
c.Get(0, key, func() (int, Value) {
return 1, key
}).Release()
}
})
}

View File

@ -552,19 +552,3 @@ func TestLRUCache_Close(t *testing.T) {
t.Errorf("delFunc isn't called 1 times: got=%d", delFuncCalled) t.Errorf("delFunc isn't called 1 times: got=%d", delFuncCalled)
} }
} }
func BenchmarkLRUCache(b *testing.B) {
c := NewCache(NewLRU(10000))
b.SetParallelism(10)
b.RunParallel(func(pb *testing.PB) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for pb.Next() {
key := uint64(r.Intn(1000000))
c.Get(0, key, func() (int, Value) {
return 1, key
}).Release()
}
})
}

View File

@ -347,12 +347,14 @@ func recoverTable(s *session, o *opt.Options) error {
return err return err
} }
iter := tr.NewIterator(nil, nil) iter := tr.NewIterator(nil, nil)
iter.(iterator.ErrorCallbackSetter).SetErrorCallback(func(err error) { if itererr, ok := iter.(iterator.ErrorCallbackSetter); ok {
itererr.SetErrorCallback(func(err error) {
if errors.IsCorrupted(err) { if errors.IsCorrupted(err) {
s.logf("table@recovery block corruption @%d %q", file.Num(), err) s.logf("table@recovery block corruption @%d %q", file.Num(), err)
tcorruptedBlock++ tcorruptedBlock++
} }
}) })
}
// Scan the table. // Scan the table.
for iter.Next() { for iter.Next() {