From ab2bc90e090564b7466ab1b759fbb849612ae82b Mon Sep 17 00:00:00 2001 From: zhengchenyu Date: Fri, 15 Sep 2023 20:50:11 +0800 Subject: [PATCH] MAPREDUCE-7453. Container logs are missing when yarn.app.container.log.filesize is set to default value 0. (#6042) Contributed by Chenyu Zheng. Reviewed-by: Shilun Fan Signed-off-by: Shilun Fan --- .../src/main/java/org/apache/hadoop/mapred/TaskLog.java | 3 ++- .../main/java/org/apache/hadoop/mapreduce/MRJobConfig.java | 6 ++++-- .../src/main/resources/mapred-default.xml | 7 +++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java index a0223dedd6..fdfa3e7710 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLog.java @@ -466,7 +466,8 @@ public static long getTaskLogLength(JobConf conf) { } public static long getTaskLogLimitBytes(Configuration conf) { - return conf.getLong(JobContext.TASK_USERLOG_LIMIT, 0) * 1024; + return conf.getLong(JobContext.TASK_USERLOG_LIMIT, JobContext.DEFAULT_TASK_USERLOG_LIMIT) * + 1024; } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java index 8ec984e777..24689e09da 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java @@ -410,6 +410,8 @@ public interface MRJobConfig { public static final String TASK_USERLOG_LIMIT = "mapreduce.task.userlog.limit.kb"; + public static final int DEFAULT_TASK_USERLOG_LIMIT = 10240; + public static final String MAP_SORT_SPILL_PERCENT = "mapreduce.map.sort.spill.percent"; public static final String MAP_INPUT_FILE = "mapreduce.map.input.file"; @@ -758,11 +760,11 @@ public interface MRJobConfig { public static final String MR_AM_LOG_KB = MR_AM_PREFIX + "container.log.limit.kb"; - public static final int DEFAULT_MR_AM_LOG_KB = 0; // don't roll + public static final int DEFAULT_MR_AM_LOG_KB = 10240; public static final String MR_AM_LOG_BACKUPS = MR_AM_PREFIX + "container.log.backups"; - public static final int DEFAULT_MR_AM_LOG_BACKUPS = 0; + public static final int DEFAULT_MR_AM_LOG_BACKUPS = 0; // don't roll /**The number of splits when reporting progress in MR*/ public static final String MR_AM_NUM_PROGRESS_SPLITS = diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml index a6d68acda3..493e4c3a37 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml @@ -823,16 +823,15 @@ mapreduce.task.userlog.limit.kb - 0 - The maximum size of user-logs of each task in KB. 0 disables the cap. + 10240 + The maximum size of user-logs of each task in KB. yarn.app.mapreduce.am.container.log.limit.kb - 0 + 10240 The maximum size of the MRAppMaster attempt container logs in KB. - 0 disables the cap.