fix(e2b): stabilize pagination for duplicate timestamps#563
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @chacha923! It looks like this is your first PR to openkruise/agents 🎉 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #563 +/- ##
==========================================
+ Coverage 79.67% 79.92% +0.25%
==========================================
Files 194 202 +8
Lines 13784 14848 +1064
==========================================
+ Hits 10983 11868 +885
- Misses 2403 2551 +148
- Partials 398 429 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c4a8a7c to
42ca70c
Compare
|
Hello @furykerry @AiRanthem @zmberg , |
|
Thanks for working on this. The overall stable-cursor direction looks right to me. For One thing I think should be fixed before merge: snapshot listing currently uses Could we change the snapshot tiebreaker to the Kubernetes object identity instead, for example: GetUniqueKey: func(cp infra.CheckpointInfo) string {
return cp.Namespace + "/" + cp.Name
}or include It would also be good to add a regression test for snapshots where multiple checkpoints have the same creation timestamp and the same checkpoint ID but different After that adjustment, I think this PR should cover the duplicate timestamp pagination issue much more robustly. |
Use an opaque cursor with both the sort key and a unique object key when listing sandboxes and snapshots. Keep raw sort-key tokens compatible for existing clients. Fixes openkruise#439 Signed-off-by: zhuangzhewei <zhuangzhewei09@dingtalk.com>
42ca70c to
047a53e
Compare
|
@chacha923: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Thanks for the review. I updated the snapshot pagination cursor according to your suggestion. Snapshot listing now uses the Kubernetes object identity ( |
|
Fixes #581 |
What this PR does
Fixes pagination for
GET /v2/sandboxesand snapshot listing when multiple objects share the same timestamp sort key.The previous cursor only stored the timestamp of the last returned item. Since claim timestamps and checkpoint creation timestamps can collide, the next page searched for the first item strictly after that timestamp and skipped remaining objects with the same timestamp.
This PR adds an optional stable cursor to the internal paginator. When a unique key is configured, pagination now sorts and resumes by
(sort key, unique key), encodes the cursor as an opaque base64 JSON token, and keeps raw sort-key tokens compatible for existing clients.Changes
GetUniqueKeysupport topkg/utils/pagination.Paginator.namespace/name) as the tiebreaker for snapshot listing while keeping the responseSnapshotIDunchanged.Tests
Fixes #439