mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: add a fast return at put method
return when two leaseID is equal, avoid invalid operations. Fixes #13600
This commit is contained in:
parent
f75549d53b
commit
401cc1a575
@ -220,6 +220,11 @@ func (tw *storeTxnWrite) put(key, value []byte, leaseID lease.LeaseID) {
|
||||
tw.changes = append(tw.changes, kv)
|
||||
tw.trace.Step("store kv pair into bolt db")
|
||||
|
||||
if oldLease == leaseID {
|
||||
tw.trace.Step("attach lease to kv pair")
|
||||
return
|
||||
}
|
||||
|
||||
if oldLease != lease.NoLease {
|
||||
if tw.s.le == nil {
|
||||
panic("no lessor to detach lease")
|
||||
|
Loading…
x
Reference in New Issue
Block a user