Commit 27a39063 by Suma Shivaprasad

ATLAS-257 import_hive.sh fails when run under cygwin(dkantor via sumasai)

parent aafc06c4
......@@ -16,6 +16,8 @@
# resolve links - $0 may be a softlink
PRG="${0}"
[[ `uname -s` == *"CYGWIN"* ]] && CYGWIN=true
while [ -h "${PRG}" ]; do
ls=`ls -ld "${PRG}"`
link=`expr "$ls" : '.*-> \(.*\)$'`
......@@ -38,21 +40,23 @@ if [ -f "${METADATA_CONF}/atlas-env.sh" ]; then
. "${METADATA_CONF}/atlas-env.sh"
fi
if test -z ${JAVA_HOME}
if test -z "${JAVA_HOME}"
then
JAVA_BIN=`which java`
JAR_BIN=`which jar`
else
JAVA_BIN=${JAVA_HOME}/bin/java
JAR_BIN=${JAVA_HOME}/bin/jar
JAVA_BIN="${JAVA_HOME}/bin/java"
JAR_BIN="${JAVA_HOME}/bin/jar"
fi
export JAVA_BIN
if [ ! -e $JAVA_BIN ] || [ ! -e $JAR_BIN ]; then
if [ ! -e "${JAVA_BIN}" ] || [ ! -e "${JAR_BIN}" ]; then
echo "$JAVA_BIN and/or $JAR_BIN not found on the system. Please make sure java and jar commands are available."
exit 1
fi
# Construct classpath using Atlas conf directory
# and jars from bridge/hive and hook/hive directories.
METADATACPPATH="$METADATA_CONF"
for i in "${BASEDIR}/bridge/hive/"*.jar; do
......@@ -66,14 +70,8 @@ done
# log dir for applications
METADATA_LOG_DIR="${METADATA_LOG_DIR:-$BASEDIR/logs}"
export METADATA_LOG_DIR
LOGFILE="$METADATA_LOG_DIR/import-hive.log"
JAVA_PROPERTIES="$METADATA_OPTS -Datlas.log.dir=$METADATA_LOG_DIR -Datlas.log.file=import-hive.log -Dlog4j.configuration=atlas-log4j.xml"
shift
while [[ ${1} =~ ^\-D ]]; do
JAVA_PROPERTIES="${JAVA_PROPERTIES} ${1}"
shift
done
TIME=`date +%Y%m%d%H%M%s`
#Add hive conf in classpath
......@@ -88,10 +86,30 @@ else
exit 1
fi
export HIVE_CP
echo Using Hive configuration directory [$HIVE_CP]
echo "Logs for import are in $METADATA_LOG_DIR/import-hive.log"
${JAVA_BIN} ${JAVA_PROPERTIES} -cp ${HIVE_CP}:${METADATACPPATH} org.apache.atlas.hive.bridge.HiveMetaStoreBridge
CP="${HIVE_CP}:${METADATACPPATH}"
# If running in cygwin, convert pathnames and classpath to Windows format.
if [ "${CYGWIN}" == "true" ]
then
METADATA_LOG_DIR=`cygpath -w ${METADATA_LOG_DIR}`
LOGFILE=`cygpath -w ${LOGFILE}`
HIVE_CP=`cygpath -w ${HIVE_CP}`
CP=`cygpath -w -p ${CP}`
fi
JAVA_PROPERTIES="$METADATA_OPTS -Datlas.log.dir=$METADATA_LOG_DIR -Datlas.log.file=import-hive.log -Dlog4j.configuration=atlas-log4j.xml"
shift
while [[ ${1} =~ ^\-D ]]; do
JAVA_PROPERTIES="${JAVA_PROPERTIES} ${1}"
shift
done
echo Using Hive configuration directory ["$HIVE_CP"]
echo "Log file for import is $LOGFILE"
"${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hive.bridge.HiveMetaStoreBridge
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Hive Data Model imported successfully!!!
......
......@@ -10,6 +10,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
ATLAS-3 Mixed Index creation fails with Date types (sumasai via shwethags)
ALL CHANGES:
ATLAS-257 import_hive.sh fails when run under cygwin(dkantor via sumasai)
ATLAS-255 Add log level setting for titan in atlas-log4j.xml(ayubkhan via sumasai)
ATLAS-246 QuickStart uses integer data type for dates, which causes data loss (dkantor via sumasai)
ATLAS-232 Fix the API incompatibility introduced in ATLAS-58(shwethags via sumasai)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment