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

Review request for ranger, Ankita Sinha, Don Bosco Durai, bhavik patel, Gautam 
Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, Ramesh Mani, Selvamohan 
Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.


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


Repository: ranger


Description
-------

**Problem Statement:** Currently, concurrent request to create a group and 
group-users mapping is causing duplicate entries of the same group in the 
x_group table and user-group mapping entry in the x_group_users table. 
Duplicate entry creation has been restricted through the RANGER-1765 patch 
which creates unique constraints on the x_group and x_group_users table. But 
unique index creation may fail if there is already duplicate entries(likely to 
happen in upgrade case).

**Proposed Solution :** Create SQL patch which should delete the duplicate 
entries from mentioned tables before creating the unique index. If a reference 
to duplicate group id is being used in child table then the id of the duplicate 
group shall be updated in the child table. In case of duplicate entries of the 
same group name; group name having the minimum id(created first) shall be given 
higher preference and will not be deleted from the x_group table.


Diffs
-----

  
security-admin/db/mysql/patches/028-add-unique-constraint-on-table-x_group.sql 
078fb99 
  security-admin/db/mysql/patches/028-delete-xgroup-duplicate-references.sql 
PRE-CREATION 
  
security-admin/db/mysql/patches/029-add-unique-constraint-on-table-x_group.sql 
PRE-CREATION 
  
security-admin/db/oracle/patches/028-add-unique-constraint-on-table-x_group.sql 
d512465 
  security-admin/db/oracle/patches/028-delete-xgroup-duplicate-references.sql 
PRE-CREATION 
  
security-admin/db/oracle/patches/029-add-unique-constraint-on-table-x_group.sql 
PRE-CREATION 
  
security-admin/db/postgres/patches/028-add-unique-constraint-on-table-x_group.sql
 501ec2e 
  security-admin/db/postgres/patches/028-delete-xgroup-duplicate-references.sql 
PRE-CREATION 
  
security-admin/db/postgres/patches/029-add-unique-constraint-on-table-x_group.sql
 PRE-CREATION 
  
security-admin/db/sqlanywhere/patches/028-add-unique-constraint-on-table-x_group.sql
 c39e68d 
  
security-admin/db/sqlanywhere/patches/028-delete-xgroup-duplicate-references.sql
 PRE-CREATION 
  
security-admin/db/sqlanywhere/patches/029-add-unique-constraint-on-table-x_group.sql
 PRE-CREATION 
  
security-admin/db/sqlserver/patches/028-add-unique-constraint-on-table-x_group.sql
 7559976 
  
security-admin/db/sqlserver/patches/028-delete-xgroup-duplicate-references.sql 
PRE-CREATION 
  
security-admin/db/sqlserver/patches/029-add-unique-constraint-on-table-x_group.sql
 PRE-CREATION 


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


Testing
-------

**Steps Performed (without patch):**
1. After mvn Build; untar the Ranger module and updated install.properties for 
MySQL DB flavor.
2. Removed 028 patch bundled with tar to skip creation of the unique index.
3. Called setup.sh to install Ranger.
4. Manually inserted duplicate entries in x_group and x_group_users table.
5. Removed 'DB_PATCHES' entry from x_db_version_h table to enable execution of 
new SQL patches.

**Steps Performed (with patch):**
After mvn Build; untar the Ranger module and updated install.properties for 
MySQL DB flavor with DB details provided earlier.
Called setup.sh to execute Ranger setup script.

**Expected Behavior:**
1. Ranger installation should finish successfully and patch 028 and patch 029 
should get applied successfully. 
2. Duplicate entries should be removed from x_group and x_group_users table.
3. Indexes should be created in x_group and x_group_users table.


**Actual Behavior:**
1. Ranger Installation finished successfully, patch 028 and patch 029 was 
applied successfully.
2. Duplicate entries were deleted from x_group and x_group_users table.
3. Indexes on the x_group and the x_group_users table were created successfully.

**Note:** 
1. Patch has been tested on all supported DB Flavors.
2. Have not done load testing.
3. Other reference table's duplicate entries deletion and unique indexes 
creation are not covered in this patch.


Thanks,

Pradeep Agrawal

Reply via email to