fix(bigquery-jdbc): add proper version to BigQueryDriver#13294
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the JDBC driver version loading and parsing logic by moving it from BigQueryDatabaseMetaData into a new utility class, BigQueryJdbcVersionUtility, which is then used by both BigQueryDatabaseMetaData and BigQueryDriver. A critical review comment points out a concurrency race condition in the lazy initialization of the utility class, which could lead to threads reading uninitialized major or minor versions. Additionally, the comment highlights a bug where single-part version strings would prevent the major version from being set. The reviewer suggests resolving these issues by using a thread-safe static initializer block to load the properties.
|
Can we also update the README in this PR for the maven link |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the JDBC driver version loading and parsing logic by extracting it from BigQueryDatabaseMetaData into a new utility class, BigQueryJdbcVersionUtility. Both BigQueryDatabaseMetaData and BigQueryDriver are updated to delegate version retrieval to this utility. Feedback on the new utility class points out potential thread contention from the synchronized ensureLoaded() method, risk of runtime exceptions, and a race condition during initialization. A more robust implementation using explicit locks and safe default fallbacks is suggested.
This method was refactored into BigQueryJdbcVersionUtility but was incorrectly kept during a merge conflict resolution, causing compilation errors due to missing fields. TAG=agy CONV=93eab217-ad90-45ea-8b0b-dbfaea52887d
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors how the JDBC driver version is loaded and managed by introducing a new utility class, BigQueryJdbcVersionUtility, which centralizes the loading of version properties from dependencies.properties. This replaces the duplicated loading logic in BigQueryDatabaseMetaData and hardcoded version constants in BigQueryDriver. The review feedback highlights potential performance issues due to synchronization overhead in ensureLoaded(), a possible regression where getDriverVersion() could return null instead of a fallback default version, and redundant concurrency primitives. A static initializer block is suggested to load the properties once during class loading, resolving these issues.
Update
BigQueryDrivergetMinorVersion/getMajorVersion to return proper value