From d023d52062c5c2c2342db167b8a14adbc1368ec8 Mon Sep 17 00:00:00 2001 From: Sanford Ryza Date: Fri, 1 Nov 2013 08:55:05 +0000 Subject: [PATCH] MAPREDUCE-5601. ShuffleHandler fadvises file regions as DONTNEED even when fetch fails (Sandy Ryza) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1537856 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/mapred/FadvisedFileRegion.java | 9 ++++++++- .../java/org/apache/hadoop/mapred/ShuffleHandler.java | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index b59c5d4be4d..325a0def1a5 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -34,6 +34,9 @@ Release 2.3.0 - UNRELEASED MAPREDUCE-5487. In task processes, JobConf is unnecessarily loaded again in Limits (Sandy Ryza) + MAPREDUCE-5601. ShuffleHandler fadvises file regions as DONTNEED even when + fetch fails (Sandy Ryza) + BUG FIXES MAPREDUCE-5316. job -list-attempt-ids command does not handle illegal diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/FadvisedFileRegion.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/FadvisedFileRegion.java index aaf49b57710..20b2bf479dc 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/FadvisedFileRegion.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/FadvisedFileRegion.java @@ -69,6 +69,14 @@ public class FadvisedFileRegion extends DefaultFileRegion { if (readaheadRequest != null) { readaheadRequest.cancel(); } + super.releaseExternalResources(); + } + + /** + * Call when the transfer completes successfully so we can advise the OS that + * we don't need the region to be cached anymore. + */ + public void transferSuccessful() { if (manageOsCache && getCount() > 0) { try { NativeIO.POSIX.posixFadviseIfPossible(identifier, @@ -78,6 +86,5 @@ public class FadvisedFileRegion extends DefaultFileRegion { LOG.warn("Failed to manage OS cache for " + identifier, t); } } - super.releaseExternalResources(); } } 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 9f377e23ac0..f9f924bd243 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 @@ -625,6 +625,9 @@ public class ShuffleHandler extends AuxiliaryService { // attribute to appropriate spill output @Override public void operationComplete(ChannelFuture future) { + if (future.isSuccess()) { + partition.transferSuccessful(); + } partition.releaseExternalResources(); } });