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

Check that JDBC Connections that are closed by the server do not repo… #1533

Merged
merged 1 commit into from Aug 30, 2019

Conversation

@timothyjward
Copy link
Contributor

commented Jul 24, 2019

Signed-off-by: Tim Ward timothyjward@apache.org

As part of investigating a bug report against Apache Aries Tx Control I had to look at a potential issue in the Postgres JDBC driver. I noticed that a comment in PR #218 described the situation that I thought might be broken, so I wrote a test for it. The driver turned out not to be the problem, but I thought you might still want the additional test

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Does mvn checkstyle:check pass ?

Changes to Existing Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?
Check that JDBC Connections that are closed by the server do not repo…
…rt as valid

Signed-off-by: Tim Ward <timothyjward@apache.org>
@davecramer

This comment has been minimized.

Copy link
Member

commented Jul 24, 2019

Cool!, thanks

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 24, 2019


TestUtil.execute("select pg_terminate_backend(" + pid + ")", con2);

assertFalse("The Second connection should now be invalid", con.isValid(0));

This comment has been minimized.

Copy link
@pzygielo

pzygielo Jul 24, 2019

I think that assertion messages could be refined, as isValid is still called on first connection as I read it here.

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 24, 2019

Member

Good catch!

This comment has been minimized.

Copy link
@davecramer

davecramer Aug 30, 2019

Member

Actually the code is correct. The first connection is the one that has been terminated.

This comment has been minimized.

Copy link
@pzygielo

pzygielo Aug 30, 2019

Actually the code is correct. The first connection is the one that has been terminated.

that assertion message could be refined

IMO it'd be misleading in case of test failure. Message is about The Second connection but the condition is not checked for con2, but for First Connection (as named in line 84).

The first connection is the one that has been terminated.

Right, so I do not get why The Second connection should now be invalid.

This comment has been minimized.

Copy link
@davecramer

davecramer Aug 30, 2019

Member

Ah, ok, I see what the issue is. The comment... I'll fix. Thanks

@codecov-io

This comment has been minimized.

Copy link

commented Jul 24, 2019

Codecov Report

Merging #1533 into master will increase coverage by 2.54%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #1533      +/-   ##
============================================
+ Coverage     66.39%   68.94%   +2.54%     
- Complexity     3787     3957     +170     
============================================
  Files           179      179              
  Lines         16475    16491      +16     
  Branches       2678     2678              
============================================
+ Hits          10939    11370     +431     
+ Misses         4296     3877     -419     
- Partials       1240     1244       +4
@davecramer

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

@timothyjward can you fix up the call to isValid ?

@davecramer davecramer merged commit 56399ef into pgjdbc:master Aug 30, 2019

3 checks passed

codecov/project 68.94% (+2.54%) compared to fcbbc3e
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.