-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
JDBC Sources: Wrap SQLTransientException with ConfigErrorException #19711
Conversation
Affected Connector ReportThe latest commit has removed all connector-related changes. There are no more dependent connectors for this PR. |
@@ -86,6 +86,11 @@ public AirbyteConnectionStatus check(final JsonNode config) throws Exception { | |||
} | |||
|
|||
return new AirbyteConnectionStatus().withStatus(Status.SUCCEEDED); | |||
} catch (final ConfigErrorException configErrorException) { |
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.
There isn't a need to catch and handle this exception here - it's handled at the top-level in https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/bases/base-java/src/main/java/io/airbyte/integrations/base/IntegrationRunner.java#L155
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.
Looks good! Just a small comment there with respect to removing code from AbstractDbSource.java
. Have you been able to test this?
@akashkulk removed unneeded code from AbstractDbSource. Yes, i tested it on my localhost. Please take a look at screenshot in the description of this PR |
if (e instanceof SQLTransientException) { | ||
final String message = e.getMessage(); | ||
if (message.contains("request timed out")) { | ||
throw new ConfigErrorException("Connection timed out. Unable to contact server."); |
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.
Because it's a transient error, I wonder if adding something like "Please try again later" is appropriate,
and also maybe making use of the original e.getMessage()
can add valuable information to the user.
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.
Because it's a transient error, I wonder if adding something like "Please try again later" is appropriate, and also maybe making use of the original
e.getMessage()
can add valuable information to the user.
@rodireich the connection timeout can be not only because there is some problem with the existing server, but also because if the user pushed the wrong host / port on UI which will also lead to a timeout, so just adding "Please try again later" will be not entirely correct. Might be better to use - "Please check your server settings or try again later". What do you think about it?
Replacing the original e.getMessage() with a more user-friendly one is is a task of this issue. Please see this comment https://github.com/airbytehq/alpha-beta-issues/issues/331#issuecomment-1317496296
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.
I see. thank you for explaining!
… into vmaltsev/331-mysql-config-error
@akashkulk seems like we can not remove this catch clause cause it will lead to build failing. Please take a look here https://github.com/airbytehq/airbyte/actions/runs/3582926328/jobs/6027754532#step:16:1194 |
How is this breaking the build? I suspect it's related to integration tests failing. The build was also broken earlier this week, so maybe you can update your branch and that will be fixed. If it's a quick fix - could you remove all exception handling in |
@@ -79,6 +81,12 @@ public DatabaseMetaData getMetaData() throws SQLException { | |||
final DatabaseMetaData metaData = connection.getMetaData(); | |||
return metaData; | |||
} catch (final SQLException e) { | |||
if (e instanceof SQLTransientException) { |
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.
The build error is linting. Make a separate catch statement
Task :airbyte-db:db-lib:pmdMain FAILED
/actions-runner/_work/airbyte/airbyte/airbyte-db/db-lib/src/main/java/io/airbyte/db/jdbc/DefaultJdbcDatabase.java:84: AvoidInstanceofChecksInCatchClause: An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type.
is there any risk to reverting this PR? I think it broke the source-postgres and mysql integration tests, e.g. https://github.com/airbytehq/airbyte/actions/runs/3597794993/jobs/6059935439#step:12:3214 (#19985 (comment)) specifically:
I verified locally that the test case succeeds after |
What
Fixes https://app.zenhub.com/workspaces/db--dw-source-connectors-6333360e0a41155061efbcbd/issues/airbytehq/alpha-beta-issues/331
How
Wrap SQLTransientException with ConfigErrorException
🚨 User Impact 🚨
none
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.