-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/69468/
-----------------------------------------------------------
Review request for ranger, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh,
Nikhil P, Ramesh Mani, and Velmurugan Periasamy.
Bugs: RANGER-2295
https://issues.apache.org/jira/browse/RANGER-2295
Repository: ranger
Description
-------
**Problem Statement:** DB setup script(db_setup.py) looks for a specific
version (For example: "Ranger 2.0.0-SNAPSHOT") to decide if patches need to be
applied or not.
For example:
select version from x_db_version_h where version = 'DB_PATCHES' and inst_by =
'Ranger 2.0.0-SNAPSHOT' and active = 'Y';
select version from x_db_version_h where version = 'JAVA_PATCHES' and inst_by =
'Ranger 2.0.0-SNAPSHOT' and active = 'Y';
However, the optimized schema creation script comes with a generic version (For
example: "Ranger 1.0.0"):
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('DB_PATCHES',CURRENT_TIMESTAMP,'Ranger
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
INSERT INTO x_db_version_h
(version,inst_at,inst_by,updated_at,updated_by,active) VALUES
('JAVA_PATCHES',CURRENT_TIMESTAMP,'Ranger
1.0.0',CURRENT_TIMESTAMP,'localhost','Y');
The result is that a separate check is executed for each patch, which takes
time. It will be good if the status entries have the exact ranger version
rather a base version.
**Proposed Solution:** The propsed solution includes following changes:
After core db schema file(ranger_core_db_*.sql) is imported patch shall update
the sql/java patches entry version with the exact version+build being used.
Once the exact version is updated then when DB setup script will look for a
specific version then it will find a matching entry and skip the all patches
check.
Diffs
-----
security-admin/scripts/db_setup.py 2bda1a8e7
Diff: https://reviews.apache.org/r/69468/diff/1/
Testing
-------
**Steps performed for Ranger-admin(with patch):**
1. Created Build with patch and untar the build.
2. Opened install.properties and provided db configuration in install.properties
3. Called setup.sh
**Expected Behavior:**
1. There should be a single call of db schema setup and it should not try to
apply/check all the db patches entries.
**Actual Behavior:**
2. After importing the db schema file, ranger checked for entries of
'DB_PATCHES' and 'JAVA_PATCHES' for the current ranger version and skipped
checking entries of every db and java patches.
**Note:**
Patch has been tested for all the db flavor.
Thanks,
Pradeep Agrawal