This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new 0aa45c8 ATLAS-4421: [Atlas: Hive Import] When import-hive is run with
incorrect input the information is not conveyed to the user
0aa45c8 is described below
commit 0aa45c8657a071bd4ee9e698abbeba81e1e542c6
Author: Disha Talreja <[email protected]>
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 <[email protected]>
---
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;