Revert "HDFS-10668. Fix intermittently failing UT TestDataNodeMXBean#testDataNodeMXBeanBlockCount. Contributed by Mingliang Liu."
This reverts commit 32468b1ba5
.
This commit is contained in:
parent
6b5d546014
commit
7921ad949f
|
@ -25,13 +25,11 @@ import java.util.Map;
|
||||||
import javax.management.MBeanServer;
|
import javax.management.MBeanServer;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hdfs.DFSTestUtil;
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mortbay.util.ajax.JSON;
|
import org.mortbay.util.ajax.JSON;
|
||||||
|
@ -115,18 +113,10 @@ public class TestDataNodeMXBean {
|
||||||
cluster.waitActive();
|
cluster.waitActive();
|
||||||
assertEquals("After restart DN", 5, getTotalNumBlocks(mbs, mxbeanName));
|
assertEquals("After restart DN", 5, getTotalNumBlocks(mbs, mxbeanName));
|
||||||
fs.delete(new Path("/tmp.txt1"), true);
|
fs.delete(new Path("/tmp.txt1"), true);
|
||||||
// The total numBlocks should be updated after one file is deleted
|
// Wait till replica gets deleted on disk.
|
||||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
Thread.sleep(5000);
|
||||||
@Override
|
assertEquals("After delete one file", 4,
|
||||||
public Boolean get() {
|
getTotalNumBlocks(mbs, mxbeanName));
|
||||||
try {
|
|
||||||
return getTotalNumBlocks(mbs, mxbeanName) == 4;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100, 30000);
|
|
||||||
} finally {
|
} finally {
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
|
@ -135,7 +125,7 @@ public class TestDataNodeMXBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private int getTotalNumBlocks(MBeanServer mbs, ObjectName mxbeanName)
|
int getTotalNumBlocks(MBeanServer mbs, ObjectName mxbeanName)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
int totalBlocks = 0;
|
int totalBlocks = 0;
|
||||||
String volumeInfo = (String) mbs.getAttribute(mxbeanName, "VolumeInfo");
|
String volumeInfo = (String) mbs.getAttribute(mxbeanName, "VolumeInfo");
|
||||||
|
|
Loading…
Reference in New Issue