From 521f34317a2f94ea7e60f3d59db335cef3358e5b Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Wed, 20 Jul 2016 20:38:20 -0700 Subject: [PATCH] HADOOP-12928. Update netty to 3.10.5.Final to sync with zookeeper. (lei) --- .../apache/hadoop/mapred/ShuffleHandler.java | 30 +++++++++++-------- hadoop-project/pom.xml | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java index ed197f25cc..8721ef534c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java @@ -887,9 +887,12 @@ public void messageReceived(ChannelHandlerContext ctx, MessageEvent evt) } // Check whether the shuffle version is compatible if (!ShuffleHeader.DEFAULT_HTTP_HEADER_NAME.equals( - request.getHeader(ShuffleHeader.HTTP_HEADER_NAME)) + request.headers() != null ? + request.headers().get(ShuffleHeader.HTTP_HEADER_NAME) : null) || !ShuffleHeader.DEFAULT_HTTP_HEADER_VERSION.equals( - request.getHeader(ShuffleHeader.HTTP_HEADER_VERSION))) { + request.headers() != null ? + request.headers() + .get(ShuffleHeader.HTTP_HEADER_VERSION) : null)) { sendError(ctx, "Incompatible shuffle request version", BAD_REQUEST); } final Map> q = @@ -1117,12 +1120,12 @@ protected void setResponseHeaders(HttpResponse response, if (LOG.isDebugEnabled()) { LOG.debug("Setting connection close header..."); } - response.setHeader(HttpHeaders.CONNECTION, CONNECTION_CLOSE); + response.headers().set(HttpHeaders.CONNECTION, CONNECTION_CLOSE); } else { - response.setHeader(HttpHeaders.CONTENT_LENGTH, + response.headers().set(HttpHeaders.CONTENT_LENGTH, String.valueOf(contentLength)); - response.setHeader(HttpHeaders.CONNECTION, HttpHeaders.KEEP_ALIVE); - response.setHeader(HttpHeaders.KEEP_ALIVE, "timeout=" + response.headers().set(HttpHeaders.CONNECTION, HttpHeaders.KEEP_ALIVE); + response.headers().set(HttpHeaders.KEEP_ALIVE, "timeout=" + connectionKeepAliveTimeOut); LOG.info("Content Length in shuffle : " + contentLength); } @@ -1150,7 +1153,7 @@ protected void verifyRequest(String appid, ChannelHandlerContext ctx, String enc_str = SecureShuffleUtils.buildMsgFrom(requestUri); // hash from the fetcher String urlHashStr = - request.getHeader(SecureShuffleUtils.HTTP_HEADER_URL_HASH); + request.headers().get(SecureShuffleUtils.HTTP_HEADER_URL_HASH); if (urlHashStr == null) { LOG.info("Missing header hash for " + appid); throw new IOException("fetcher cannot be authenticated"); @@ -1166,11 +1169,12 @@ protected void verifyRequest(String appid, ChannelHandlerContext ctx, String reply = SecureShuffleUtils.generateHash(urlHashStr.getBytes(Charsets.UTF_8), tokenSecret); - response.setHeader(SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH, reply); + response.headers().set( + SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH, reply); // Put shuffle version into http header - response.setHeader(ShuffleHeader.HTTP_HEADER_NAME, + response.headers().set(ShuffleHeader.HTTP_HEADER_NAME, ShuffleHeader.DEFAULT_HTTP_HEADER_NAME); - response.setHeader(ShuffleHeader.HTTP_HEADER_VERSION, + response.headers().set(ShuffleHeader.HTTP_HEADER_VERSION, ShuffleHeader.DEFAULT_HTTP_HEADER_VERSION); if (LOG.isDebugEnabled()) { int len = reply.length(); @@ -1236,11 +1240,11 @@ protected void sendError(ChannelHandlerContext ctx, protected void sendError(ChannelHandlerContext ctx, String message, HttpResponseStatus status) { HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status); - response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8"); + response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); // Put shuffle version into http header - response.setHeader(ShuffleHeader.HTTP_HEADER_NAME, + response.headers().set(ShuffleHeader.HTTP_HEADER_NAME, ShuffleHeader.DEFAULT_HTTP_HEADER_NAME); - response.setHeader(ShuffleHeader.HTTP_HEADER_VERSION, + response.headers().set(ShuffleHeader.HTTP_HEADER_VERSION, ShuffleHeader.DEFAULT_HTTP_HEADER_VERSION); response.setContent( ChannelBuffers.copiedBuffer(message, CharsetUtil.UTF_8)); diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index df13d4aff9..a632bff925 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -635,7 +635,7 @@ io.netty netty - 3.6.2.Final + 3.10.5.Final