aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-03-11 16:30:46 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-03-11 16:30:46 +0800
commitc3a4874e5e8628a1e4ec2592346836622a60d492 (patch)
treee1e5e34cf89b8e9ecf90232ea8b035eb55de5f6c
parent850f41b3747d61e0e7e6f0d30eeca12c3a98b08d (diff)
parent9ff07304a37799fc820bb4b29ca3ba2a2a3b458f (diff)
downloaddexon-c3a4874e5e8628a1e4ec2592346836622a60d492.tar.gz
dexon-c3a4874e5e8628a1e4ec2592346836622a60d492.tar.zst
dexon-c3a4874e5e8628a1e4ec2592346836622a60d492.zip
Merge pull request #2326 from karalabe/goleveldb-datarace-fix
Godeps: pull in the leveldb upstream write race fix
-rw-r--r--Godeps/Godeps.json24
-rw-r--r--Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go6
-rw-r--r--Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool.go21
-rw-r--r--Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool_legacy.go33
4 files changed, 15 insertions, 69 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 9bcc8c756..f0a250274 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -140,51 +140,51 @@
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/cache",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/comparer",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/errors",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/filter",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/iterator",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/journal",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/memdb",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/opt",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/storage",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/table",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb/util",
- "Rev": "ad0d8b2ab58a55ed5c58073aa46451d5e1ca1280"
+ "Rev": "917f41c560270110ceb73c5b38be2a9127387071"
},
{
"ImportPath": "golang.org/x/crypto/pbkdf2",
diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go
index fb7896139..5576761fe 100644
--- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go
+++ b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_write.go
@@ -166,15 +166,15 @@ func (db *DB) Write(b *Batch, wo *opt.WriteOptions) (err error) {
merged := 0
danglingMerge := false
defer func() {
+ for i := 0; i < merged; i++ {
+ db.writeAckC <- err
+ }
if danglingMerge {
// Only one dangling merge at most, so this is safe.
db.writeMergedC <- false
} else {
<-db.writeLockC
}
- for i := 0; i < merged; i++ {
- db.writeAckC <- err
- }
}()
mdb, mdbFree, err := db.flush(b.size())
diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool.go
deleted file mode 100644
index 1f7fdd41f..000000000
--- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool.go
+++ /dev/null
@@ -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{}
-}
diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool_legacy.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool_legacy.go
deleted file mode 100644
index 27b8d03be..000000000
--- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/pool_legacy.go
+++ /dev/null
@@ -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)}
-}