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
This commit is contained in:
Aaron Myers 2012-08-21 00:48:06 +00:00
parent 643608ea57
commit f9a0d78ef5
3 changed files with 9 additions and 4 deletions

View File

@ -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-3800. improvements to QJM fault testing (todd)
HDFS-3823. QJM: TestQJMWithFaults fails occasionally because of missed setting of HTTP port. (todd and atm) 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)

View File

@ -51,12 +51,14 @@ class QuorumException extends IOException {
msg.append(simpleMsg).append(". "); msg.append(simpleMsg).append(". ");
if (!successes.isEmpty()) { if (!successes.isEmpty()) {
msg.append(successes.size()).append(" successful responses:\n"); msg.append(successes.size()).append(" successful responses:\n");
Joiner.on("\n") Joiner.on("\n")
.useForNull("null") .useForNull("null [success]")
.withKeyValueSeparator(": ") .withKeyValueSeparator(": ")
.appendTo(msg, successes); .appendTo(msg, successes);
msg.append("\n"); msg.append("\n");
} }
msg.append(exceptions.size() + " exceptions thrown:\n"); msg.append(exceptions.size() + " exceptions thrown:\n");
boolean isFirst = true; boolean isFirst = true;
@ -70,8 +72,10 @@ class QuorumException extends IOException {
if (e.getValue() instanceof RuntimeException) { if (e.getValue() instanceof RuntimeException) {
msg.append(StringUtils.stringifyException(e.getValue())); msg.append(StringUtils.stringifyException(e.getValue()));
} else { } else if (e.getValue().getLocalizedMessage() != null) {
msg.append(e.getValue().getLocalizedMessage()); msg.append(e.getValue().getLocalizedMessage());
} else {
msg.append(StringUtils.stringifyException(e.getValue()));
} }
} }
return new QuorumException(msg.toString()); return new QuorumException(msg.toString());

View File

@ -209,7 +209,7 @@ public class QuorumJournalManager implements JournalManager {
loggers.prepareRecovery(segmentTxId); loggers.prepareRecovery(segmentTxId);
Map<AsyncLogger, PrepareRecoveryResponseProto> prepareResponses= Map<AsyncLogger, PrepareRecoveryResponseProto> prepareResponses=
loggers.waitForWriteQuorum(prepare, prepareRecoveryTimeoutMs); loggers.waitForWriteQuorum(prepare, prepareRecoveryTimeoutMs);
LOG.info("Recovery prepare phase complete. Responses: " + LOG.info("Recovery prepare phase complete. Responses:\n" +
QuorumCall.mapToString(prepareResponses)); QuorumCall.mapToString(prepareResponses));
// Determine the logger who either: // Determine the logger who either:
@ -434,7 +434,6 @@ public class QuorumJournalManager implements JournalManager {
for (RemoteEditLog remoteLog : manifest.getLogs()) { for (RemoteEditLog remoteLog : manifest.getLogs()) {
URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId()); URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId());
LOG.info("URL: " + url);
EditLogInputStream elis = EditLogFileInputStream.fromUrl( EditLogInputStream elis = EditLogFileInputStream.fromUrl(
url, remoteLog.getStartTxId(), remoteLog.getEndTxId(), url, remoteLog.getStartTxId(), remoteLog.getEndTxId(),