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

Fail without enqueueing iff the airbyte message type is unrecognized #40254

Merged

Conversation

johnny-schmidt
Copy link
Contributor

What

Addresses this Zenhub issue: when the airbyte message type is unrecognized, log an error instead of throwing the exception.

How

  1. Error handling/obfuscation is lifted out of the json deserializer (which is type-agnostic) into the caller (AirbyteMessageDeserializer)
  2. The caller's return value is made nullable
  3. The caller detects the specific failure (top-level enum type only), logs the unrecognized type only (no other client data context) and returns null
  4. The caller's caller skips enqueuing on null

NOTE: This means that we will never call enqueue with the byte size passed into accept. However, @stephane-airbyte noticed that we do nothing with this when the type is unrecognized anyway (which may be a mistake if something's relying on that matching the calls to accept).

cc @edgao

User Impact

User should notice very little. In the rare event we add a new message type, it will not be a breaking change.

Can this PR be safely reverted and rolled back?

  • [ X] YES 💚
  • NO ❌
    Yes, as long as we are not in the middle of the process of releasing a new message type. :)

@johnny-schmidt johnny-schmidt requested review from a team as code owners June 25, 2024 01:20
Copy link

vercel bot commented Jun 25, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Jun 26, 2024 3:33pm

@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Jun 25, 2024
Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

couple nitpicks, LGTM once those are resolved

FYI how to publish the cdk:

if (match != null) {
val unrecognized = match.groups[1]?.value
logger.warn { "Unrecognized message type: $unrecognized" }
return null
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather throw a typed exception than return null here. This way, we also avoid all the !! everywhere we know this to be valid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@johnny-schmidt johnny-schmidt force-pushed the issue-8064/throw-recoverable-on-unrecognized-enums branch from 37f5987 to f3bb580 Compare June 26, 2024 15:33
@johnny-schmidt
Copy link
Contributor Author

@stephane-airbyte I think your comments have been addressed.

@johnny-schmidt johnny-schmidt merged commit a50847a into master Jun 26, 2024
27 checks passed
@johnny-schmidt johnny-schmidt deleted the issue-8064/throw-recoverable-on-unrecognized-enums branch June 26, 2024 18:06
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