|
@@ -98,6 +98,7 @@ func unsafeRange(c *bolt.Cursor, key, endKey []byte, limit int64) (keys [][]byte
|
|
|
isMatch = func(b []byte) bool { return bytes.Equal(b, key) }
|
|
isMatch = func(b []byte) bool { return bytes.Equal(b, key) }
|
|
|
limit = 1
|
|
limit = 1
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
for ck, cv := c.Seek(key); ck != nil && isMatch(ck); ck, cv = c.Next() {
|
|
for ck, cv := c.Seek(key); ck != nil && isMatch(ck); ck, cv = c.Next() {
|
|
|
vs = append(vs, cv)
|
|
vs = append(vs, cv)
|
|
|
keys = append(keys, ck)
|
|
keys = append(keys, ck)
|
|
@@ -154,6 +155,12 @@ func (t *batchTx) Unlock() {
|
|
|
t.Mutex.Unlock()
|
|
t.Mutex.Unlock()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (t *batchTx) safePending() int {
|
|
|
|
|
+ t.Mutex.Lock()
|
|
|
|
|
+ defer t.Mutex.Unlock()
|
|
|
|
|
+ return t.pending
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (t *batchTx) commit(stop bool) {
|
|
func (t *batchTx) commit(stop bool) {
|
|
|
// commit the last tx
|
|
// commit the last tx
|
|
|
if t.tx != nil {
|
|
if t.tx != nil {
|