mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
storage/backend: fix off-by-one error for pending var
Or it may commit until batchLimit + 1.
This commit is contained in:
parent
7ed929fb3d
commit
f04884f74d
@ -43,7 +43,7 @@ func (t *batchTx) UnsafePut(bucketName []byte, key []byte, value []byte) {
|
||||
log.Fatalf("storage: cannot put key into bucket (%v)", err)
|
||||
}
|
||||
t.pending++
|
||||
if t.pending > t.backend.batchLimit {
|
||||
if t.pending >= t.backend.batchLimit {
|
||||
t.commit(false)
|
||||
t.pending = 0
|
||||
}
|
||||
@ -87,7 +87,7 @@ func (t *batchTx) UnsafeDelete(bucketName []byte, key []byte) {
|
||||
log.Fatalf("storage: cannot delete key from bucket (%v)", err)
|
||||
}
|
||||
t.pending++
|
||||
if t.pending > t.backend.batchLimit {
|
||||
if t.pending >= t.backend.batchLimit {
|
||||
t.commit(false)
|
||||
t.pending = 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user