Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulated etcd version #211

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
correct get req range end and limit check
louiseschmidtgen committed Dec 9, 2024
commit 58783342557f27345ac2a391f5178d75d2fafea3
8 changes: 3 additions & 5 deletions pkg/kine/server/get.go
Original file line number Diff line number Diff line change
@@ -23,11 +23,9 @@ func (l *LimitedServer) get(ctx context.Context, r *etcdserverpb.RangeRequest) (
attribute.Int64("revision", r.Revision),
)

if len(r.RangeEnd) != 0 {
return nil, fmt.Errorf("unexpected rangeEnd: want empty, got %s", r.RangeEnd)
}
if r.Limit != 0 {
return nil, fmt.Errorf("unexpected limit: want 0, got %d", r.Limit)
if r.Limit != 0 && len(r.RangeEnd) != 0 {
err := fmt.Errorf("invalid combination of rangeEnd and limit, limit should be 0 got %d", r.Limit)
Copy link
Contributor

@HomayoonAlimohammadi HomayoonAlimohammadi Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can change this to a named return (probably in another PR). Because IMO it's easy to miss this and just return fmt.Errorf(...) which won't be caught in the defer.

return nil, err
}

rev, kv, err := l.backend.List(ctx, string(r.Key), "", 1, r.Revision)