[Mondrian] Mondrian's cache key is tied to the actual datasource. Is this right?

Pedro Alves pmgalves at gmail.com
Tue Oct 6 13:20:38 EDT 2009



While debugging http://jira.pentaho.com/browse/PRD-2067 , that totally 
stopped us from writing mdx reports in the new report designer, we 
traced the issue down to the way mondrian caches the connections.


 From RolapSchema.java:

         /**
          * Creates a key with which to identify a schema in the cache.
          */
         private static String makeKey(
             final String catalogUrl,
             final DataSource dataSource)
         {
             final StringBuilder buf = new StringBuilder(100);

             appendIfNotNull(buf, catalogUrl);
             buf.append('.');
             buf.append("external#");
             buf.append(System.identityHashCode(dataSource));

             return buf.toString();
         }


Unless we pass the same dataSource object, we'll always get a different 
key; Thomas solved this issue by caching the datasource object on the 
jfreereport-ext-mondrian code, ensuring the identityHashCode is the same



But....


Is this the best approach? For me, this seems the reason that, for 
instance, olap4j is unable to share cache with pentaho inside mondrian. 
If this was something that was cached based on the connection string 
instead of the dataSource object maybe we can get close to what we all 
want - a olap4j connector in mondrian


-pedro








More information about the Mondrian mailing list