HDFS-3666. Plumb more exception messages to terminate. Contributed by Eli Collins
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1362270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1c5e7dd2b
commit
527933f4f3
@ -84,10 +84,20 @@ public static void terminate(int status, String msg) throws ExitException {
|
||||
System.exit(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link terminate(int, String)} but takes an exception to
|
||||
* @param status
|
||||
* @param t Exception
|
||||
* @throws ExitException if System.exit is disabled for test purposes
|
||||
*/
|
||||
public static void terminate(int status, Throwable t) throws ExitException {
|
||||
terminate(status, t.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link terminate(int, String)} without a message.
|
||||
* @param status
|
||||
* @throws ExitException
|
||||
* @throws ExitException if System.exit is disabled for test purposes
|
||||
*/
|
||||
public static void terminate(int status) throws ExitException {
|
||||
terminate(status, "ExitException");
|
||||
|
@ -341,6 +341,8 @@ Branch-2 ( Unreleased changes )
|
||||
|
||||
HDFS-3665. Add a test for renaming across file systems via a symlink. (eli)
|
||||
|
||||
HDFS-3666. Plumb more exception messages to terminate. (eli)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HDFS-2982. Startup performance suffers when there are many edit log
|
||||
|
@ -2967,7 +2967,7 @@ public void run() {
|
||||
break;
|
||||
} catch (Throwable t) {
|
||||
LOG.fatal("ReplicationMonitor thread received Runtime exception. ", t);
|
||||
terminate(1);
|
||||
terminate(1, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1704,7 +1704,7 @@ public static void secureMain(String args[], SecureResources resources) {
|
||||
datanode.join();
|
||||
} catch (Throwable e) {
|
||||
LOG.fatal("Exception in secureMain", e);
|
||||
terminate(1);
|
||||
terminate(1, e);
|
||||
} finally {
|
||||
// We need to terminate the process here because either shutdown was called
|
||||
// or some disk related conditions like volumes tolerated or volumes required
|
||||
|
@ -545,8 +545,9 @@ public void logSync() {
|
||||
editLogStream.setReadyToFlush();
|
||||
} catch (IOException e) {
|
||||
final String msg =
|
||||
"Could not sync enough journals to persistent storage. "
|
||||
+ "Unsynced transactions: " + (txid - synctxid);
|
||||
"Could not sync enough journals to persistent storage " +
|
||||
"due to " + e.getMessage() + ". " +
|
||||
"Unsynced transactions: " + (txid - synctxid);
|
||||
LOG.fatal(msg, new Exception());
|
||||
terminate(1, msg);
|
||||
}
|
||||
|
@ -1195,7 +1195,7 @@ public static void main(String argv[]) throws Exception {
|
||||
namenode.join();
|
||||
} catch (Throwable e) {
|
||||
LOG.fatal("Exception in namenode join", e);
|
||||
terminate(1);
|
||||
terminate(1, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1283,7 +1283,7 @@ private synchronized void doImmediateShutdown(Throwable t)
|
||||
} catch (Throwable ignored) {
|
||||
// This is unlikely to happen, but there's nothing we can do if it does.
|
||||
}
|
||||
terminate(1, t.getMessage());
|
||||
terminate(1, t);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,7 +330,7 @@ public void doWork() {
|
||||
} catch (Throwable e) {
|
||||
LOG.fatal("Throwable Exception in doCheckpoint", e);
|
||||
e.printStackTrace();
|
||||
terminate(1);
|
||||
terminate(1, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ private void doWork() {
|
||||
} catch (Throwable t) {
|
||||
LOG.fatal("Unknown error encountered while tailing edits. " +
|
||||
"Shutting down standby NN.", t);
|
||||
terminate(1, t.getMessage());
|
||||
terminate(1, t);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -125,7 +125,8 @@ public void testAllEditsDirFailOnWrite() throws IOException {
|
||||
} catch (RemoteException re) {
|
||||
assertTrue(re.getClassName().contains("ExitException"));
|
||||
GenericTestUtils.assertExceptionContains(
|
||||
"Could not sync enough journals to persistent storage. " +
|
||||
"Could not sync enough journals to persistent storage due to " +
|
||||
"No journals available to flush. " +
|
||||
"Unsynced transactions: 1", re);
|
||||
}
|
||||
}
|
||||
@ -227,7 +228,8 @@ public void testMultipleRedundantFailedEditsDirOnSetReadyToFlush()
|
||||
} catch (RemoteException re) {
|
||||
assertTrue(re.getClassName().contains("ExitException"));
|
||||
GenericTestUtils.assertExceptionContains(
|
||||
"Could not sync enough journals to persistent storage. " +
|
||||
"Could not sync enough journals to persistent storage due to " +
|
||||
"setReadyToFlush failed for too many journals. " +
|
||||
"Unsynced transactions: 1", re);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user