|
@@ -63,6 +63,7 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
+import static org.apache.hadoop.util.Shell.getMemlockLimit;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertNotNull;
|
|
import static org.junit.Assert.assertNotNull;
|
|
import static org.junit.Assert.assertNull;
|
|
import static org.junit.Assert.assertNull;
|
|
@@ -91,8 +92,10 @@ public class TestNameNodeMXBean {
|
|
@Test
|
|
@Test
|
|
public void testNameNodeMXBeanInfo() throws Exception {
|
|
public void testNameNodeMXBeanInfo() throws Exception {
|
|
Configuration conf = new Configuration();
|
|
Configuration conf = new Configuration();
|
|
|
|
+ Long maxLockedMemory = getMemlockLimit(
|
|
|
|
+ NativeIO.POSIX.getCacheManipulator().getMemlockLimit());
|
|
conf.setLong(DFSConfigKeys.DFS_DATANODE_MAX_LOCKED_MEMORY_KEY,
|
|
conf.setLong(DFSConfigKeys.DFS_DATANODE_MAX_LOCKED_MEMORY_KEY,
|
|
- NativeIO.POSIX.getCacheManipulator().getMemlockLimit());
|
|
|
|
|
|
+ maxLockedMemory);
|
|
MiniDFSCluster cluster = null;
|
|
MiniDFSCluster cluster = null;
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -244,7 +247,7 @@ public class TestNameNodeMXBean {
|
|
assertEquals(1, statusMap.get("active").size());
|
|
assertEquals(1, statusMap.get("active").size());
|
|
assertEquals(1, statusMap.get("failed").size());
|
|
assertEquals(1, statusMap.get("failed").size());
|
|
assertEquals(0L, mbs.getAttribute(mxbeanName, "CacheUsed"));
|
|
assertEquals(0L, mbs.getAttribute(mxbeanName, "CacheUsed"));
|
|
- assertEquals(NativeIO.POSIX.getCacheManipulator().getMemlockLimit() *
|
|
|
|
|
|
+ assertEquals(maxLockedMemory *
|
|
cluster.getDataNodes().size(),
|
|
cluster.getDataNodes().size(),
|
|
mbs.getAttribute(mxbeanName, "CacheCapacity"));
|
|
mbs.getAttribute(mxbeanName, "CacheCapacity"));
|
|
assertNull("RollingUpgradeInfo should be null when there is no rolling"
|
|
assertNull("RollingUpgradeInfo should be null when there is no rolling"
|