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

Add retry to test connections #23757

Conversation

johnjcasey
Copy link
Contributor

@johnjcasey johnjcasey commented Oct 20, 2022

fixes #22299
Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

…it parallel calls to datasource.getConnection()
@johnjcasey
Copy link
Contributor Author

run beam_performanceTests_jdbc

@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

1 similar comment
@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

@johnjcasey johnjcasey changed the title Move connection setup logic for JDBCIO WriteFn to @startBundle to lim… Move connection setup logic for JDBCIO WriteFn to @startBundle to limit parallel calls to datasource.getConnection() Oct 21, 2022
@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

1 similar comment
@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

Put a retry into the DatabaseTestHelper
@github-actions github-actions bot removed the jdbc label Oct 24, 2022
@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

3 similar comments
@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

@johnjcasey
Copy link
Contributor Author

Run Java JdbcIO Performance Test

@johnjcasey
Copy link
Contributor Author

r: @Abacn

@johnjcasey johnjcasey marked this pull request as ready for review October 26, 2022 14:54
@johnjcasey johnjcasey changed the title Move connection setup logic for JDBCIO WriteFn to @startBundle to limit parallel calls to datasource.getConnection() Add retry to test connections Oct 26, 2022
@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @robertwb for label java.
R: @chamikaramj for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@Abacn
Copy link
Contributor

Abacn commented Oct 26, 2022

I see,the cause is that the test did not retry create table. Can we utilize the backoff pattern to here?

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #23757 (840d66a) into master (1179fdc) will decrease coverage by 0.05%.
The diff coverage is 32.97%.

❗ Current head 840d66a differs from pull request most recent head 802601d. Consider uploading reports for the commit 802601d to get more accurate results

@@            Coverage Diff             @@
##           master   #23757      +/-   ##
==========================================
- Coverage   73.24%   73.19%   -0.06%     
==========================================
  Files         719      720       +1     
  Lines       95955    96069     +114     
==========================================
+ Hits        70279    70313      +34     
- Misses      24364    24444      +80     
  Partials     1312     1312              
Flag Coverage Δ
go 50.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...pkg/beam/core/runtime/xlangx/expansionx/process.go 61.40% <ø> (ø)
...dks/python/apache_beam/options/pipeline_options.py 94.45% <ø> (+0.08%) ⬆️
...on/apache_beam/runners/dataflow/dataflow_runner.py 81.65% <0.00%> (+0.76%) ⬆️
...on/apache_beam/runners/portability/spark_runner.py 67.34% <0.00%> (ø)
...m/runners/portability/spark_uber_jar_job_server.py 84.32% <0.00%> (ø)
...eam/testing/benchmarks/nexmark/nexmark_launcher.py 0.00% <0.00%> (ø)
...pache_beam/typehints/pytorch_type_compatibility.py 0.00% <0.00%> (ø)
...python/apache_beam/io/gcp/bigquery_schema_tools.py 79.24% <71.42%> (-4.85%) ⬇️
sdks/python/apache_beam/io/gcp/gcsio.py 92.12% <85.71%> (-0.14%) ⬇️
sdks/python/apache_beam/ml/gcp/visionml.py 92.59% <90.00%> (ø)
... and 32 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Abacn
Copy link
Contributor

Abacn commented Oct 27, 2022

Run Java JdbcIO Performance Test

@Abacn
Copy link
Contributor

Abacn commented Oct 27, 2022

Seems like org.postgresql.util.PSQLException is not caught by the catch (SQLException) https://ci-beam.apache.org/job/beam_PerformanceTests_JDBC/7101/console however PSQLException extends SQLException. Not sure why

@Abacn
Copy link
Contributor

Abacn commented Oct 28, 2022

The try-with-resource statement does not catch the exception thrown in the parenthesis, I think. Replace to the simple try { getConnection } would work.

@johnjcasey
Copy link
Contributor Author

try (Statement statement = connection.createStatement()) {
statement.execute(String.format("create table %s (%s)", tableName, fieldsList));
return;
}
} catch (SQLException e) {
exception = e;
} finally {
if (connection!=null){
connection.close();
Copy link
Contributor

@Abacn Abacn Oct 28, 2022

Choose a reason for hiding this comment

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

Probably it is closing the connection caused issue. dataSource owns a connection pool and manage the connections. Closing it pre-maturely may have caused racing conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like it is happening in .getConnection based on the stacktrace

@johnjcasey johnjcasey self-assigned this Oct 28, 2022
@johnjcasey
Copy link
Contributor Author

Run Java Precommit

@johnjcasey
Copy link
Contributor Author

Run Java PreCommit

@johnjcasey
Copy link
Contributor Author

@Abacn can you take another look at this?

Copy link
Contributor

@Abacn Abacn left a comment

Choose a reason for hiding this comment

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

LGTM

@johnjcasey johnjcasey merged commit 67e2008 into apache:master Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: JDBCIO Write freeze at getConnection() in WriteFn
2 participants