googleapis / java-spanner Public
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
fix: use credentials key in pool #430
Conversation
Codecov Report
@@ Coverage Diff @@
## master #430 +/- ##
============================================
+ Coverage 82.16% 82.23% +0.06%
- Complexity 2455 2465 +10
============================================
Files 136 138 +2
Lines 13589 13620 +31
Branches 1307 1309 +2
============================================
+ Hits 11166 11200 +34
+ Misses 1895 1892 -3
Partials 528 528
Continue to review full report at Codecov.
|
@skuruppu @thiagotnunes Friendly ping for this PR. It fixes a bug in the JDBC driver that can cause a |
hey @olavloite, I think I am missing how does assigning the |
Thanks for the quick response @thiagotnunes Assigning the You have a number of options for setting the credentials when creating a
Option 2 and 3 internally both set the
Setting a Setting a What also might be worth noting:
|
@olavloite thanks for the detailed explanation. LGTM. |
@thiagotnunes Apparently you have not (yet?) been added as a member of https://github.com/orgs/googleapis/teams/yoshi-java/members, which means that merging this PR is still blocked until a member of that team approves the PR. Maybe one of the maintainers could add you as a member to the team. |
@olavloite sorry about that, I have requested membership |
The
SpannerPool
uses among other fields thecredentials
of aConnectionOptions
to determine whether an existingSpanner
instance can be reused or not. Certain credentials instances, most notablyUserCredentials
, are mutable and the result ofequals(Object)
andhashCode()
of an instance may change during its lifetime. This could cause theSpannerPool
to inadvertently close aSpanner
instance that is still in use.This change replaces the usage of the actual credentials as part of the pool key with a key that is based on the method that was used to determine the credentials. This ensures that if two connections request a
Spanner
instance using the samecredentialsUrl
, that they will be considered equal. The same also applies to two connections that both do not set any specific credentials options and use the application default credentials.Fixes googleapis/java-spanner-jdbc#206 and GoogleCloudPlatform/google-cloud-spanner-hibernate#202