Merge pull request #11960 from tedyu/internal-create-err-chk

etcdserver: check error return for store#internalCreate
This commit is contained in:
Gyuho Lee 2020-06-03 14:13:19 -07:00 committed by GitHub
commit a09533d63d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -610,7 +610,9 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique,
}
e.PrevNode = n.Repr(false, false, s.clock)
n.Remove(false, false, nil)
if err := n.Remove(false, false, nil); err != nil {
return nil, err
}
} else {
return nil, v2error.NewError(v2error.EcodeNodeExist, nodePath, currIndex)
}
@ -630,7 +632,9 @@ func (s *store) internalCreate(nodePath string, dir bool, value string, unique,
}
// we are sure d is a directory and does not have the children with name n.Name
d.Add(n)
if err := d.Add(n); err != nil {
return nil, err
}
// node with TTL
if !n.IsPermanent() {