HBASE-5212 Fix test TestTableMapReduce against 0.23 (Ted and Gregory)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1239264 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-02-01 18:56:34 +00:00
parent 6bed2d07da
commit 8a6d0fbca1
4 changed files with 21 additions and 7 deletions

View File

@ -1847,6 +1847,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>

View File

@ -456,7 +456,7 @@ public class HLog implements Syncable {
if (os != null) {
try {
m = os.getWrappedStream().getClass().
getMethod("getNumCurrentReplicas", new Class<?> []{});
getDeclaredMethod("getNumCurrentReplicas", new Class<?> []{});
m.setAccessible(true);
} catch (NoSuchMethodException e) {
// Thrown if getNumCurrentReplicas() function isn't available
@ -471,7 +471,7 @@ public class HLog implements Syncable {
LOG.info("Using getNumCurrentReplicas--HDFS-826");
} else {
LOG.info("getNumCurrentReplicas--HDFS-826 not available; hdfs_out=" +
os + ", exception=" + exception.getMessage());
os, exception);
}
return m;
}

View File

@ -1277,6 +1277,8 @@ public class HBaseTestingUtility {
LOG.info("Mini mapreduce cluster started");
conf.set("mapred.job.tracker",
mrCluster.createJobConf().get("mapred.job.tracker"));
/* this for mrv2 support */
conf.set("mapreduce.framework.name", "yarn");
}
/**

View File

@ -326,13 +326,18 @@ public class TestLogRolling {
// We start 3 servers and then stop 2 to avoid a directory naming conflict
// when we stop/start a namenode later, as mentioned in HBASE-5163
List<DataNode> existingNodes = dfsCluster.getDataNodes();
dfsCluster
.startDataNodes(TEST_UTIL.getConfiguration(), 3, true, null, null);
for (DataNode dn: existingNodes){
dfsCluster.stopDataNode( dn.dnRegistration.getName() );
int numDataNodes = 3;
dfsCluster.startDataNodes(TEST_UTIL.getConfiguration(), numDataNodes, true,
null, null);
List<DataNode> allNodes = dfsCluster.getDataNodes();
for (int i = allNodes.size()-1; i >= 0; i--) {
if (existingNodes.contains(allNodes.get(i))) {
dfsCluster.stopDataNode( i );
}
}
assertTrue(
assertTrue("DataNodes " + dfsCluster.getDataNodes().size() +
" default replication " + fs.getDefaultReplication(),
dfsCluster.getDataNodes().size() >= fs.getDefaultReplication() + 1);
writeData(table, 2);