Author: shv
Date: Sat Sep 12 18:24:11 2009
New Revision: 814221
URL: http://svn.apache.org/viewvc?rev=814221&view=rev
Log:
HDFS-614. TestDatanodeBlockScanner obtains data directories directly from
MiniHDFSCluster. Contributed by Konstantin Shvachko.
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeBlockScanner.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=814221&r1=814220&r2=814221&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat Sep 12 18:24:11 2009
@@ -232,6 +232,9 @@
HDFS-601. TestBlockReport obtains data directories directly from
MiniHDFSCluster. (Konstantin Boudnik via shv)
+ HDFS-614. TestDatanodeBlockScanner obtains data directories directly from
+ MiniHDFSCluster. (shv)
+
Release 0.20.1 - Unreleased
IMPROVEMENTS
Modified:
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeBlockScanner.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeBlockScanner.java?rev=814221&r1=814220&r2=814221&view=diff
==============================================================================
---
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeBlockScanner.java
(original)
+++
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDatanodeBlockScanner.java
Sat Sep 12 18:24:11 2009
@@ -131,7 +131,7 @@
public static boolean corruptReplica(String blockName, int replica) throws
IOException {
Random random = new Random();
- File baseDir = new File(System.getProperty("test.build.data"), "dfs/data");
+ File baseDir = new File(MiniDFSCluster.getBaseDirectory(), "data");
boolean corrupted = false;
for (int i=replica*2; i<replica*2+2; i++) {
File blockFile = new File(baseDir, "data" + (i+1)+ "/current/" +
@@ -183,7 +183,7 @@
assertTrue(blocks.get(0).isCorrupt() == false);
// Corrupt random replica of block
- corruptReplica(block, rand);
+ assertTrue(corruptReplica(block, rand));
// Restart the datanode hoping the corrupt block to be reported
cluster.restartDataNode(rand);
@@ -203,9 +203,9 @@
// Corrupt all replicas. Now, block should be marked as corrupt
// and we should get all the replicas
- corruptReplica(block, 0);
- corruptReplica(block, 1);
- corruptReplica(block, 2);
+ assertTrue(corruptReplica(block, 0));
+ assertTrue(corruptReplica(block, 1));
+ assertTrue(corruptReplica(block, 2));
// Read the file to trigger reportBadBlocks by client
try {
@@ -410,7 +410,7 @@
* Change the length of a block at datanode dnIndex
*/
static boolean changeReplicaLength(String blockName, int dnIndex, int
lenDelta) throws IOException {
- File baseDir = new File(System.getProperty("test.build.data"), "dfs/data");
+ File baseDir = new File(MiniDFSCluster.getBaseDirectory(), "data");
for (int i=dnIndex*2; i<dnIndex*2+2; i++) {
File blockFile = new File(baseDir, "data" + (i+1)+ "/current/" +
blockName);
@@ -426,7 +426,7 @@
private static void waitForBlockDeleted(String blockName, int dnIndex)
throws IOException, InterruptedException {
- File baseDir = new File(System.getProperty("test.build.data"), "dfs/data");
+ File baseDir = new File(MiniDFSCluster.getBaseDirectory(), "data");
File blockFile1 = new File(baseDir, "data" + (2*dnIndex+1)+ "/current/" +
blockName);
File blockFile2 = new File(baseDir, "data" + (2*dnIndex+2)+ "/current/" +