From f9a0d78ef5889bb1b9510ba15a1a780fcc9560fd Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Tue, 21 Aug 2012 00:48:06 +0000 Subject: [PATCH] HDFS-3826. QJM: Some trivial logging / exception text improvements. Contributed by Todd Lipcon and Aaron T. Myers. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-3077@1375356 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt | 2 ++ .../hadoop/hdfs/qjournal/client/QuorumException.java | 8 ++++++-- .../hadoop/hdfs/qjournal/client/QuorumJournalManager.java | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt index d2cf71efb69..ff7df1ac234 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt @@ -28,3 +28,5 @@ HDFS-3797. QJM: add segment txid as a parameter to journal() RPC (todd) HDFS-3800. improvements to QJM fault testing (todd) HDFS-3823. QJM: TestQJMWithFaults fails occasionally because of missed setting of HTTP port. (todd and atm) + +HDFS-3826. QJM: Some trivial logging / exception text improvements. (todd and atm) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java index f9a6efa38e4..446092ebe1c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumException.java @@ -51,12 +51,14 @@ class QuorumException extends IOException { msg.append(simpleMsg).append(". "); if (!successes.isEmpty()) { msg.append(successes.size()).append(" successful responses:\n"); + Joiner.on("\n") - .useForNull("null") + .useForNull("null [success]") .withKeyValueSeparator(": ") .appendTo(msg, successes); msg.append("\n"); } + msg.append(exceptions.size() + " exceptions thrown:\n"); boolean isFirst = true; @@ -70,8 +72,10 @@ class QuorumException extends IOException { if (e.getValue() instanceof RuntimeException) { msg.append(StringUtils.stringifyException(e.getValue())); - } else { + } else if (e.getValue().getLocalizedMessage() != null) { msg.append(e.getValue().getLocalizedMessage()); + } else { + msg.append(StringUtils.stringifyException(e.getValue())); } } return new QuorumException(msg.toString()); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java index a55a5580141..645efcdfe3d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java @@ -209,7 +209,7 @@ public class QuorumJournalManager implements JournalManager { loggers.prepareRecovery(segmentTxId); Map prepareResponses= loggers.waitForWriteQuorum(prepare, prepareRecoveryTimeoutMs); - LOG.info("Recovery prepare phase complete. Responses: " + + LOG.info("Recovery prepare phase complete. Responses:\n" + QuorumCall.mapToString(prepareResponses)); // Determine the logger who either: @@ -434,7 +434,6 @@ public class QuorumJournalManager implements JournalManager { for (RemoteEditLog remoteLog : manifest.getLogs()) { URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId()); - LOG.info("URL: " + url); EditLogInputStream elis = EditLogFileInputStream.fromUrl( url, remoteLog.getStartTxId(), remoteLog.getEndTxId(),