<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I was not able to recreate the cache problem with the usual file
system access or my JasperServer repository VFS implementation.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal>file.getName().getURI().equals(url) could be false for no
good reason. I played with the test suite and got:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> [java] Re-resolving file: returned VFS url
was: file:///C:/Users/swood/Documents/pf/sgwood_perforce.eigenbase.org_1666_1/open/mondrian/demo/FoodMart.xml,
not given url: C:/Users/swood/Documents/pf/sgwood_perforce.eigenbase.org_1666_1/open/mondrian/demo/FoodMart.xml<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Doing this all the time will be overhead, but doesn’t
break things. <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Sherman<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
mondrian-bounces@pentaho.org [mailto:mondrian-bounces@pentaho.org] <b>On Behalf
Of </b>Matt Campbell<br>
<b>Sent:</b> Thursday, February 19, 2009 6:33 AM<br>
<b>To:</b> Mondrian developer mailing list<br>
<b>Subject:</b> Re: [Mondrian] RolapSchema #122<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>I took silence for assent and
have checked in 12382, which clears the VFS cache for the requested file when
this inconsistency is encountered. I also did some minor cleanup to
eliminate some of the duplicate code. Let me know if that change looks
reasonable to you.<o:p></o:p></p>
<div>
<p class=MsoNormal>On Wed, Feb 18, 2009 at 10:14 AM, Matt Campbell <<a
href="mailto:mkambol@gmail.com">mkambol@gmail.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>It does certainly seem to be a vfs bug. As a
workaround, I added the following block right after the .resolveFile().
This validates that the url passed in matches the url of the file
retrieved, and if not clears the file from the cache and reloads.<o:p></o:p></p>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<div>
<p class=MsoNormal> if ( !file.getName().getURI().equals(url)) {<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal>
fsManager.getFilesCache().removeFile(file.getFileSystem(), file.getName());<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal> file =
fsManager.resolveFile(userDir, url);<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal> }<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>Any objection to me checking in this change? If we
find a better workaround to the vfs bug we can always drop this check.<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p class=MsoNormal>On Tue, Feb 17, 2009 at 6:20 PM, Sherman Wood <<a
href="mailto:swood@jaspersoft.com" target="_blank">swood@jaspersoft.com</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'>I was just going to refactor </span>RolapSchema.load()
to use Util.readVirtualFile() because of that identical code.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>The default configuration of
Apache VFS we are using should be getting new content each time a URI is
"resolved" (<a
href="http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/CacheStrategy.html#ON_RESOLVE"
target="_blank">http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/CacheStrategy.html#ON_RESOLVE</a>
), which happens each time .readVirtualFile is called.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>I'll do some further tests,
taking into account Will's comments about possible VFS HTTP bugs.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Sherman</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> <a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>
[mailto:<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>]
<b>On Behalf Of </b>Matt Campbell<br>
<b>Sent:</b> Wednesday, February 18, 2009 6:14 AM<o:p></o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt'><br>
<b>To:</b> Mondrian developer mailing list<o:p></o:p></span></p>
</div>
<p class=MsoNormal><b><span style='font-size:10.0pt'>Subject:</span></b><span
style='font-size:10.0pt'> Re: [Mondrian] RolapSchema #122</span><o:p></o:p></p>
</div>
<div>
<div>
<p> <o:p></o:p></p>
<p style='margin-bottom:12.0pt'>I just noticed that RolapSchema.load() uses
identical code to Util.readVirtualFile(). It seems likely that it would
have the same problem with cached files.<o:p></o:p></p>
<div>
<p>On Tue, Feb 17, 2009 at 12:18 PM, Matt Campbell <<a
href="mailto:mkambol@gmail.com" target="_blank">mkambol@gmail.com</a>>
wrote:<o:p></o:p></p>
<p>It looks like the parameters in the URL are ignored on the second call to
readVirtualFile(). The unit test below shows the issue. The URI of
the second file returned by .readVirtualFile ends up being identical to uri1.<o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Could you revert your change until this is fixed?<o:p></o:p></p>
</div>
<div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<div>
<p> public void testReadVirtualFile() {<o:p></o:p></p>
</div>
<div>
<p> try {<o:p></o:p></p>
</div>
<div>
<p> String uri1 = "<a
href="http://localhost:8088/?URI1" target="_blank">http://localhost:8088/?URI1</a>";<o:p></o:p></p>
</div>
<div>
<p> String uri2 = "<a
href="http://localhost:8088/?URI2" target="_blank">http://localhost:8088/?URI2</a>";<o:p></o:p></p>
</div>
<div>
<p> FileObject file1 =
Util.readVirtualFile(uri1);<o:p></o:p></p>
</div>
<div>
<p> FileObject file2 = Util.readVirtualFile(uri2);<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>
assertEquals(file1.getName().getURI(), uri1);<o:p></o:p></p>
</div>
<div>
<p>
assertEquals(file2.getName().getURI(), uri2);<o:p></o:p></p>
</div>
<div>
<p> } catch(Exception e) {<o:p></o:p></p>
</div>
<div>
<p> fail("Threw an
exception while reading virtual file");<o:p></o:p></p>
</div>
<div>
<p> }<o:p></o:p></p>
</div>
<div>
<p> }<o:p></o:p></p>
</div>
<p> <o:p></o:p></p>
<div>
<div>
<div>
<p>On Mon, Feb 16, 2009 at 4:36 PM, Sherman Wood <<a
href="mailto:swood@jaspersoft.com" target="_blank">swood@jaspersoft.com</a>>
wrote:<o:p></o:p></p>
</div>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>
<div>
<div>
<div>
<div>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Yep – that looks weird
and bad. I'll look into it too.</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'>Sherman</span><o:p></o:p></p>
<p><span style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> <a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>
[mailto:<a href="mailto:mondrian-bounces@pentaho.org" target="_blank">mondrian-bounces@pentaho.org</a>]
<b>On Behalf Of </b>Matt Campbell<br>
<b>Sent:</b> Tuesday, February 17, 2009 4:01 AM<br>
<b>To:</b> Mondrian developer mailing list<br>
<b>Subject:</b> [Mondrian] RolapSchema #122</span><o:p></o:p></p>
</div>
<div>
<div>
<p> <o:p></o:p></p>
<div>
<p>Sherman,<o:p></o:p></p>
</div>
<p>It looks like a bug was introduced in the code which retrieves schemas from
the Pool. In Pool.get() there is code which first loads the schema from a
given URL, then computes its checksum. I've noticed that the new
Util.readVirtualFile() method will sometimes return the content of the
*previous* schema loaded. <o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>In the current code there is actually an extra read of the catalog--see the
bolded section below. It's leftover from the previous approach for
loading the schema. This should probably be cleaned up, but it helped me
find the issue. When I've traced through this code I've seen that the
catalogStr returned by the old code (Util.readURL) is sometimes different from
the schema returned by Util.readVirtualFile.<o:p></o:p></p>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>I'm going to try to come up with a clean reproducible test case tomorrow,
but I thought I'd pass on what I've seen in case you see something obviously
wrong.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<div>
<p> try {<o:p></o:p></p>
</div>
<div>
<p>
if (catalogStr == null) {<o:p></o:p></p>
</div>
<div>
<p>
<b> catalogStr = Util.readURL(catalogUrl);</b><o:p></o:p></p>
</div>
<div>
<p>
// Use VFS to get the content<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>
FileObject file = Util.readVirtualFile(catalogUrl);<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>
StringBuilder buf = new StringBuilder(1000);<o:p></o:p></p>
</div>
<div>
<p>
FileContent fileContent = file.getContent();<o:p></o:p></p>
</div>
<div>
<p>
InputStream in = fileContent.getInputStream();<o:p></o:p></p>
</div>
<div>
<p>
int n;<o:p></o:p></p>
</div>
<div>
<p>
while ((n = in.read()) != -1) {<o:p></o:p></p>
</div>
<div>
<p>
buf.append((char) n);<o:p></o:p></p>
</div>
<div>
<p>
}<o:p></o:p></p>
</div>
<div>
<p> <b>
catalogStr = buf.toString();</b><o:p></o:p></p>
</div>
<div>
<p> }<o:p></o:p></p>
</div>
<div>
<p>
md5Bytes = encodeMD5(catalogStr);<o:p></o:p></p>
</div>
<div>
<p> } catch
(Exception ex) {<o:p></o:p></p>
</div>
<div>
<p>
// Note, can not throw an Exception from this method<o:p></o:p></p>
</div>
<div>
<p>
// but just to show that all is not well in Mudville<o:p></o:p></p>
</div>
<div>
<p>
// we print stack trace (for now - better to change<o:p></o:p></p>
</div>
<div>
<p> //
method signature and throw).<o:p></o:p></p>
</div>
<div>
<p>
ex.printStackTrace();<o:p></o:p></p>
</div>
<div>
<p> }<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>-Matt<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p> <o:p></o:p></p>
</div>
</div>
<p style='margin-bottom:12.0pt'>_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org" target="_blank">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><o:p></o:p></p>
</blockquote>
</div>
<p> <o:p></o:p></p>
</div>
</div>
</div>
<p> <o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org" target="_blank">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>