timyuer commented on code in PR #3702: URL: https://github.com/apache/ambari/pull/3702#discussion_r1247526948
########## ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/hbase_decommission.py: ########## @@ -57,32 +69,65 @@ def hbase_decommission(env): if params.hbase_drain_only: for host in hosts: if host: - regiondrainer_cmd = format( - "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_drainer} remove {host}") - Execute(regiondrainer_cmd, - user=params.hbase_user, - logoutput=True - ) - pass + try: + regiondrainer_cmd = format( + "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_drainer} remove {host}") + Execute(regiondrainer_cmd, + user=params.hbase_user, + logoutput=True + ) + pass + except Exception as e: + # Execute HBase 2 scripts if HBase 1 scripts fail. + # If the Exception is genuine, it will fail here because HBase 1 scripts work only for HBase 1 + # and HBase 2 scripts work only for HBase 2 cluster. + Logger.info("HBase 1 RegionMover failed. Will try with HBase 2 RegionMover." + str(e)) + regiondrainer_cmd = format( + "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_drainer2} remove {host}") + Execute(regiondrainer_cmd, + user=params.hbase_user, + logoutput=True + ) + pass pass else: for host in hosts: if host: - regiondrainer_cmd = format( - "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_drainer} add {host}") - regionmover_cmd = format( - "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_mover} -o unload -r {host}") - - Execute(regiondrainer_cmd, - user=params.hbase_user, - logoutput=True - ) - - Execute(regionmover_cmd, - user=params.hbase_user, - logoutput=True - ) + try: + regiondrainer_cmd = format( + "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_drainer} add {host}") + regionmover_cmd = format( + "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\" {hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config} org.jruby.Main {region_mover} -m 24 unload {host}") + + Execute(regiondrainer_cmd, + user=params.hbase_user, + logoutput=True + ) + + Execute(regionmover_cmd, + user=params.hbase_user, + logoutput=True + ) Review Comment: Same comment above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ambari.apache.org For additional commands, e-mail: dev-h...@ambari.apache.org