Wrong command order (#879)
This commit is contained in:
parent
f4cd8d27b5
commit
30cf19e0ae
|
@ -345,7 +345,7 @@
|
||||||
"leveldb/table",
|
"leveldb/table",
|
||||||
"leveldb/util"
|
"leveldb/util"
|
||||||
]
|
]
|
||||||
revision = "b89cc31ef7977104127d34c1bd31ebd1a9db2199"
|
revision = "34011bf325bce385408353a30b101fe5e923eb6e"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -483,6 +483,6 @@
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "52c415dac55089fc7b13ce6cd05f773a88a62e5e472952f13eb49c4605711f90"
|
inputs-digest = "749bac1b2eea5afcdd2fdca30c2d1b68763378c463f7c409742de028c4fe8402"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|
|
@ -138,7 +138,7 @@ ignored = [ "github.com/ethereum/go-ethereum/ethapi" ]
|
||||||
|
|
||||||
[[override]]
|
[[override]]
|
||||||
name = "github.com/syndtr/goleveldb"
|
name = "github.com/syndtr/goleveldb"
|
||||||
revision = "b89cc31ef7977104127d34c1bd31ebd1a9db2199"
|
revision = "34011bf325bce385408353a30b101fe5e923eb6e"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
|
|
@ -32,6 +32,11 @@ type DB struct {
|
||||||
// Need 64-bit alignment.
|
// Need 64-bit alignment.
|
||||||
seq uint64
|
seq uint64
|
||||||
|
|
||||||
|
// Stats. Need 64-bit alignment.
|
||||||
|
cWriteDelay int64 // The cumulative duration of write delays
|
||||||
|
cWriteDelayN int32 // The cumulative number of write delays
|
||||||
|
aliveSnaps, aliveIters int32
|
||||||
|
|
||||||
// Session.
|
// Session.
|
||||||
s *session
|
s *session
|
||||||
|
|
||||||
|
@ -49,9 +54,6 @@ type DB struct {
|
||||||
snapsMu sync.Mutex
|
snapsMu sync.Mutex
|
||||||
snapsList *list.List
|
snapsList *list.List
|
||||||
|
|
||||||
// Stats.
|
|
||||||
aliveSnaps, aliveIters int32
|
|
||||||
|
|
||||||
// Write.
|
// Write.
|
||||||
batchPool sync.Pool
|
batchPool sync.Pool
|
||||||
writeMergeC chan writeMerge
|
writeMergeC chan writeMerge
|
||||||
|
@ -321,7 +323,7 @@ func recoverTable(s *session, o *opt.Options) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = iter.Error()
|
err = iter.Error()
|
||||||
if err != nil {
|
if err != nil && !errors.IsCorrupted(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = tw.Close()
|
err = tw.Close()
|
||||||
|
@ -392,7 +394,7 @@ func recoverTable(s *session, o *opt.Options) error {
|
||||||
}
|
}
|
||||||
imax = append(imax[:0], key...)
|
imax = append(imax[:0], key...)
|
||||||
}
|
}
|
||||||
if err := iter.Error(); err != nil {
|
if err := iter.Error(); err != nil && !errors.IsCorrupted(err) {
|
||||||
iter.Release()
|
iter.Release()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -904,6 +906,8 @@ func (db *DB) GetSnapshot() (*Snapshot, error) {
|
||||||
// Returns the number of files at level 'n'.
|
// Returns the number of files at level 'n'.
|
||||||
// leveldb.stats
|
// leveldb.stats
|
||||||
// Returns statistics of the underlying DB.
|
// Returns statistics of the underlying DB.
|
||||||
|
// leveldb.writedelay
|
||||||
|
// Returns cumulative write delay caused by compaction.
|
||||||
// leveldb.sstables
|
// leveldb.sstables
|
||||||
// Returns sstables list for each level.
|
// Returns sstables list for each level.
|
||||||
// leveldb.blockpool
|
// leveldb.blockpool
|
||||||
|
@ -955,6 +959,9 @@ func (db *DB) GetProperty(name string) (value string, err error) {
|
||||||
level, len(tables), float64(tables.size())/1048576.0, duration.Seconds(),
|
level, len(tables), float64(tables.size())/1048576.0, duration.Seconds(),
|
||||||
float64(read)/1048576.0, float64(write)/1048576.0)
|
float64(read)/1048576.0, float64(write)/1048576.0)
|
||||||
}
|
}
|
||||||
|
case p == "writedelay":
|
||||||
|
writeDelayN, writeDelay := atomic.LoadInt32(&db.cWriteDelayN), time.Duration(atomic.LoadInt64(&db.cWriteDelay))
|
||||||
|
value = fmt.Sprintf("DelayN:%d Delay:%s", writeDelayN, writeDelay)
|
||||||
case p == "sstables":
|
case p == "sstables":
|
||||||
for level, tables := range v.levels {
|
for level, tables := range v.levels {
|
||||||
value += fmt.Sprintf("--- level %d ---\n", level)
|
value += fmt.Sprintf("--- level %d ---\n", level)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package leveldb
|
package leveldb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/syndtr/goleveldb/leveldb/memdb"
|
"github.com/syndtr/goleveldb/leveldb/memdb"
|
||||||
|
@ -117,6 +118,8 @@ func (db *DB) flush(n int) (mdb *memDB, mdbFree int, err error) {
|
||||||
db.writeDelayN++
|
db.writeDelayN++
|
||||||
} else if db.writeDelayN > 0 {
|
} else if db.writeDelayN > 0 {
|
||||||
db.logf("db@write was delayed N·%d T·%v", db.writeDelayN, db.writeDelay)
|
db.logf("db@write was delayed N·%d T·%v", db.writeDelayN, db.writeDelay)
|
||||||
|
atomic.AddInt32(&db.cWriteDelayN, int32(db.writeDelayN))
|
||||||
|
atomic.AddInt64(&db.cWriteDelay, int64(db.writeDelay))
|
||||||
db.writeDelay = 0
|
db.writeDelay = 0
|
||||||
db.writeDelayN = 0
|
db.writeDelayN = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ var (
|
||||||
// Releaser is the interface that wraps the basic Release method.
|
// Releaser is the interface that wraps the basic Release method.
|
||||||
type Releaser interface {
|
type Releaser interface {
|
||||||
// Release releases associated resources. Release should always success
|
// Release releases associated resources. Release should always success
|
||||||
// and can be called multipe times without causing error.
|
// and can be called multiple times without causing error.
|
||||||
Release()
|
Release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue