jnturton commented on PR #2698:
URL: https://github.com/apache/calcite/pull/2698#issuecomment-1092587512

   @asereda-gs I agree that the right design is for the application to request 
the freeing of resources.  An hour or so ago I started work on making Schema 
implement AutoCloseable with a default implementation of `close()` that is a 
no-op to preserve backwards compat, but then I encountered 
CassandraSchemaFactory which keeps a cache of shared CqlSessions, very much 
like the current version of this PR except that the CqlSession cache entries 
never expire and are no doubt also a resource leak although a bounded one, 
unlike Elasticsearch without this PR.  So if simply set the cache expiry in 
this PR to "never" then I've ended up with exactly what Calcite does for 
Cassandra and I assume that would be mergeable?
   
   While that would stop the worst bleeding, and is perhaps worth doing for 
stop-gap, it would still be pretty horrible.  I think Calcite might have to 
make a choice now.  Either 
   
   - it abstains from connection management entirely in adapters, which breaks 
its public APIs since then applications must start to pass connections in or 
   - it starts to use connections in single-use way, freeing immediately and 
taking a performance hit or
   - it continues with its connection caching and to starts to run a 
housekeeping thread to clean up its caches.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to