You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mg...@apache.org on 2018/07/02 17:28:45 UTC
[ambari] branch trunk updated: AMBARI-24232 Hive DB Backup during
upgrade should handle exceptions properly (mgergely)
This is an automated email from the ASF dual-hosted git repository.
mgergely pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2737952 AMBARI-24232 Hive DB Backup during upgrade should handle exceptions properly (mgergely)
2737952 is described below
commit 273795277e507b802ab6bbaae9731b55b8d61bb4
Author: Miklos Gergely <mg...@hortonworks.com>
AuthorDate: Mon Jul 2 16:53:33 2018 +0200
AMBARI-24232 Hive DB Backup during upgrade should handle exceptions properly (mgergely)
---
.../HIVE/0.12.0.2.0/package/scripts/pre_upgrade.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/pre_upgrade.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/pre_upgrade.py
index e5ac709..4db8b8b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/pre_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/pre_upgrade.py
@@ -20,6 +20,7 @@ limitations under the License.
# Python Imports
import os
import shutil
+import traceback
# Ambari Commons & Resource Management Imports
@@ -68,12 +69,19 @@ class HivePreUpgrade(Script):
dump_dir = "/etc/hive/dbdump"
dump_file = format("{dump_dir}/hive-{stack_version_formatted}-{type}-dump.sql")
command = format("mkdir -p {dump_dir}; " + command)
+ success = False
+
if is_db_here:
- Execute(command, user = "root")
- Logger.info(format("Hive Metastore database backup created at {dump_file}"))
- else:
+ try:
+ Execute(command, user = "root")
+ Logger.info(format("Hive Metastore database backup created at {dump_file}"))
+ success = True
+ except:
+ traceback.print_exc()
+
+ if not success:
Logger.warning("MANUAL DB DUMP REQUIRED!!")
- Logger.warning(format("Hive Metastore is using an external {hive_metastore_db_type} database, the connection url is {hive_jdbc_connection_url}."))
+ Logger.warning(format("Hive Metastore is using a(n) {hive_metastore_db_type} database, the connection url is {hive_jdbc_connection_url}."))
Logger.warning("Please log in to that host, and create a db backup manually by executing the following command:")
Logger.warning(format("\"{command}\""))