replace bytes.Compare() with bytes.Equal()

This commit is contained in:
chenyaqi01
2019-09-27 10:06:50 +08:00
parent 354a812086
commit 66be69bb0e
7 changed files with 11 additions and 11 deletions

View File

@@ -216,7 +216,7 @@ func (e *CombinedEtcdClient) AttachLease(leaseDuration time.Duration) error {
if err != nil {
klog.Errorf("Error while attaching lease to: %s", string(kv.Key))
}
if bytes.Compare(putResp.PrevKv.Value, kv.Value) != 0 {
if !bytes.Equal(putResp.PrevKv.Value, kv.Value) {
return fmt.Errorf("concurrent access to key detected when setting lease on %s, expected previous value of %s but got %s",
kv.Key, kv.Value, putResp.PrevKv.Value)
}