You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ve...@apache.org on 2020/11/25 15:34:53 UTC

[ranger] branch ranger-2.2 updated: RANGER-3087 : Making db_setup.py fool-proof and robust

This is an automated email from the ASF dual-hosted git repository.

vel pushed a commit to branch ranger-2.2
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.2 by this push:
     new 2bacdc6  RANGER-3087 : Making db_setup.py fool-proof and robust
2bacdc6 is described below

commit 2bacdc639c87773daf53f872137c2ebaee2c03cf
Author: Vishal Suvagia <vi...@apache.org>
AuthorDate: Tue Nov 24 22:35:03 2020 +0530

    RANGER-3087 : Making db_setup.py fool-proof and robust
    
    Issue:
    When a user configures a small heap size in install.properties, vm creation in db_setup.py fails to apply the java
    patches with Error in creating VM.
    
    Changes:
    Added checks for heap-size and set the default heap-size
    
    Testing:
    Validated changes for fresh install and upgrade from ranger-1.0 to master and ranger-2.2 to master
    
    Signed-off-by: Velmurugan Periasamy <ve...@apache.org>
---
 security-admin/scripts/db_setup.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/security-admin/scripts/db_setup.py b/security-admin/scripts/db_setup.py
index 09fab95..b6c2e85 100644
--- a/security-admin/scripts/db_setup.py
+++ b/security-admin/scripts/db_setup.py
@@ -90,6 +90,16 @@ def populate_global_dict():
 			globalDict[key] = value
 		if 'ranger_admin_max_heap_size' not in globalDict:
 			globalDict['ranger_admin_max_heap_size']='1g'
+		elif 'ranger_admin_max_heap_size' in globalDict:
+			ranger_admin_heap_size = globalDict['ranger_admin_max_heap_size']
+			if str(ranger_admin_heap_size.lower()).endswith("g"):
+				ranger_admin_heap_size_numeric = int(str(ranger_admin_heap_size).lower().rstrip("g"))
+				if ranger_admin_heap_size_numeric < 1:
+					globalDict['ranger_admin_max_heap_size']='1g'
+			if str(ranger_admin_heap_size.lower()).endswith("m"):
+				ranger_admin_heap_size_numeric = int(str(ranger_admin_heap_size).lower().rstrip("m"))
+				if ranger_admin_heap_size_numeric < 1024:
+					globalDict['ranger_admin_max_heap_size']='1g'
 
 def jisql_log(query, db_password):
 	if jisql_debug == True: