HDFS-5562. TestCacheDirectives and TestFsDatasetCache should stub out native mlock. Contributed by Colin Patrick McCabe and Akira Ajisaka.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1546246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Wang 2013-11-28 00:44:54 +00:00
parent 5ea533c2bf
commit bb11d47758
4 changed files with 15 additions and 3 deletions

View File

@ -142,6 +142,10 @@ public void posixFadviseIfPossible(String identifier,
NativeIO.POSIX.posixFadviseIfPossible(identifier, fd, offset, NativeIO.POSIX.posixFadviseIfPossible(identifier, fd, offset,
len, flags); len, flags);
} }
public boolean verifyCanMlock() {
return NativeIO.isAvailable();
}
} }
/** /**
@ -163,6 +167,10 @@ public long getMemlockLimit() {
public long getOperatingSystemPageSize() { public long getOperatingSystemPageSize() {
return 4096; return 4096;
} }
public boolean verifyCanMlock() {
return true;
}
} }
static { static {

View File

@ -416,6 +416,9 @@ Trunk (Unreleased)
HDFS-5565. CacheAdmin help should match against non-dashed commands HDFS-5565. CacheAdmin help should match against non-dashed commands
(wang via cmccabe) (wang via cmccabe)
HDFS-5562. TestCacheDirectives and TestFsDatasetCache should stub out
native mlock. (Colin McCabe and Akira Ajisaka via wang)
Release 2.3.0 - UNRELEASED Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -673,7 +673,7 @@ void startDataNode(Configuration conf,
this.dnConf = new DNConf(conf); this.dnConf = new DNConf(conf);
if (dnConf.maxLockedMemory > 0) { if (dnConf.maxLockedMemory > 0) {
if (!NativeIO.isAvailable()) { if (!NativeIO.POSIX.getCacheManipulator().verifyCanMlock()) {
throw new RuntimeException(String.format( throw new RuntimeException(String.format(
"Cannot start datanode because the configured max locked memory" + "Cannot start datanode because the configured max locked memory" +
" size (%s) is greater than zero and native code is not available.", " size (%s) is greater than zero and native code is not available.",

View File

@ -113,6 +113,9 @@ public void setUp() throws Exception {
conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1);
conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_CACHING_ENABLED_KEY, true); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_CACHING_ENABLED_KEY, true);
prevCacheManipulator = NativeIO.POSIX.getCacheManipulator();
NativeIO.POSIX.setCacheManipulator(new NoMlockCacheManipulator());
cluster = new MiniDFSCluster.Builder(conf) cluster = new MiniDFSCluster.Builder(conf)
.numDataNodes(1).build(); .numDataNodes(1).build();
cluster.waitActive(); cluster.waitActive();
@ -125,8 +128,6 @@ public void setUp() throws Exception {
spyNN = DataNodeTestUtils.spyOnBposToNN(dn, nn); spyNN = DataNodeTestUtils.spyOnBposToNN(dn, nn);
prevCacheManipulator = NativeIO.POSIX.getCacheManipulator();
NativeIO.POSIX.setCacheManipulator(new NoMlockCacheManipulator());
} }
@After @After