-
Notifications
You must be signed in to change notification settings - Fork 62
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
flowctl: Batch draft spec upserts, rather than incorrectly attempting to paginate the response #1629
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b40fdfa
to
1df9e8f
Compare
1df9e8f
to
e0a6959
Compare
I had wanted to use
|
e0a6959
to
afacaea
Compare
jgraettinger
approved these changes
Sep 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % a couple comments
… to paginate the response Also revert `--name` back to its previous behavior since pagination doesn't make sense there.
… page size, as PostgREST appears to be sometimes returning more rows than was requested.
ce6ed29
to
bae42ad
Compare
github-actions bot
pushed a commit
to estuary/homebrew-flowctl
that referenced
this pull request
Sep 19, 2024
## What's Changed * Batch draft spec upserts, rather than attempting to paginate the response by @jshearer in estuary/flow#1629 * use max build_id for validating local specs by @psFried in estuary/flow#1636 * Update pagination to use 0-indexed inclusive ranges, and page by response length rather than fixed page size. by @jshearer in estuary/flow#1637
github-actions bot
pushed a commit
to estuary/homebrew-flowctl
that referenced
this pull request
Sep 19, 2024
## What's Changed * Batch draft spec upserts, rather than attempting to paginate the response by @jshearer in estuary/flow#1629 * use max build_id for validating local specs by @psFried in estuary/flow#1636 * Update pagination to use 0-indexed inclusive ranges, and page by response length rather than fixed page size. by @jshearer in estuary/flow#1637
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
When pagination was originally introduced, this code-path was incorrectly switched to use it, despite it actually being an upsert which doesn't support pagination
flow/crates/flowctl/src/draft/author.rs
Lines 118 to 124 in f618926
Requests that don't support pagination just straight up ignore the
range
header. That wasn't a problem because the pagination logic only tried to fetch the next page if it got back exactly the number of rows in its requested range:flow/crates/flowctl/src/pagination.rs
Line 124 in f618926
So, this was an extremely rare edge case that would only get hit if you tried to publish exactly 1000 specs. But, I noticed that for requests that do respect pagination, sometimes postgrest will actually return one more row than was requested, so I updated this to a
>=
in #1516:flow/crates/flowctl/src/pagination.rs
Lines 124 to 126 in 8c90141
Before that change is committed, any request that returns more rows than were requested will incorrectly cause pagination to think it has reached the end and result in an incomplete result set being returned. After that change is committed, any attempt to publish >= 1000 specs will sit in an infinite loop attempting to load the next page of a request that doesn't support pagination.
This PR fixes both cases:
>=
check to correctly load paginated data where PostgREST returns more rows than the requested rangeTesting:
Figuring out what was going on here was a bit complicated as the reason I thought my original PR fixed the issue was that I was working ontop of my branch in #1516 that had the pagination fix applied, but not the fix for
flowctl catalog publish
. So, after confirming that my locally-built flowctl is just ontop of this branchjshearer/batch_drafts
, which is ontop ofmaster
:Also reverts
--name
back to its previous behavior since pagination doesn't make sense there.This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)