diff options
author | Martin Holst Swende <martin@swende.se> | 2018-11-29 03:53:02 +0800 |
---|---|---|
committer | Martin Holst Swende <martin@swende.se> | 2018-11-29 16:58:09 +0800 |
commit | 8380a1303ce6a2fa4760a8641e47e7196a941b4c (patch) | |
tree | af7ed6cf97ccb0e93a446c1ebcf1d44c52bcc491 /vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go | |
parent | 695a5cce1e4c0db173dd2a798ed0dc14ee9ca2a1 (diff) | |
download | dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar.gz dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar.bz2 dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar.lz dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar.xz dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.tar.zst dexon-8380a1303ce6a2fa4760a8641e47e7196a941b4c.zip |
vendor: update leveldb
Diffstat (limited to 'vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go')
-rw-r--r-- | vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go index 28e50906a..0c1b9a53b 100644 --- a/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go +++ b/vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go @@ -663,7 +663,7 @@ type cCmd interface { } type cAuto struct { - // Note for table compaction, an empty ackC represents it's a compaction waiting command. + // Note for table compaction, an non-empty ackC represents it's a compaction waiting command. ackC chan<- error } @@ -777,8 +777,8 @@ func (db *DB) mCompaction() { func (db *DB) tCompaction() { var ( - x cCmd - ackQ, waitQ []cCmd + x cCmd + waitQ []cCmd ) defer func() { @@ -787,10 +787,6 @@ func (db *DB) tCompaction() { panic(x) } } - for i := range ackQ { - ackQ[i].ack(ErrClosed) - ackQ[i] = nil - } for i := range waitQ { waitQ[i].ack(ErrClosed) waitQ[i] = nil @@ -821,11 +817,6 @@ func (db *DB) tCompaction() { waitQ = waitQ[:0] } } else { - for i := range ackQ { - ackQ[i].ack(nil) - ackQ[i] = nil - } - ackQ = ackQ[:0] for i := range waitQ { waitQ[i].ack(nil) waitQ[i] = nil @@ -844,9 +835,12 @@ func (db *DB) tCompaction() { switch cmd := x.(type) { case cAuto: if cmd.ackC != nil { - waitQ = append(waitQ, x) - } else { - ackQ = append(ackQ, x) + // Check the write pause state before caching it. + if db.resumeWrite() { + x.ack(nil) + } else { + waitQ = append(waitQ, x) + } } case cRange: x.ack(db.tableRangeCompaction(cmd.level, cmd.min, cmd.max)) |