You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Subhrat Chaudhary via Review Board <no...@reviews.apache.org> on 2023/05/16 12:18:37 UTC

Review Request 74438: RANGER-4240: Optimize deletion of XXAuthSession while deleting user

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74438/
-----------------------------------------------------------

Review request for ranger, Ankita Sinha and Madhan Neethiraj.


Bugs: https://issues.apache.org/jira/browse/RANGER-4240
    https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/RANGER-4240


Repository: ranger


Description
-------

The table x_auth_session may contain records for a user in thousands. For users which are frequently used, this count is usually 10k to 15k, in some cases it can be higher.

For such a user, when delete API 

/xusers/secure/users/id/{user_id}

 is called, deletion of records from x_auth_sess can take minutes, since rows will be locked for deletion and following exception is noticed in logs:

java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

During testing for deletion of a user with about 30k records in x_auth_session, it took about 6.4 minutes.

To optimize this, we can implement RANGER-3681 for deletion of records from x_auth_sess.


Diffs
-----

  security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java e3790c0f5 
  security-admin/src/main/java/org/apache/ranger/db/XXAuthSessionDao.java 934d25865 
  security-admin/src/main/resources/META-INF/jpa_named_queries.xml 412d0b10a 
  security-admin/src/test/java/org/apache/ranger/biz/TestXUserMgr.java 528f4e511 


Diff: https://reviews.apache.org/r/74438/diff/1/


Testing
-------

1. Validated that existing JUnits are passing.
2. Tested the use case with the fix. Deletion of a user with 60k records in the table x_auth_session, completed in 2.3 sec.


Thanks,

Subhrat Chaudhary


Re: Review Request 74438: RANGER-4240: Optimize deletion of XXAuthSession while deleting user

Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74438/#review225460
-----------------------------------------------------------


Ship it!




Ship It!

- Madhan Neethiraj


On May 16, 2023, 12:18 p.m., Subhrat Chaudhary wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/74438/
> -----------------------------------------------------------
> 
> (Updated May 16, 2023, 12:18 p.m.)
> 
> 
> Review request for ranger, Ankita Sinha and Madhan Neethiraj.
> 
> 
> Bugs: https://issues.apache.org/jira/browse/RANGER-4240
>     https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/RANGER-4240
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> The table x_auth_session may contain records for a user in thousands. For users which are frequently used, this count is usually 10k to 15k, in some cases it can be higher.
> 
> For such a user, when delete API 
> 
> /xusers/secure/users/id/{user_id}
> 
>  is called, deletion of records from x_auth_sess can take minutes, since rows will be locked for deletion and following exception is noticed in logs:
> 
> java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
> 
> During testing for deletion of a user with about 30k records in x_auth_session, it took about 6.4 minutes.
> 
> To optimize this, we can implement RANGER-3681 for deletion of records from x_auth_sess.
> 
> 
> Diffs
> -----
> 
>   security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java e3790c0f5 
>   security-admin/src/main/java/org/apache/ranger/db/XXAuthSessionDao.java 934d25865 
>   security-admin/src/main/resources/META-INF/jpa_named_queries.xml 412d0b10a 
>   security-admin/src/test/java/org/apache/ranger/biz/TestXUserMgr.java 528f4e511 
> 
> 
> Diff: https://reviews.apache.org/r/74438/diff/1/
> 
> 
> Testing
> -------
> 
> 1. Validated that existing JUnits are passing.
> 2. Tested the use case with the fix. Deletion of a user with 60k records in the table x_auth_session, completed in 2.3 sec.
> 
> 
> Thanks,
> 
> Subhrat Chaudhary
> 
>