MAPREDUCE-6354. ShuffleHandler should be able to log shuffle connections. Contributed by Chang Li

This commit is contained in:
Jason Lowe 2015-06-05 22:38:31 +00:00
parent 3841d09765
commit b3ffa87003
3 changed files with 29 additions and 10 deletions

View File

@ -203,6 +203,11 @@ log4j.appender.JSA.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
log4j.logger.org.apache.hadoop.mapred.JobInProgress$JobSummary=${hadoop.mapreduce.jobsummary.logger} log4j.logger.org.apache.hadoop.mapred.JobInProgress$JobSummary=${hadoop.mapreduce.jobsummary.logger}
log4j.additivity.org.apache.hadoop.mapred.JobInProgress$JobSummary=false log4j.additivity.org.apache.hadoop.mapred.JobInProgress$JobSummary=false
#
# shuffle connection log from shuffleHandler
# Uncomment the following line to enable logging of shuffle connections
# log4j.logger.org.apache.hadoop.mapred.ShuffleHandler.audit=DEBUG
# #
# Yarn ResourceManager Application Summary Log # Yarn ResourceManager Application Summary Log
# #

View File

@ -340,6 +340,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6383. Pi job (QuasiMonteCarlo) should not try to read the MAPREDUCE-6383. Pi job (QuasiMonteCarlo) should not try to read the
results file if its job fails. (Harsh J via devaraj) results file if its job fails. (Harsh J via devaraj)
MAPREDUCE-6354. ShuffleHandler should be able to log shuffle connections
(Chang Li via jlowe)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -136,7 +136,8 @@ import com.google.protobuf.ByteString;
public class ShuffleHandler extends AuxiliaryService { public class ShuffleHandler extends AuxiliaryService {
private static final Log LOG = LogFactory.getLog(ShuffleHandler.class); private static final Log LOG = LogFactory.getLog(ShuffleHandler.class);
private static final Log AUDITLOG =
LogFactory.getLog(ShuffleHandler.class.getName()+".audit");
public static final String SHUFFLE_MANAGE_OS_CACHE = "mapreduce.shuffle.manage.os.cache"; public static final String SHUFFLE_MANAGE_OS_CACHE = "mapreduce.shuffle.manage.os.cache";
public static final boolean DEFAULT_SHUFFLE_MANAGE_OS_CACHE = true; public static final boolean DEFAULT_SHUFFLE_MANAGE_OS_CACHE = true;
@ -751,6 +752,14 @@ public class ShuffleHandler extends AuxiliaryService {
sendError(ctx, "Too many job/reduce parameters", BAD_REQUEST); sendError(ctx, "Too many job/reduce parameters", BAD_REQUEST);
return; return;
} }
// this audit log is disabled by default,
// to turn it on please enable this audit log
// on log4j.properties by uncommenting the setting
if (AUDITLOG.isDebugEnabled()) {
AUDITLOG.debug("shuffle for " + jobQ.get(0) +
" reducer " + reduceQ.get(0));
}
int reduceId; int reduceId;
String jobId; String jobId;
try { try {
@ -897,7 +906,9 @@ public class ShuffleHandler extends AuxiliaryService {
protected void setResponseHeaders(HttpResponse response, protected void setResponseHeaders(HttpResponse response,
boolean keepAliveParam, long contentLength) { boolean keepAliveParam, long contentLength) {
if (!connectionKeepAliveEnabled && !keepAliveParam) { if (!connectionKeepAliveEnabled && !keepAliveParam) {
LOG.info("Setting connection close header..."); if (LOG.isDebugEnabled()) {
LOG.debug("Setting connection close header...");
}
response.setHeader(HttpHeaders.CONNECTION, CONNECTION_CLOSE); response.setHeader(HttpHeaders.CONNECTION, CONNECTION_CLOSE);
} else { } else {
response.setHeader(HttpHeaders.CONTENT_LENGTH, response.setHeader(HttpHeaders.CONTENT_LENGTH,