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

sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 8556495  ATLAS-4421: [Atlas: Hive Import] When import-hive is run with 
incorrect input the information is not conveyed to the user
8556495 is described below

commit 855649508d5b0e9ab69afb6cf97996ba7393d47c
Author: Disha Talreja <dishatalr...@cloudera.com>
AuthorDate: Tue Sep 28 02:06:16 2021 -0400

    ATLAS-4421: [Atlas: Hive Import] When import-hive is run with incorrect 
input the information is not conveyed to the user
    
    Signed-off-by: Sarath Subramanian <sar...@apache.org>
    (cherry picked from commit 0aa45c8657a071bd4ee9e698abbeba81e1e542c6)
---
 addons/hive-bridge/src/bin/import-hive.sh                        | 4 ++--
 .../java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java   | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/addons/hive-bridge/src/bin/import-hive.sh 
b/addons/hive-bridge/src/bin/import-hive.sh
index fde486f..c353937 100755
--- a/addons/hive-bridge/src/bin/import-hive.sh
+++ b/addons/hive-bridge/src/bin/import-hive.sh
@@ -156,8 +156,8 @@ echo "Log file for import is $LOGFILE"
 "${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" 
org.apache.atlas.hive.bridge.HiveMetaStoreBridge $IMPORT_ARGS
 
 RETVAL=$?
-[ $RETVAL -eq 0 ] && echo Hive Meta Data imported successfully!!!
-[ $RETVAL -ne 0 ] && echo Failed to import Hive Meta Data!!!
+[ $RETVAL -eq 0 ] && echo Hive metadata imported successfully!
+[ $RETVAL -ne 0 ] && echo Failed to import Hive metadata! Check logs at: 
$LOGFILE for details.
 
 exit $RETVAL
 
diff --git 
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
 
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
index 08471b4..c361ac6 100755
--- 
a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+++ 
b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
@@ -161,6 +161,7 @@ public class HiveMetaStoreBridge {
 
             if (deleteNonExisting) {
                 
hiveMetaStoreBridge.deleteEntitiesForNonExistingHiveMetadata(failOnError);
+                exitCode = EXIT_CODE_SUCCESS;
             } else if (StringUtils.isNotEmpty(fileToImport)) {
                 File f = new File(fileToImport);
 
@@ -187,12 +188,13 @@ public class HiveMetaStoreBridge {
                     exitCode = EXIT_CODE_SUCCESS;
                 } else {
                     LOG.error("Failed to read the input file: " + 
fileToImport);
+                    exitCode = EXIT_CODE_FAILED;
                 }
             } else {
                 hiveMetaStoreBridge.importHiveMetadata(databaseToImport, 
tableToImport, failOnError);
+                exitCode = EXIT_CODE_SUCCESS;
             }
 
-            exitCode = EXIT_CODE_SUCCESS;
         } catch(ParseException e) {
             LOG.error("Failed to parse arguments. Error: ", e.getMessage());
             printUsage();
@@ -326,7 +328,8 @@ public class HiveMetaStoreBridge {
                 }
             }
         } else {
-            LOG.info("No database found");
+            LOG.error("No database found");
+            System.exit(EXIT_CODE_FAILED);
         }
     }
 
@@ -365,7 +368,7 @@ public class HiveMetaStoreBridge {
                 }
             }
         } else {
-            LOG.info("No tables to import in database {}", databaseName);
+            LOG.error("No tables to import in database {}", databaseName);
         }
 
         return tablesImported;

Reply via email to