Add cache for jdbc metadata calls#20359
Conversation
|
Can you share some results what improvements did you see? |
rschlussel
left a comment
There was a problem hiding this comment.
I think it would make sense to switch the control flow, so have CachingJdbcMetadata have JdbcMetadata as a delegate and implement all the methods that JdbcMetadata does, and call to the delegate for everything (sometimes a simple call, sometimes as part of loading into the cache).
a) this is how i think all of our other CachingXXX classes work
b) it means all of the actual implementation for getting the metadata is in one place, and the only thing that needs to know about what the cache supports is the CachingJdbcMetadata. The JdbcMetadata doesn't need to know which things it can get from the caching metadata (which only implements some things from the interface, but the whole connectormetada interface is available and has default implementaiton) and which things it needs to get itself
7c2d23b to
02face2
Compare
The issue is that we need CachingJdbcMetadata to be singleton so that the cache inside it will be shared across queries. But JdbcMetadata is not singleton and an instance is created for every trasaction/query. So switching the flow will not work. After offline discussion, we decided we will keep the flow same, but will CachingJdbcMetadata(renamed to JdbcMetadataCache) will just be a cache and NOT implement ConnectorMetadata. |
02face2 to
d9d8699
Compare
d9d8699 to
5e474b5
Compare



Created custom build with changes and tested by shadowing prod queries.