Godeps: pull in the leveldb upstream write race fix

This commit is contained in:
Péter Szilágyi 2016-03-11 09:30:25 +02:00
parent 850f41b374
commit 9ff07304a3
4 changed files with 15 additions and 69 deletions

24
Godeps/Godeps.json generated
View File

@ -140,51 +140,51 @@
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb", "ImportPath": "github.com/syndtr/goleveldb/leveldb",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/cache", "ImportPath": "github.com/syndtr/goleveldb/leveldb/cache",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/comparer", "ImportPath": "github.com/syndtr/goleveldb/leveldb/comparer",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/errors", "ImportPath": "github.com/syndtr/goleveldb/leveldb/errors",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/filter", "ImportPath": "github.com/syndtr/goleveldb/leveldb/filter",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/iterator", "ImportPath": "github.com/syndtr/goleveldb/leveldb/iterator",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/journal", "ImportPath": "github.com/syndtr/goleveldb/leveldb/journal",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/memdb", "ImportPath": "github.com/syndtr/goleveldb/leveldb/memdb",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/opt", "ImportPath": "github.com/syndtr/goleveldb/leveldb/opt",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/storage", "ImportPath": "github.com/syndtr/goleveldb/leveldb/storage",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/table", "ImportPath": "github.com/syndtr/goleveldb/leveldb/table",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "github.com/syndtr/goleveldb/leveldb/util", "ImportPath": "github.com/syndtr/goleveldb/leveldb/util",
"Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280" "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
}, },
{ {
"ImportPath": "golang.org/x/crypto/pbkdf2", "ImportPath": "golang.org/x/crypto/pbkdf2",

View File

@ -166,15 +166,15 @@ func (db *DB) Write(b *Batch, wo *opt.WriteOptions) (err error) {
merged := 0 merged := 0
danglingMerge := false danglingMerge := false
defer func() { defer func() {
for i := 0; i < merged; i++ {
db.writeAckC <- err
}
if danglingMerge { if danglingMerge {
// Only one dangling merge at most, so this is safe. // Only one dangling merge at most, so this is safe.
db.writeMergedC <- false db.writeMergedC <- false
} else { } else {
<-db.writeLockC <-db.writeLockC
} }
for i := 0; i < merged; i++ {
db.writeAckC <- err
}
}() }()
mdb, mdbFree, err := db.flush(b.size()) mdb, mdbFree, err := db.flush(b.size())

View File

@ -1,21 +0,0 @@
// Copyright (c) 2014, 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.3
package util
import (
"sync"
)
type Pool struct {
sync.Pool
}
func NewPool(cap int) *Pool {
return &Pool{}
}

View File

@ -1,33 +0,0 @@
// Copyright (c) 2014, 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.3
package util
type Pool struct {
pool chan interface{}
}
func (p *Pool) Get() interface{} {
select {
case x := <-p.pool:
return x
default:
return nil
}
}
func (p *Pool) Put(x interface{}) {
select {
case p.pool <- x:
default:
}
}
func NewPool(cap int) *Pool {
return &Pool{pool: make(chan interface{}, cap)}
}