keith-turner commented on PR #3588:
URL: https://github.com/apache/accumulo/pull/3588#issuecomment-1631472537

   >  It would be nice if we reduced caching / re-used existing caches when 
possible.
   
   This caching is driven by avoiding recomputation of custom props in the SPI 
impl.  Specifically when a plugin is given a 
[ServiceEnvironment](https://github.com/apache/accumulo/blob/main/core/src/main/java/org/apache/accumulo/core/spi/common/ServiceEnvironment.java)
 the plugin could execute code like the following and if there was no caching 
the each call to getTableCustom() would recompute the tables set of custom 
props.
   
   ```java
   // some function in a plugin
   void MyObj createMyObj(ServiceEnvironment env, Table tid){
       var p1 =  env.getConfiguration(tid).getTableCustom().get("prop1");
       var p2 =  env.getConfiguration(tid).getTableCustom().get("prop2");
       var p3 =  env.getConfiguration(tid).getTableCustom().get("prop3");
       var p4 =  env.getConfiguration(tid).getTableCustom().get("prop4");
       return new MyObj(p1,p2,p3,p4);
   }
   ```
   
   > Use ServerConfigurationFactory as is?
   
   The SPI return a custom interface, so will need some sort of wrapper unless 
we make AccumuloConfiguration implement the SPI [config 
interface](https://github.com/apache/accumulo/blob/d4846d407e5b28482394e2c0baa16932ae35e086/core/src/main/java/org/apache/accumulo/core/spi/common/ServiceEnvironment.java#L40)
 .
   
   > Use caffeine in ServerConfigurationFactory and use that instead of caching 
here?
   
   Does ServerConfigurationFactory continue to cache deleted tables?  I took a 
quick look and it appears it may, but not completely sure. If it does then that 
probably should addressed, even if its independent from this.  
   
   If we went the route of making AccumuloConfiguration implement the SPI 
config interface, then we could just return whatever ServerConfigurationFactory 
returns w/o wrapping it, so this may be a viable way forward.
   
   > Use the caching here and eliminate ServerConfigurationFactory?
   
   This is SPI impl code meant for plugins, a lot of internal code does not use 
this SPI and accesses config directly using internal non-SPI/API method calls.  
I
   


-- 
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