Skip to content

Commit

Permalink
Failed delete must return a ResponseRange instead
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos committed Nov 21, 2022
1 parent 20c4783 commit 5adfdbc
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pkg/server/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ func (l *LimitedServer) delete(ctx context.Context, key string, revision int64)
return nil, err
}

if !ok {
return &etcdserverpb.TxnResponse{
Header: txnHeader(rev),
Responses: []*etcdserverpb.ResponseOp{
{
Response: &etcdserverpb.ResponseOp_ResponseRange{
ResponseRange: &etcdserverpb.RangeResponse{
Header: txnHeader(rev),
Kvs: toKVs(kv),
},
},
},
},
Succeeded: false,
}, nil
}

return &etcdserverpb.TxnResponse{
Header: txnHeader(rev),
Responses: []*etcdserverpb.ResponseOp{
Expand All @@ -45,6 +62,6 @@ func (l *LimitedServer) delete(ctx context.Context, key string, revision int64)
},
},
},
Succeeded: ok,
Succeeded: true,
}, nil
}

0 comments on commit 5adfdbc

Please sign in to comment.