Skip to content

cache JDBC dbInfo after connection constructor throws exception#322

Merged
realark merged 3 commits into
masterfrom
gary/hikari-handling
May 15, 2018
Merged

cache JDBC dbInfo after connection constructor throws exception#322
realark merged 3 commits into
masterfrom
gary/hikari-handling

Conversation

@gary-huang
Copy link
Copy Markdown
Contributor

@gary-huang gary-huang commented May 11, 2018

Fixed the "unknown" database issue caused by JDBC Connection constructor throwing exception. Tracer will now attempt to record database info on JDBC statement creation or preparation because connection would've been properly established.

@gary-huang gary-huang added the tag: do not merge Do not merge changes label May 11, 2018
@realark realark changed the title WIP cache JDBC dbInfo after connection constructor throws exception May 11, 2018
@gary-huang gary-huang added type: bug Bug report and fix and removed tag: do not merge Do not merge changes labels May 12, 2018
@gary-huang gary-huang requested a review from realark May 12, 2018 18:27
Copy link
Copy Markdown
Contributor

@tylerbenson tylerbenson left a comment

Choose a reason for hiding this comment

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

Good solution to the problem. It's too bad we couldn't add the exception handling to the constructor instrumentation. You're going to need to rebase off master and resolve the conflicts.

I suggested a few minor changes while you're working on this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here's something you could consider using if you want to extend the testing to mysql/postgres: https://www.testcontainers.org/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment @tylerbenson, @realark and I discussed it and thought that it would be better to include test containers when there are more test cases, since we do need Docker to perform unit tests using test containers, and that introduces another development dependency. Is this OK?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should consider replacing our synchronized weak maps with WeakConcurrentMap. I'm guessing they are much more performant than our current solution.

@gary-huang gary-huang force-pushed the gary/hikari-handling branch 2 times, most recently from 865e97f to 2a0260d Compare May 14, 2018 18:46
Gary Huang added 2 commits May 15, 2018 16:18
Client will now report correct database if JDBC connection is recovered from exception.
Refactored JDBCMaps's getDBInfo utlity function because JDBCMaps is in the bootstrap classloader, and the use of java.sql.* packages in getDBInfo is failing because java.sql.* packages are part of the platform classloader in java 9.
@gary-huang gary-huang force-pushed the gary/hikari-handling branch from 17f619c to a7115a5 Compare May 15, 2018 20:21
@gary-huang gary-huang force-pushed the gary/hikari-handling branch from a7115a5 to 71396ae Compare May 15, 2018 20:38
@realark realark merged commit f74710a into master May 15, 2018
@realark realark deleted the gary/hikari-handling branch May 15, 2018 20:58
@tylerbenson tylerbenson added this to the 0.9.0 milestone May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants