Skip to content

Commit c1e9110

Browse files
committed
svn merge -c 1076296 from trunk for HADOOP-7114.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/yahoo-merge@1126800 13f79535-47bb-0310-9956-ffa450edef68
1 parent 39e2ac5 commit c1e9110

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Trunk (unreleased changes)
4444
HADOOP-7250. Refactor the setrep command to conform to new FsCommand class.
4545
(Daryn Sharp via szetszwo)
4646

47+
HADOOP-7114. FsShell should dump all exceptions at DEBUG level.
48+
(todd via tomwhite)
49+
4750
OPTIMIZATIONS
4851

4952
BUG FIXES

src/java/org/apache/hadoop/fs/FsShell.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import java.util.TimeZone;
3131
import java.util.zip.GZIPInputStream;
3232

33+
import org.apache.commons.logging.Log;
34+
import org.apache.commons.logging.LogFactory;
3335
import org.apache.hadoop.classification.InterfaceAudience;
3436
import org.apache.hadoop.conf.Configuration;
3537
import org.apache.hadoop.conf.Configured;
@@ -55,6 +57,8 @@
5557
/** Provide command line access to a FileSystem. */
5658
@InterfaceAudience.Private
5759
public class FsShell extends Configured implements Tool {
60+
61+
static final Log LOG = LogFactory.getLog(FsShell.class);
5862

5963
private FileSystem fs;
6064
private Trash trash;
@@ -722,6 +726,7 @@ void rename(String srcf, String dstf) throws IOException {
722726
try {
723727
dstFstatus = fs.getFileStatus(dst);
724728
} catch(IOException e) {
729+
LOG.debug("Error getting file status of " + dst, e);
725730
}
726731
if((srcFstatus!= null) && (dstFstatus!= null)) {
727732
if (srcFstatus.isDirectory() && !dstFstatus.isDirectory()) {
@@ -769,6 +774,7 @@ private int rename(String argv[], Configuration conf) throws IOException {
769774
//
770775
rename(argv[i], dest);
771776
} catch (RemoteException e) {
777+
LOG.debug("Error renaming " + argv[i], e);
772778
//
773779
// This is a error returned by hadoop server. Print
774780
// out the first line of the error mesage.
@@ -783,6 +789,7 @@ private int rename(String argv[], Configuration conf) throws IOException {
783789
ex.getLocalizedMessage());
784790
}
785791
} catch (IOException e) {
792+
LOG.debug("Error renaming " + argv[i], e);
786793
//
787794
// IO exception encountered locally.
788795
//
@@ -854,6 +861,7 @@ private int copy(String argv[], Configuration conf) throws IOException {
854861
//
855862
copy(argv[i], dest, conf);
856863
} catch (RemoteException e) {
864+
LOG.debug("Error copying " + argv[i], e);
857865
//
858866
// This is a error returned by hadoop server. Print
859867
// out the first line of the error mesage.
@@ -869,6 +877,7 @@ private int copy(String argv[], Configuration conf) throws IOException {
869877
ex.getLocalizedMessage());
870878
}
871879
} catch (IOException e) {
880+
LOG.debug("Error copying " + argv[i], e);
872881
//
873882
// IO exception encountered locally.
874883
//
@@ -929,6 +938,7 @@ private void delete(Path src, FileSystem srcFs, boolean recursive,
929938
return;
930939
}
931940
} catch (IOException e) {
941+
LOG.debug("Error with trash", e);
932942
Exception cause = (Exception) e.getCause();
933943
String msg = "";
934944
if(cause != null) {
@@ -995,6 +1005,7 @@ private static FileStatus[] shellListStatus(String cmd,
9951005
} catch(FileNotFoundException fnfe) {
9961006
System.err.println(cmd + ": could not get listing for '" + path + "'");
9971007
} catch (IOException e) {
1008+
LOG.debug("Error listing " + path, e);
9981009
System.err.println(cmd +
9991010
": could not get get listing for '" + path + "' : " +
10001011
e.getMessage().split("\n")[0]);
@@ -1051,6 +1062,7 @@ int runCmdHandler(CmdHandler handler, String[] args,
10511062
errors += runCmdHandler(handler, file, srcFs, recursive);
10521063
}
10531064
} catch (IOException e) {
1065+
LOG.debug("Error getting status for " + path, e);
10541066
String msg = (e.getMessage() != null ? e.getLocalizedMessage() :
10551067
(e.getCause().getMessage() != null ?
10561068
e.getCause().getLocalizedMessage() : "null"));
@@ -1383,6 +1395,7 @@ private int doall(String cmd, String argv[], int startindex) {
13831395
text(argv[i]);
13841396
}
13851397
} catch (RemoteException e) {
1398+
LOG.debug("Error", e);
13861399
//
13871400
// This is a error returned by hadoop server. Print
13881401
// out the first line of the error message.
@@ -1398,6 +1411,7 @@ private int doall(String cmd, String argv[], int startindex) {
13981411
ex.getLocalizedMessage());
13991412
}
14001413
} catch (IOException e) {
1414+
LOG.debug("Error", e);
14011415
//
14021416
// IO exception encountered locally.
14031417
//
@@ -1551,11 +1565,13 @@ public int run(String argv[]) throws Exception {
15511565
// initialize FsShell
15521566
try {
15531567
init();
1554-
} catch (RPC.VersionMismatch v) {
1568+
} catch (RPC.VersionMismatch v) {
1569+
LOG.debug("Version mismatch", v);
15551570
System.err.println("Version Mismatch between client and server" +
15561571
"... command aborted.");
15571572
return exitCode;
15581573
} catch (IOException e) {
1574+
LOG.debug("Error", e);
15591575
System.err.println("Bad connection to FS. Command aborted. Exception: " +
15601576
e.getLocalizedMessage());
15611577
return exitCode;
@@ -1644,10 +1660,12 @@ public int run(String argv[]) throws Exception {
16441660
printUsage("");
16451661
}
16461662
} catch (IllegalArgumentException arge) {
1663+
LOG.debug("Error", arge);
16471664
exitCode = -1;
16481665
System.err.println(cmd.substring(1) + ": " + arge.getLocalizedMessage());
16491666
printUsage(cmd);
16501667
} catch (RemoteException e) {
1668+
LOG.debug("Error", e);
16511669
//
16521670
// This is a error returned by hadoop server. Print
16531671
// out the first line of the error mesage, ignore the stack trace.
@@ -1662,13 +1680,15 @@ public int run(String argv[]) throws Exception {
16621680
ex.getLocalizedMessage());
16631681
}
16641682
} catch (IOException e) {
1683+
LOG.debug("Error", e);
16651684
//
16661685
// IO exception encountered locally.
16671686
//
16681687
exitCode = -1;
16691688
System.err.println(cmd.substring(1) + ": " +
16701689
e.getLocalizedMessage());
16711690
} catch (Exception re) {
1691+
LOG.debug("Error", re);
16721692
exitCode = -1;
16731693
System.err.println(cmd.substring(1) + ": " + re.getLocalizedMessage());
16741694
} finally {

src/java/org/apache/hadoop/fs/FsShellPermissions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.regex.Matcher;
2222
import java.util.regex.Pattern;
2323

24+
import org.apache.commons.logging.Log;
2425
import org.apache.hadoop.classification.InterfaceAudience;
2526
import org.apache.hadoop.classification.InterfaceStability;
2627
import org.apache.hadoop.fs.FsShell.CmdHandler;
@@ -35,6 +36,8 @@
3536
@InterfaceAudience.Private
3637
@InterfaceStability.Unstable
3738
class FsShellPermissions {
39+
40+
static Log LOG = FsShell.LOG;
3841

3942
/*========== chmod ==========*/
4043

@@ -75,6 +78,7 @@ public void run(FileStatus file, FileSystem srcFs) throws IOException {
7578
srcFs.setPermission(file.getPath(),
7679
new FsPermission((short)newperms));
7780
} catch (IOException e) {
81+
LOG.debug("Error changing permissions of " + file.getPath(), e);
7882
System.err.println(getName() + ": changing permissions of '" +
7983
file.getPath() + "':" + e.getMessage());
8084
}
@@ -133,6 +137,7 @@ public void run(FileStatus file, FileSystem srcFs) throws IOException {
133137
try {
134138
srcFs.setOwner(file.getPath(), newOwner, newGroup);
135139
} catch (IOException e) {
140+
LOG.debug("Error changing ownership of " + file.getPath(), e);
136141
System.err.println(getName() + ": changing ownership of '" +
137142
file.getPath() + "':" + e.getMessage());
138143

0 commit comments

Comments
 (0)