-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Postgres Source: use native Postgres timeout if it's not set by the user #19291
Postgres Source: use native Postgres timeout if it's not set by the user #19291
Conversation
/test connector=connectors/source-postgres-strict-encrypt
Build PassedTest summary info:
|
/test connector=connectors/source-postgres
Build FailedTest summary info:
|
airbyte-db/db-lib/src/main/java/io/airbyte/db/factory/DataSourceFactory.java
Outdated
Show resolved
Hide resolved
: CONNECT_TIMEOUT_DEFAULT; | ||
if (connectionTimeout.getSeconds() == 0) { | ||
return connectionTimeout.toMillis(); | ||
private static long getConnectionTimeoutMs(final Map<String, String> connectionProperties, String driverClassName) { |
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.
Can you add a test for this new functionality in DataSourceFactoryTest.java
?
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.
It appears these changes were caught within the build failures
To add onto what Akash said, since this is a postgres specific feature I would add a test primarily for postgres and keep a generic one to account for non-postgres behavior.
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.
It appears these changes were caught within the build failures
To add onto what Akash said, since this is a postgres specific feature I would add a test primarily for postgres and keep a generic one to account for non-postgres behavior.
@akashkulk @ryankfu added tests for Postgres and MySQL to see the difference
} else { | ||
return (connectionTimeout.compareTo(CONNECT_TIMEOUT_DEFAULT) > 0 ? connectionTimeout : CONNECT_TIMEOUT_DEFAULT).toMillis(); | ||
return CONNECT_TIMEOUT_DEFAULT.toMillis(); |
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.
If I'm understanding this correctly this changes the default behavior for all other connectors where the user can pass in a connection_timeout
property. In the javadoc description, we allow for users to set the connection_timeout
to 0 which means timeout duration is infinity
This seems to change that behavior for all connectors that isn't postgres. Also as a note the reason why default of 60 seconds was chosen in the past was due to integration tests failing on the default of 30 seconds (also in the javadoc description). If that has changed, then updating the javadoc comment to match makes sense
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.
If I'm understanding this correctly this changes the default behavior for all other connectors where the user can pass in a
connection_timeout
property. In the javadoc description, we allow for users to set theconnection_timeout
to 0 which means timeout duration is infinityThis seems to change that behavior for all connectors that isn't postgres. Also as a note the reason why default of 60 seconds was chosen in the past was due to integration tests failing on the default of 30 seconds (also in the javadoc description). If that has changed, then updating the javadoc comment to match makes sense
@ryankfu good point
changed logic on
if (driverClassName.equals(DatabaseDriver.POSTGRESQL.getDriverClassName())) { new behaviour ; } else { old behaviour ; }
…meouts' into vmaltsev/3063-postgres-source-timeouts
/test connector=connectors/source-postgres-strict-encrypt
Build PassedTest summary info:
|
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.
Changes look in general to me - could you run source Postgres acceptance tests once again and make sure that they pass before merging
|
||
if (driverClassName.equals(DatabaseDriver.POSTGRESQL.getDriverClassName())) { | ||
final String pgPropertyConnectTimeout = CONNECT_TIMEOUT.getName(); | ||
// If the PGProperty.CONNECT_TIMEOUT was set by the user, then take its value, if not take the |
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.
Suggestion: would remove the comment on #L206 and move this comment to above the if
block for the Postgres logic. Otherwise changes look good
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.
Overall looks good, there's some pmd fixes within the build that need to be addressed but once that's fixed should be good to merge
/test connector=connectors/source-postgres
Build PassedTest summary info:
|
@akashkulk all tests passed #19291 (comment) |
Affected Connector ReportNOTE
|
Connector | Version | Changelog | Publish |
---|---|---|---|
source-alloydb |
1.0.17 |
✅ | ✅ |
source-alloydb-strict-encrypt |
1.0.17 |
✅ | ⚠ (not in seed) |
source-postgres-strict-encrypt |
1.0.24 |
✅ | ⚠ (not in seed) |
- See "Actionable Items" below for how to resolve warnings and errors.
✅ Destinations (0)
Connector | Version | Changelog | Publish |
---|
- See "Actionable Items" below for how to resolve warnings and errors.
Actionable Items
(click to expand)
Category | Status | Actionable Item |
---|---|---|
Version | ❌ mismatch |
The version of the connector is different from its normal variant. Please bump the version of the connector. |
⚠ doc not found |
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug. |
|
Changelog | ⚠ doc not found |
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug. |
❌ changelog missing |
There is no chnagelog for the current version of the connector. If you are the author of the current version, please add a changelog. | |
Publish | ⚠ not in seed |
The connector is not in the seed file (e.g. source_definitions.yaml ), so its publication status cannot be checked. This can be normal (e.g. some connectors are cloud-specific, and only listed in the cloud seed file). Please double-check to make sure that it is not a bug. |
❌ diff seed version |
The connector exists in the seed file, but the latest version is not listed there. This usually means that the latest version is not published. Please use the /publish command to publish the latest version. |
/publish connector=connectors/source-postgres-strict-encrypt
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-postgres
if you have connectors that successfully published but failed definition generation, follow step 4 here |
…ser (#19291) * Postgres Source: use native Postgres timeout if it's not set by the user * refactoring * updated connection timeout logic and added tests for different datasources creation * fixed pmd * refactoring * bump version * auto-bump connector version Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
What
Fix for https://app.zenhub.com/workspaces/db--dw-source-connectors-6333360e0a41155061efbcbd/issues/airbytehq/airbyte-cloud/3063
How
use native Postgres connection timeout if it's not set by the user
Before
After
🚨 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.