xmondrian icon indicating copy to clipboard operation
xmondrian copied to clipboard

How to update schema and flush data cache without restarting xmondrian server?

Open hustszh opened this issue 8 years ago • 4 comments

Hi Roland,

Thanks for xmondrian, which make me easy to use mondrian to build OLAP engine.

I have one question about xmondrian cache. Once I modify the schema, or update the data in dw, I have to restart xmondrian server. Otherwise, I will get the old one. Would you have any suggestion to flush xmondrian cache? Should I write some codes to flush cache during xmondrian server is running? How to do it?

Thanks in advance.

hustszh avatar Apr 07 '16 12:04 hustszh

Hi @hustszh! SOrry for the late reply - I should've replied earlier.

I have one question about xmondrian cache. Once I modify the schema, or update the data in dw, I have to restart xmondrian server. Otherwise, I will get the old one. Would you have any suggestion to flush xmondrian cache?

Currently, I have nothing in xmondrian that does this for you. But you're very right - it should certainly be possible to do this in a graceful way.

To tell you the truth, I currently do not know how to do this. My hunch is there must be already something that allows you to do this, but I did not configure it in the web.xml.

Should I write some codes to flush cache during xmondrian server is running? How to do it?

What would help is if you could look at the Mondrian documentation and see if there is a servlet already that could be used for this. Or maybe take a look at how Pentaho does it. If you could report your findings back here, then we can think about how to put this into xmondrian.

Thanks!

rpbouman avatar Apr 14 '16 10:04 rpbouman

Greetings, This can be done in the Pentaho BI control panel, by clicking tools->refresh->mondrian cache, imho... this equivalent to

#!bin/bash
user=XXX
pass=XXX
host=localhost
schema=Reporting%20schemas

wget --no-check-certificate http://${host}:2310/pentaho/content/analyzer/ajax/clearCache?catalog=${schema}\&userid=${user}\&password=${pass}

Documentation http://mondrian.pentaho.com/api/mondrian/rolap/CacheControlImpl.html I think, it should be help http://wiki.bizcubed.com.au/xwiki/bin/view/Main/Search?text=Flush+Mondrian+Cache

Roland, it would be very good to have this functionality in xmondrian.

I think, something like this

<%
java.util.Iterator<mondrian.rolap.RolapSchema> schemaIterator = mondrian.rolap.RolapSchema.getRolapSchemas();
while (schemaIterator.hasNext()) {
   mondrian.rolap.RolapSchema schema = schemaIterator.next();
   mondrian.olap.CacheControl cacheControl = schema.getInternalConnection().getCacheControl(null);

   for (mondrian.olap.Cube cube: schema.getCubes()) {
     cacheControl.flush (cacheControl.createMeasuresRegion(cube));
   }
}
String redirectURL = request.getHeader("Referer");
response.sendRedirect(redirectURL);
%>

Unfortunately, I'm not the best java-programmer.

dmitry-sloutskov avatar Jan 17 '17 21:01 dmitry-sloutskov

Thanks all. I will gladly accept a pull request for this.

rpbouman avatar Oct 13 '17 10:10 rpbouman