Last hurrah for xactions? And invaluable Mondrian BA Server links

So, for a long time now people have been decrying the death of xactions. In fact – Pedro put the final nail in the coffin with startup actions via PDI.

But! There’s one final bastion of this technology. Mondrian cache.

Now; Before we go too far – yes I know you can do this much better using CDC – Yes, CDC does not REQUIRE a distributed cache, and it does provide an API for clearing cubes as well as a UI. BUT – it’s not uncommon to be in a situation where installing a new plugin is simply not possible.

So, how does it work. Well the thing about xactions is that they are very powerful, and the way they work in the BA platform is actually very clever.  Their downfall has little to do with their functionality, and more to do with their usability and distinct lack of documentation!    Anyway downfall they have..

So; How to do it? Well there’s documentation here, but it’s not particularly useful:

http://mondrian.pentaho.com/documentation/cache_control.php#A_simple_example

Better is an example here:

https://gist.github.com/marksteele/7084974

Now; That example does a full on clear of an individual region in the cache, what if you just want to clear an individual cubes cache?  Do that like so:

 var conn = shared_olap_connection.shareConnection().getConnection();
 var cacheControl = conn.getCacheControl(null);
 cacheControl.flushSchemaCache();

How to find more about the API? Simple! Check the code here.

https://github.com/pentaho/mondrian/blob/3.11.1.0/src/main/mondrian/rolap/CacheControlImpl.java

But; What about the mondrian schema, where does it live in the BA platform?  Well there is some really old doco on that here:

http://wiki.pentaho.com/display/ServerDoc2x/Mondrian+datasource+storage+in+JCR

But in reality the most useful links you can have are these:

List data sources:

http://localhost:8080/pentaho/plugin/data-access/api/datasource/analysis/catalog

(Obviously replace host and port with your details!)

Download a schema (Assuming you have permissions of course)

http://localhost:8080/pentaho/plugin/data-access/api/datasource/analysis/catalog/SteelWheels

List JDBC connections:

http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection

And naturally see the details of one of those connections:

http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection/SampleData

It’s also possible to parameterise your xaction so the datasource and schema are parameters, therefore you can call it from the ETL.

The only minor caveat of this approach is you may have a user who has permission to clear the cache – and you use this user when you clear from the ETL. But now; This user will also need Execute permission because they need to execute the xaction which clears the cache.  You can still lock down what that user can see however.

Finally, if you want to see what the MDX Connection component in an xaction does, you can read the code here:

https://github.com/jayhenry/walrus_bi_platform/blob/6d1e0ff3eb575919089eb5e47ef1f7e20ea79da1/extensions/src/org/pentaho/platform/plugin/action/mdx/MDXBaseComponent.java

I guess if you wanted to redeem yourself and do this in a PDI job instead you’d have to do something similar.  (Actually you can define Mondrian datasources in PDI but I couldnt see a way of actually getting the connection in code, in order to flush it.)

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s