From b1078c18d523faf1b13c3be91185568564ffa269 Mon Sep 17 00:00:00 2001 From: Petr Bodunov Date: Tue, 7 Oct 2025 09:33:35 +0000 Subject: [PATCH] fix lease compare in txn Signed-off-by: Petr Bodunov --- etcdctl/ctlv3/command/txn_command.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etcdctl/ctlv3/command/txn_command.go b/etcdctl/ctlv3/command/txn_command.go index df746a2289fa..3e6430f2cf9d 100644 --- a/etcdctl/ctlv3/command/txn_command.go +++ b/etcdctl/ctlv3/command/txn_command.go @@ -24,7 +24,6 @@ import ( "github.com/spf13/cobra" - pb "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/v3/cobrautl" ) @@ -222,7 +221,9 @@ func ParseCompare(line string) (*clientv3.Cmp, error) { case "val", "value": cmp = clientv3.Compare(clientv3.Value(key), op, val) case "lease": - cmp = clientv3.Compare(clientv3.Cmp{Target: pb.Compare_LEASE}, op, val) + if v, err = strconv.ParseInt(val, 16, 64); err == nil { + cmp = clientv3.Compare(clientv3.LeaseValue(key), op, v) + } default: return nil, fmt.Errorf("malformed comparison: %s (unknown target %s)", line, target) }