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

Remove most_recent_record arg from Cursor.close_slice #36216

Merged
merged 3 commits into from Mar 19, 2024

Conversation

ambirdsall
Copy link
Contributor

@ambirdsall ambirdsall commented Mar 15, 2024

After #35843 removed the most_recent_record argument from the logic of the close_slice method, this cleans up the Cursor interface to not include the argument at all. Relates to https://github.com/airbytehq/airbyte-internal-issues/issues/6314

@ambirdsall ambirdsall requested a review from a team as a code owner March 15, 2024 23:55
Copy link

vercel bot commented Mar 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 18, 2024 11:39pm

@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Mar 15, 2024
@natikgadzhi
Copy link
Contributor

* What went wrong:
Execution failed for task ':flakeCheck'.

Oh my gawd. The amount of time we stumble at this. I can't wait to switch the CDK to Poetry and switch it to Ruff for linting and formatting with pre-commit hook so we don't have to waste time and CI credits on stuff like this. /cc @erohmensing

Copy link
Contributor

@natikgadzhi natikgadzhi left a comment

Choose a reason for hiding this comment

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

Honestly weirdly I have no idea what's going on here. In the previous PR we introduced most_recent_record that is being observed, but here I see we're just going back to sticking with the slice. How does this work?

@ambirdsall
Copy link
Contributor Author

Honestly weirdly I have no idea what's going on here. In the previous PR we introduced most_recent_record that is being observed, but here I see we're just going back to sticking with the slice. How does this work?

@natikgadzhi a quick overview of how this logic has evolved:

  1. The old logic: the cursor state was calculated in Cursor.close_slice by finding the most recent value out of the most recent record read, the slice's end time, and the previous state.
  2. The new logic (last PR): a new Cursor.observe method was added to track the highest cursor value observed within its slice boundaries and the logic in Cursor.close_slice was simplified: now it only compares that highest observed cursor value with the previous state. This does a better job handling reads where the cursor values are sorted in descending order (since the most recently-read cursor value passed to Cursor.close_slice would be the lowest, not the highest) or when new values are added between the latest read and its old slice boundary (e.g. a connector that has a DatetimeBasedCursor with one-month granularity is synced on the 20th of the month and then new records are added on the 25th). The PR shipping this logic (Base datetime cursor state off latest observed record #35843) kept the old method signature to limit the blast radius of the new change.
  3. the cleanup (this PR): since the most recently-read record at the time close_slice is called is no longer used to calculate the cursor state, it is removed from the method call altogether. It's a fairly trivial change, and perhaps could have been included in the last PR—especially since any connectors with custom cursor overrides pin the CDK to specific versions anyway.
  4. update custom cursors (next PR): the Greenhouse and Chargebee sources have to be updated to handle Cursor.observe calls correctly (i.e. track cursor values there instead of Cursor.close_slice) and to respect the new close_slice signature. Because the connector CI pipeline needs a published CDK version to validate changes, those updates cannot get a green build until the current PR has to be merged and published.

@ambirdsall ambirdsall force-pushed the amb/update-cursor-close_slice-interface branch from 082f6b8 to 0d17c2f Compare March 18, 2024 20:18
@ambirdsall ambirdsall requested a review from girarda March 18, 2024 20:21
Copy link
Contributor

@girarda girarda left a comment

Choose a reason for hiding this comment

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

lgtm! thanks for the quick follow up! :shipit:

@ambirdsall ambirdsall merged commit 44f784e into master Mar 19, 2024
29 checks passed
@ambirdsall ambirdsall deleted the amb/update-cursor-close_slice-interface branch March 19, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDK Connector Development Kit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants