mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4064 from xiang90/reduce_fysnc
backend: do not commit unless there is a pending change
This commit is contained in:
@@ -132,7 +132,11 @@ func (t *batchTx) commit(stop bool) {
|
||||
var err error
|
||||
// commit the last tx
|
||||
if t.tx != nil {
|
||||
if t.pending == 0 && !stop {
|
||||
return
|
||||
}
|
||||
err = t.tx.Commit()
|
||||
t.pending = 0
|
||||
if err != nil {
|
||||
log.Fatalf("storage: cannot commit tx (%s)", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user