YARN-4095. Avoid sharing AllocatorPerContext object in LocalDirAllocator between ShuffleHandler and LocalDirsHandlerService. Contributed by Zhihai Xu
(cherry picked from commit c890c51a91
)
This commit is contained in:
parent
017dff9877
commit
c829be5133
|
@ -408,6 +408,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12428. Fix inconsistency between log-level guards and statements.
|
HADOOP-12428. Fix inconsistency between log-level guards and statements.
|
||||||
(Jagadesh Kiran N and Jackie Chang via ozawa)
|
(Jagadesh Kiran N and Jackie Chang via ozawa)
|
||||||
|
|
||||||
|
YARN-4095. Avoid sharing AllocatorPerContext object in LocalDirAllocator
|
||||||
|
between ShuffleHandler and LocalDirsHandlerService. (Zhihai Xu via jlowe)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.TimerTask;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileContext;
|
import org.apache.hadoop.fs.FileContext;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
|
@ -52,6 +53,22 @@ public class LocalDirsHandlerService extends AbstractService {
|
||||||
|
|
||||||
private static Log LOG = LogFactory.getLog(LocalDirsHandlerService.class);
|
private static Log LOG = LogFactory.getLog(LocalDirsHandlerService.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Good local directories, use internally,
|
||||||
|
* initial value is the same as NM_LOCAL_DIRS.
|
||||||
|
*/
|
||||||
|
@Private
|
||||||
|
static final String NM_GOOD_LOCAL_DIRS =
|
||||||
|
YarnConfiguration.NM_PREFIX + "good-local-dirs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Good log directories, use internally,
|
||||||
|
* initial value is the same as NM_LOG_DIRS.
|
||||||
|
*/
|
||||||
|
@Private
|
||||||
|
static final String NM_GOOD_LOG_DIRS =
|
||||||
|
YarnConfiguration.NM_PREFIX + "good-log-dirs";
|
||||||
|
|
||||||
/** Timer used to schedule disk health monitoring code execution */
|
/** Timer used to schedule disk health monitoring code execution */
|
||||||
private Timer dirsHandlerScheduler;
|
private Timer dirsHandlerScheduler;
|
||||||
private long diskHealthCheckInterval;
|
private long diskHealthCheckInterval;
|
||||||
|
@ -113,9 +130,17 @@ public class LocalDirsHandlerService extends AbstractService {
|
||||||
new DirectoryCollection(
|
new DirectoryCollection(
|
||||||
validatePaths(conf.getTrimmedStrings(YarnConfiguration.NM_LOG_DIRS)),
|
validatePaths(conf.getTrimmedStrings(YarnConfiguration.NM_LOG_DIRS)),
|
||||||
maxUsableSpacePercentagePerDisk, minFreeSpacePerDiskMB);
|
maxUsableSpacePercentagePerDisk, minFreeSpacePerDiskMB);
|
||||||
|
|
||||||
|
String local = conf.get(YarnConfiguration.NM_LOCAL_DIRS);
|
||||||
|
conf.set(NM_GOOD_LOCAL_DIRS,
|
||||||
|
(local != null) ? local : "");
|
||||||
localDirsAllocator = new LocalDirAllocator(
|
localDirsAllocator = new LocalDirAllocator(
|
||||||
YarnConfiguration.NM_LOCAL_DIRS);
|
NM_GOOD_LOCAL_DIRS);
|
||||||
logDirsAllocator = new LocalDirAllocator(YarnConfiguration.NM_LOG_DIRS);
|
String log = conf.get(YarnConfiguration.NM_LOG_DIRS);
|
||||||
|
conf.set(NM_GOOD_LOG_DIRS,
|
||||||
|
(log != null) ? log : "");
|
||||||
|
logDirsAllocator = new LocalDirAllocator(
|
||||||
|
NM_GOOD_LOG_DIRS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -373,10 +398,10 @@ public class LocalDirsHandlerService extends AbstractService {
|
||||||
|
|
||||||
Configuration conf = getConfig();
|
Configuration conf = getConfig();
|
||||||
List<String> localDirs = getLocalDirs();
|
List<String> localDirs = getLocalDirs();
|
||||||
conf.setStrings(YarnConfiguration.NM_LOCAL_DIRS,
|
conf.setStrings(NM_GOOD_LOCAL_DIRS,
|
||||||
localDirs.toArray(new String[localDirs.size()]));
|
localDirs.toArray(new String[localDirs.size()]));
|
||||||
List<String> logDirs = getLogDirs();
|
List<String> logDirs = getLogDirs();
|
||||||
conf.setStrings(YarnConfiguration.NM_LOG_DIRS,
|
conf.setStrings(NM_GOOD_LOG_DIRS,
|
||||||
logDirs.toArray(new String[logDirs.size()]));
|
logDirs.toArray(new String[logDirs.size()]));
|
||||||
if (!areDisksHealthy()) {
|
if (!areDisksHealthy()) {
|
||||||
// Just log.
|
// Just log.
|
||||||
|
|
|
@ -120,6 +120,15 @@ public class TestLocalDirsHandlerService {
|
||||||
Assert.assertEquals(0, nm.getGoodLocalDirsDiskUtilizationPerc());
|
Assert.assertEquals(0, nm.getGoodLocalDirsDiskUtilizationPerc());
|
||||||
Assert.assertEquals(0, nm.getGoodLogDirsDiskUtilizationPerc());
|
Assert.assertEquals(0, nm.getGoodLogDirsDiskUtilizationPerc());
|
||||||
|
|
||||||
|
Assert.assertEquals("",
|
||||||
|
dirSvc.getConfig().get(LocalDirsHandlerService.NM_GOOD_LOCAL_DIRS));
|
||||||
|
Assert.assertEquals("",
|
||||||
|
dirSvc.getConfig().get(LocalDirsHandlerService.NM_GOOD_LOG_DIRS));
|
||||||
|
Assert.assertEquals(localDir1 + "," + localDir2,
|
||||||
|
dirSvc.getConfig().get(YarnConfiguration.NM_LOCAL_DIRS));
|
||||||
|
Assert.assertEquals(logDir1 + "," + logDir2,
|
||||||
|
dirSvc.getConfig().get(YarnConfiguration.NM_LOG_DIRS));
|
||||||
|
|
||||||
conf.setFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
|
conf.setFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
|
||||||
100.0f);
|
100.0f);
|
||||||
nm = NodeManagerMetrics.create();
|
nm = NodeManagerMetrics.create();
|
||||||
|
@ -141,6 +150,15 @@ public class TestLocalDirsHandlerService {
|
||||||
Assert
|
Assert
|
||||||
.assertEquals(utilizationPerc, nm.getGoodLogDirsDiskUtilizationPerc());
|
.assertEquals(utilizationPerc, nm.getGoodLogDirsDiskUtilizationPerc());
|
||||||
|
|
||||||
|
Assert.assertEquals(localDir2,
|
||||||
|
dirSvc.getConfig().get(LocalDirsHandlerService.NM_GOOD_LOCAL_DIRS));
|
||||||
|
Assert.assertEquals(logDir2,
|
||||||
|
dirSvc.getConfig().get(LocalDirsHandlerService.NM_GOOD_LOG_DIRS));
|
||||||
|
Assert.assertEquals(localDir1 + "," + localDir2,
|
||||||
|
dirSvc.getConfig().get(YarnConfiguration.NM_LOCAL_DIRS));
|
||||||
|
Assert.assertEquals(logDir1 + "," + logDir2,
|
||||||
|
dirSvc.getConfig().get(YarnConfiguration.NM_LOG_DIRS));
|
||||||
|
|
||||||
FileUtils.deleteDirectory(new File(localDir1));
|
FileUtils.deleteDirectory(new File(localDir1));
|
||||||
FileUtils.deleteDirectory(new File(localDir2));
|
FileUtils.deleteDirectory(new File(localDir2));
|
||||||
FileUtils.deleteDirectory(new File(logDir1));
|
FileUtils.deleteDirectory(new File(logDir1));
|
||||||
|
|
Loading…
Reference in New Issue