Skip to content

Commit

Permalink
Revert "HDFS-10668. Fix intermittently failing UT TestDataNodeMXBean#…
Browse files Browse the repository at this point in the history
…testDataNodeMXBeanBlockCount. Contributed by Mingliang Liu."

This reverts commit 7cac765.
  • Loading branch information
steveloughran committed Jul 26, 2016
1 parent 7cac765 commit 2aa18e1
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;

import com.google.common.base.Supplier;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.test.GenericTestUtils;
import org.junit.Assert;
import org.junit.Test;
import org.mortbay.util.ajax.JSON;
Expand Down Expand Up @@ -121,18 +119,10 @@ public void testDataNodeMXBeanBlockCount() throws Exception {
cluster.waitActive();
assertEquals("After restart DN", 5, getTotalNumBlocks(mbs, mxbeanName));
fs.delete(new Path("/tmp.txt1"), true);
// The total numBlocks should be updated after one file is deleted
GenericTestUtils.waitFor(new Supplier<Boolean>() {
@Override
public Boolean get() {
try {
return getTotalNumBlocks(mbs, mxbeanName) == 4;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}, 100, 30000);
// Wait till replica gets deleted on disk.
Thread.sleep(5000);
assertEquals("After delete one file", 4,
getTotalNumBlocks(mbs, mxbeanName));
} finally {
if (cluster != null) {
cluster.shutdown();
Expand All @@ -141,7 +131,7 @@ public Boolean get() {
}

@SuppressWarnings("unchecked")
private int getTotalNumBlocks(MBeanServer mbs, ObjectName mxbeanName)
int getTotalNumBlocks(MBeanServer mbs, ObjectName mxbeanName)
throws Exception {
int totalBlocks = 0;
String volumeInfo = (String) mbs.getAttribute(mxbeanName, "VolumeInfo");
Expand Down

0 comments on commit 2aa18e1

Please sign in to comment.