[ 
https://issues.apache.org/jira/browse/RANGER-663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Madhan Neethiraj updated RANGER-663:
------------------------------------
    Description: 
If two threads try to update one policy simultaneously then it can cause 
{{x_policy_resource}} table to have multiple values for a given {{policy_id, 
res_def_id}} combination.  When database gets in this state then tat policy can 
be read until the {{x_policy_resource_map}} and {{x_policy_resource}} tables 
are manually cleared up.

To reproduce the problem, from two separate shells, update the same policy 
using REST call in a tight loop. Soon updates will return failure with status 
code 400. At this point the policy is in a bad state in the database. After 
this point any attempt to update or read the policy will result in failure.

Expectation is that in case of simultaneous update only one update should 
succeed other should fail.

  was:
If two threads try to update one policy simultaneously then it can cause 
{{x_policy_resource}} table to have multiple values for a given {{policy_id, 
res_def_id}} combination.  When database gets in this stage then no policy can 
be read for that service unless and until the {{x_policy_resource_map}} and 
{{x_policy_resource}} tables are manually cleared up.

To reproduce the problem create a policy for a resource like hive 3, 4 values 
at each level (this is to increase the chances of multiple simultaneous update 
of the {{x_policy_resource}} and {{x_policy_resource_map}} table.  Then in a 
tight loop do PUT for that service in two separate shells.  Quickly updates 
will start to fail with 400 (since during update we read a policy).

Expectation is that in case of simultaneous update only one update should 
succeed other should fail.


> Race condition during policy update causes policy to get in an bad state
> ------------------------------------------------------------------------
>
>                 Key: RANGER-663
>                 URL: https://issues.apache.org/jira/browse/RANGER-663
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 0.5.0
>            Reporter: Alok Lal
>            Priority: Critical
>             Fix For: 0.5.1, 0.6.0
>
>
> If two threads try to update one policy simultaneously then it can cause 
> {{x_policy_resource}} table to have multiple values for a given {{policy_id, 
> res_def_id}} combination.  When database gets in this state then tat policy 
> can be read until the {{x_policy_resource_map}} and {{x_policy_resource}} 
> tables are manually cleared up.
> To reproduce the problem, from two separate shells, update the same policy 
> using REST call in a tight loop. Soon updates will return failure with status 
> code 400. At this point the policy is in a bad state in the database. After 
> this point any attempt to update or read the policy will result in failure.
> Expectation is that in case of simultaneous update only one update should 
> succeed other should fail.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to