You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Mamta A. Satoor (JIRA)" <de...@db.apache.org> on 2006/07/20 18:12:16 UTC

[jira] Updated: (DERBY-1539) As per the functional spec attached to DERBY-1330, a trigger should be dropped when a privilege required by the trigger is revoked.

     [ http://issues.apache.org/jira/browse/DERBY-1539?page=all ]

Mamta A. Satoor updated DERBY-1539:
-----------------------------------

    Attachment: DERBY1539V1hashCodeEqualsDiff.txt
                DERBY1539V1hashCodeEqualsStat.txt

This(DERBY1539V1hashCodeEqualsDiff.txt) is a mini patch in preparation for more revoke privilege work that I am still working on. 

PermissionsDescriptor has 2 methods. namely, hashCode and equals. In the initial stages of Grant Revoke functionality, there was no UUID associated with the PermissionsDescriptor and hence these methods did not need to worry about UUID.  But for revoke functionality, dependency manager is going to keep various object dependencies on PermissionsDescriptor using the UUID attached to the PermissionsDescriptor. Hence, when dependency manager works with PermissionsDescriptor, it only knows about UUID and doesn't know anything about tableUUID/routineUUID and hashCode & equals method need to be able to handle that. On the other hand, during compile state, when privilege requirements are collected for the statement, we only know of tableUUID/routineUUID and nothing about UUID of the PermissionsDescriptor. In order to handle these scenarios, I have made changes to the hashCode and equals method to look for tableUUID!=null or routineUUID!=null.

I have added an extensive javadoc comment to hashCode method which explains the change in hashCode and equals method. I debated whether this comment should go as regular comment rather than javadoc comment. Let me know if anyone has any opinion about it.

I am copying the comments from hashCode method here which hopefully will help understand the patch better
     *  eg when will if condition below return true?
     *  During sql statement execution time, one of the first things that
     *  happen is the privilege checking. Every statement has a list of
     *  privileges that should exist in order for the statement to execute
     *  successfully. That list gets collected during statement compilation
     *  time. During execution, the list knows of tableUUID of the table
     *  on which the privilege is required but it doesn't know of the
     *  UUID of the privilege. So, the if condition below for tableUUID!=null
     *  will be true when privilege checking happens at statement execution
     *  time.
     * 
     *  eg when will if condition below return false?
     *  When the dependency manager looks for dependents for a permission
     *  descriptor, it doesn't know what is the permission descriptor's
     *  tableUUID but it does know the UUID of the permission descriptor.
     *  So, the if condition below for tableUUID!=null will be false when
     *  dependency manager is looking for permission descriptor's dependents.
     * 
     *  There are some instances where tableUUID and UUID are both known.
     *  And it doesn't matter which code path gets picked up below
     *  and hence I simply chose the tableUUID!=null as the catch bucket.
     *  tableID and UUID will be both known when an existing permission
     *  descriptor in the cache needs to be removed from cache because
     *  a grant/revoke was issued and that has changed the allowed
     *  permissions on the permission descriptor. This happens at the
     *  end of DataDictionary.addRemovePermissionsDescriptor method.

Can someone please review this patch and commit if everything looks good? I ran the derbyall last night and it ran fine with no new diffs.

> As per the functional spec attached to DERBY-1330, a trigger should be dropped when a privilege required by the trigger is revoked.
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1539
>                 URL: http://issues.apache.org/jira/browse/DERBY-1539
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 10.2.0.0
>            Reporter: Mamta A. Satoor
>         Assigned To: Mamta A. Satoor
>             Fix For: 10.2.0.0
>
>         Attachments: DERBY1539V1hashCodeEqualsDiff.txt, DERBY1539V1hashCodeEqualsStat.txt
>
>
> A trigger tracks its privileges requirements using Derby's Dependency Manager. If any one of those required privileges are revoked, the trigger should be dropped automatically. 
> I am just creating a new jira entry here so it is easier to track sub items of DERBY-1330. Will link this Jira entry to DERBY-1330.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira