rpbouman / xmondrian

A java web archive (.WAR) to easily deploy and run the mondrian OLAP engine. Includes example schemas and datasets, client libraries, and web-frontends.
Apache License 2.0
21 stars 6 forks source link

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

Open hustszh opened 8 years ago

hustszh commented 8 years ago

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.

rpbouman commented 8 years ago

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!

dmitry-sloutskov commented 7 years ago

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.

fetanchaud commented 6 years ago

IMHO you will find an answer there

https://mondrian.pentaho.com/documentation/schema.php#Dynamic_datasource_xmla_servlet

rpbouman commented 6 years ago

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