You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If one thread starts populating the cache, and another thread requests a property while the cache is still populating, the second thread will see the cache is non-empty and think the cache has been fully populated when it might just have started populating. This will result in null properties values being retrieved and NPE errors.
Component(s)
FlightRPC, Java
The text was updated successfully, but these errors were encountered:
### Rationale for this change
The cache of SqlInfo properties that ArrowDatabaseMetaData maintains isn't populated in a thread-safe way. This can cause JDBC applications trying to retrieve several properties from DatabaseMetaData to encounter missing properties when they shouldn't.
### What changes are included in this PR?
- Changed the checking for the cache being populated to be based on an AtomicBoolean marking that the cache is fully populated, rather than just checking if the cache is empty.
- Avoid having multiple threads call getSqlInfo() if they see that the cache is empty concurrently.
### Are these changes tested?
Verified existing unit tests.
### Are there any user-facing changes?
No.
* Closes: #38737
Authored-by: James Duong <james.duong@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
### Rationale for this change
The cache of SqlInfo properties that ArrowDatabaseMetaData maintains isn't populated in a thread-safe way. This can cause JDBC applications trying to retrieve several properties from DatabaseMetaData to encounter missing properties when they shouldn't.
### What changes are included in this PR?
- Changed the checking for the cache being populated to be based on an AtomicBoolean marking that the cache is fully populated, rather than just checking if the cache is empty.
- Avoid having multiple threads call getSqlInfo() if they see that the cache is empty concurrently.
### Are these changes tested?
Verified existing unit tests.
### Are there any user-facing changes?
No.
* Closes: apache#38737
Authored-by: James Duong <james.duong@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Describe the bug, including details regarding any error messages, version, and platform.
The cache of SqlInfo properties in the JDBC driver isn't thread-safe.
arrow/java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java
Line 732 in 563078f
If one thread starts populating the cache, and another thread requests a property while the cache is still populating, the second thread will see the cache is non-empty and think the cache has been fully populated when it might just have started populating. This will result in null properties values being retrieved and NPE errors.
Component(s)
FlightRPC, Java
The text was updated successfully, but these errors were encountered: