[Mondrian] DataSouceChangeListener questions regarding use of CacheControl API

Jonathan Rand rand.jc at gmail.com
Tue Aug 17 14:27:20 EDT 2010


In our data warehouse, hierarchies can change in two distinct ways:

   1. Hierarchy members can be added or deleted.
   2. Fact values associated with an existing hierarchy member can change.

The DataSouceChangeListener.isHierarchyChanged() allows Mondrian to
effectively handle addition or deletion of hierarchy members, but Mondrian
does not (that I am aware of) flush cell regions associated with a changed
hierarchy.  Our DataSourceChangeListener now uses the CacheControl API to
clear affected cell regions as a side-effect of the isHierarchyChanged()
call when a hierarchy has changed.

In outline, we flush cell regions associated with a particular hierarchy as
follows:

   1. Iterate through hierarchy.getRolapSchema().getCubes() to populate a
   map<Cube, RolapCubeMember> with (cube, hierarchy.getAllMember()), ignoring
   virtual cubes and cubes that don't support the hierarchy.
   2. Iterate over the map and call
   cacheControl.flush(cacheControl.createCrossjoinRegion(cacheControl.createMemberRegion(allMember,
   true), cacheControl.createMeasuresRegion(cube))).

Basing the memberRegion on the allMember is probably not correct in the
general case but it works for the volatile dimensions in our warehouse. Note
that the createMemberRegion method's Member parameter must actually be an
instance of RolapCubeMember; if it isn't, the subsequent call to the
flush(CellRegion) method will throw an exception. We make sure we've got a
RolapCubeMember by iterating through cube.getHierarchies() to find the
hierarchy we're interested in and returning its allMember.

This appears to be working well, but an "is..." method with a fairly major
side-effect has a bit of a code smell.

Questions:
Is there a better place than isHierarchyChanged to hook in the cell region
flush?
Have I overlooked something significant in my use of the CacheControl API?

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20100817/2fa444df/attachment.html 


More information about the Mondrian mailing list