Hi Indunil,

On Fri, Sep 25, 2015 at 10:15 AM, Indunil Upeksha Rathnayake <
indu...@wso2.com> wrote:

> Hi,
>
> The deadlock issue(https://wso2.org/jira/browse/MB-1326) come up in
> oracle and mssql when clearResourceAuthorizations where permissions are
> deleted in UM_ROLE_PERMISSIONS, UM_USER_PERMISSIONS and UM_PERMISSION
> tables through one transaction. The fix would be using cascade delete for
> above tables.
>

+1


> But I think another issue(foreign key constraint violation) may come up
> when addAuthorizationForRole, as following example scenario. Ex: Node1 may
> be retrieve the permission entry in UM_PERMISSION table (in
> addAuthorizationForRole()) and just after that node2 may delete the entry
> (in clearResourceAuthorizations()) and after that when node1 trying to
> delete & add permissions in UM_ROLE_PERMISSIONS (in
> addAuthorizationForRole()) will return the above exception since the entry
> in UM_PERMISSION is already deleted.
>
I think the fix need to be, if UM_ROLE_PERMISSIONS and UM_PERMISSION tables
> are going to update, first have to lock both tables, until all the required
> operations are finished. Then meanwhile another node can't delete any
> entries.
>

Have you able to reproduce this behavior? I guess we cannot lock those
tables from the java code in db in dependent manner. Please check with our
db experts.

In worst case we could handle IntegrityConstraintViolationException since
its ok to avoiding addAuthorization for a permission which got deleted
later.

Thanks,


> Please provide your opinions regarding this.
>
> Thanks and Regards
> --
> Indunil Upeksha Rathnayake
> Software Engineer | WSO2 Inc
> Email    indu...@wso2.com
>



-- 
Regards,


*Darshana Gunawardana*Senior Software Engineer
WSO2 Inc.; http://wso2.com

*E-mail: darsh...@wso2.com <darsh...@wso2.com>*
*Mobile: +94718566859 <%2B94718566859>*Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to