From eac1d1894354e90d314087af8e7fb168ddef9a3d Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Wed, 1 Jul 2015 18:01:22 +0000 Subject: [PATCH] MAPREDUCE-6418. MRApp should not shutdown LogManager during shutdown. Contributed by Chang Li --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../hadoop/mapreduce/v2/app/MRAppMaster.java | 14 +++++++++++--- .../org/apache/hadoop/mapreduce/v2/app/MRApp.java | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index dd9da7e812..2f806154ac 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -527,6 +527,9 @@ Release 2.8.0 - UNRELEASED MAPREDUCE-6420. Interrupted Exception in LocalContainerLauncher should be logged in warn/info level (Chang Li via jlowe) + MAPREDUCE-6418. MRApp should not shutdown LogManager during shutdown + (Chang Li via jlowe) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java index 0d3519b1c6..f199ecbbfe 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java @@ -1197,11 +1197,15 @@ protected void serviceStart() throws Exception { startJobs(); } } - + + protected void shutdownTaskLog() { + TaskLog.syncLogsShutdown(logSyncer); + } + @Override public void stop() { super.stop(); - TaskLog.syncLogsShutdown(logSyncer); + shutdownTaskLog(); } private boolean isRecoverySupported() throws IOException { @@ -1705,10 +1709,14 @@ private static interface ExceptionAction { T call(Configuration conf) throws Exception; } + protected void shutdownLogManager() { + LogManager.shutdown(); + } + @Override protected void serviceStop() throws Exception { super.serviceStop(); - LogManager.shutdown(); + shutdownLogManager(); } public ClientService getClientService() { diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java index 4fe4c44206..b51adf2889 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java @@ -804,5 +804,20 @@ public static ContainerTokenIdentifier newContainerTokenIdentifier( new Text(containerToken.getService())); return token.decodeIdentifier(); } + + @Override + protected void shutdownTaskLog() { + // Avoid closing the logging system during unit tests, + // otherwise subsequent MRApp instances in the same test + // will fail to log anything. + } + + @Override + protected void shutdownLogManager() { + // Avoid closing the logging system during unit tests, + // otherwise subsequent MRApp instances in the same test + // will fail to log anything. + } + }