Project

General

Profile

Actions

Bug #5566

closed

Click View Run link get 0 result if user doesn't login on the sanparks skin

Added by Jing Tao over 12 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
metacat
Target version:
Start date:
12/07/2011
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5566

Description

On the sanparks skin, if you click the TPC workflows link, you will get a list of workflows. There are three actions for each workflow - View Run, Schedule and Download.

When user click View Run link, it shows no run even though user can see some public readable runs.

If user logged in, he will see some runs when he/she clicks the View Run link.

Actions #1

Updated by ben leinfelder over 12 years ago

Do you think this is because of the new permission handling in Metacat?
The change I just made to trunk means that every revision of a document has its own permissions.

Actions #2

Updated by Jing Tao over 12 years ago

No, it is not. I haven't update your code yet.

I figured it out somehow the search result was cached even the queries are different. It always shows the result of the first click.

Actions #3

Updated by Jing Tao over 12 years ago

After restarting tomcat, i ran the two queries on the dev skin. The second one is from cache. This is wrong since they are totally different:

<pathquery version='1.2'><returndoctype>http://www.kepler-project.org/kar-2.0.0&lt;/returndoctype&gt;&lt;returndoctype&gt;http://www.kepler-project.org/kar-2.1.0&lt;/returndoctype&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='user']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='description']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='startTime']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowLSID']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryAttributes/tpcStatus&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowName']/@value&lt;/returnfield&gt;&lt;returnfield&gt;mainAttributes/lsid&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/@class&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryAttributes/Name&lt;/returnfield&gt;&lt;querygroup operator='INTERSECT'><queryterm casesensitive='false' searchmode='starts-with'><value>entityId</value><pathexpr>karEntry/karEntryXML/entity/property/@name</pathexpr></queryterm><queryterm casesensitive='false' searchmode='starts-with'><value>urn:lsid:kepler-project.org/ns/:10241:3:13</value><pathexpr>karEntry/karEntryXML/entity/property/@value</pathexpr></queryterm></querygroup></pathquery>

<pathquery version='1.2'><returndoctype>http://www.kepler-project.org/kar-2.0.0&lt;/returndoctype&gt;&lt;returndoctype&gt;http://www.kepler-project.org/kar-2.1.0&lt;/returndoctype&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='user']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='description']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='startTime']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowLSID']/@value&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryAttributes/tpcStatus&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowName']/@value&lt;/returnfield&gt;&lt;returnfield&gt;mainAttributes/lsid&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryXML/property[@name='WorkflowRun']/@class&lt;/returnfield&gt;&lt;returnfield&gt;karEntry/karEntryAttributes/Name&lt;/returnfield&gt;&lt;querygroup operator='INTERSECT'><queryterm casesensitive='false' searchmode='starts-with'><value>entityId</value><pathexpr>karEntry/karEntryXML/entity/property/@name</pathexpr></queryterm><queryterm casesensitive='false' searchmode='starts-with'><value>urn:lsid:gamma.msi.ucsb.edu/OpenAuth/:8252:6:42</value><pathexpr>karEntry/karEntryXML/entity/property/@value</pathexpr></queryterm></querygroup></pathquery>

Actions #4

Updated by Jing Tao over 12 years ago

in the cache system, we use the combination of the selection and extended query as the key to store the cache result. The combination would be different if there is any different in query. So it was unique.

However, the extended query format was changed - it uses ? to replace the real value. The key can be same if the queries are different.

So the cache system is broken. We need find another key.

The combination for above queries are:

SELECT docid,docname,doctype,date_created, date_updated, rev FROM xml_documents WHERE docid IN (((SELECT DISTINCT docid FROM xml_nodes WHERE UPPER LIKE ? AND nodetype LIKE 'ATTRIBUTE' AND nodename LIKE ? AND parentnodeid IN (SELECT nodeid FROM xml_index WHERE path LIKE ?) ) INTERSECT (SELECT DISTINCT docid FROM xml_nodes WHERE UPPER LIKE ? AND nodetype LIKE 'ATTRIBUTE' AND nodename LIKE ? AND parentnodeid IN (SELECT nodeid FROM xml_index WHERE path LIKE ?) ) )) AND (docid IN (SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( (lower(principal_name) = 'public') AND perm_type = 'allow' AND permission > 3)) AND docid NOT IN (SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( (lower(principal_name) = 'public') AND perm_type = 'deny' AND perm_order ='allowFirst' AND permission > 3) ))[http://www.kepler-project.org/kar-2.0.0, http://www.kepler-project.org/kar-2.1.0][karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='user']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='description']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='startTime']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowLSID']/@value, karEntry/karEntryAttributes/tpcStatus, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowName']/@value, mainAttributes/lsid, karEntry/karEntryXML/property[@name='WorkflowRun']/@class, karEntry/karEntryAttributes/Name]

SELECT docid,docname,doctype,date_created, date_updated, rev FROM xml_documents WHERE docid IN (((SELECT DISTINCT docid FROM xml_nodes WHERE UPPER LIKE ? AND nodetype LIKE 'ATTRIBUTE' AND nodename LIKE ? AND parentnodeid IN (SELECT nodeid FROM xml_index WHERE path LIKE ?) ) INTERSECT (SELECT DISTINCT docid FROM xml_nodes WHERE UPPER LIKE ? AND nodetype LIKE 'ATTRIBUTE' AND nodename LIKE ? AND parentnodeid IN (SELECT nodeid FROM xml_index WHERE path LIKE ?) ) )) AND (docid IN (SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( (lower(principal_name) = 'public') AND perm_type = 'allow' AND permission > 3)) AND docid NOT IN (SELECT id.docid from xml_access xa, identifier id WHERE id.guid = xa.guid AND ( (lower(principal_name) = 'public') AND perm_type = 'deny' AND perm_order ='allowFirst' AND permission > 3) ))[http://www.kepler-project.org/kar-2.0.0, http://www.kepler-project.org/kar-2.1.0][karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='user']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='description']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='startTime']/@value, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowLSID']/@value, karEntry/karEntryAttributes/tpcStatus, karEntry/karEntryXML/property[@name='WorkflowRun']/property[@name='workflowName']/@value, mainAttributes/lsid, karEntry/karEntryXML/property[@name='WorkflowRun']/@class, karEntry/karEntryAttributes/Name]

They are same even the queries are different.

Actions #5

Updated by ben leinfelder over 12 years ago

Good catch!
We can use the query string after the parameter values are bound to the prepared statement.

Would look something like this:
PreparedStatement pstmt = DBConnectionPool.getDBConnection("something").prepareStatement(sqlQuery);
pstmt = DBQuery.setPreparedStatementValues(parameterValues, pstmt);
String preparedQueryString = pstmt.toString();

Sound like a plan?

Actions #6

Updated by Jing Tao over 12 years ago

Yeah.
this is the way i am doing :)

Actions #7

Updated by Jing Tao over 12 years ago

Now the cache key is using populated string with parameter values rather than just "?". It is working.

Actions #8

Updated by Redmine Admin about 11 years ago

Original Bugzilla ID was 5566

Actions

Also available in: Atom PDF