HDFS-7591. hdfs classpath command should support same options as hadoop classpath. (Contributed by Varun Saxena)

This commit is contained in:
Arpit Agarwal 2015-01-16 09:37:54 -08:00
parent 651c7debe4
commit f72e2bfedd
4 changed files with 30 additions and 4 deletions

View File

@ -129,15 +129,15 @@ case $COMMAND in
elif [ "$COMMAND" = "trace" ] ; then
CLASS=org.apache.hadoop.tracing.TraceAdmin
elif [ "$COMMAND" = "classpath" ] ; then
if [ "$#" -eq 1 ]; then
if [ "$#" -gt 1 ]; then
CLASS=org.apache.hadoop.util.Classpath
else
# No need to bother starting up a JVM for this simple case.
if $cygwin; then
CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
fi
echo $CLASSPATH
exit
else
CLASS=org.apache.hadoop.util.Classpath
fi
elif [[ "$COMMAND" = -* ]] ; then
# class and package names cannot begin with a -

View File

@ -250,6 +250,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7189. Add trace spans for DFSClient metadata operations. (Colin P.
McCabe via yliu)
HDFS-7591. hdfs classpath command should support same options as hadoop
classpath. (Varun Saxena via Arpit Agarwal)
OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode.

View File

@ -43,6 +43,7 @@ function print_usage(){
echo "Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND"
echo " where COMMAND is one of:"
echo " dfs run a filesystem command on the file systems supported in Hadoop."
echo " classpath prints the classpath"
echo " namenode -format format the DFS filesystem"
echo " secondarynamenode run the DFS secondary namenode"
echo " namenode run the DFS namenode"
@ -207,6 +208,17 @@ elif [ "$COMMAND" = "version" ] ; then
CLASS=org.apache.hadoop.util.VersionInfo
elif [ "$COMMAND" = "debug" ]; then
CLASS=org.apache.hadoop.hdfs.tools.DebugAdmin
elif [ "$COMMAND" = "classpath" ]; then
if [ "$#" -gt 0 ]; then
CLASS=org.apache.hadoop.util.Classpath
else
# No need to bother starting up a JVM for this simple case.
if $cygwin; then
CLASSPATH=$(cygpath -p -w "$CLASSPATH" 2>/dev/null)
fi
echo $CLASSPATH
exit 0
fi
else
CLASS="$COMMAND"
fi

View File

@ -51,7 +51,14 @@ if "%1" == "--loglevel" (
goto print_usage
)
set hdfscommands=dfs namenode secondarynamenode journalnode zkfc datanode dfsadmin haadmin fsck balancer jmxget oiv oev fetchdt getconf groups snapshotDiff lsSnapshottableDir cacheadmin mover storagepolicies
if %hdfs-command% == classpath (
if not defined hdfs-command-arguments (
@rem No need to bother starting up a JVM for this simple case.
@echo %CLASSPATH%
exit /b
)
)
set hdfscommands=dfs namenode secondarynamenode journalnode zkfc datanode dfsadmin haadmin fsck balancer jmxget oiv oev fetchdt getconf groups snapshotDiff lsSnapshottableDir cacheadmin mover storagepolicies classpath
for %%i in ( %hdfscommands% ) do (
if %hdfs-command% == %%i set hdfscommand=true
)
@ -122,6 +129,10 @@ goto :eof
set CLASS=org.apache.hadoop.hdfs.tools.JMXGet
goto :eof
:classpath
set CLASS=org.apache.hadoop.util.Classpath
goto :eof
:oiv
set CLASS=org.apache.hadoop.hdfs.tools.offlineImageViewer.OfflineImageViewerPB
goto :eof