|
@@ -29,6 +29,7 @@ import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
|
import org.apache.hadoop.fs.FSDataInputStream;
|
|
import org.apache.hadoop.fs.FSDataInputStream;
|
|
import org.apache.hadoop.fs.FileUtil.HardLink;
|
|
import org.apache.hadoop.fs.FileUtil.HardLink;
|
|
|
|
+import org.apache.hadoop.fs.BlockLocation;
|
|
|
|
|
|
/**
|
|
/**
|
|
* This class tests the building blocks that are needed to
|
|
* This class tests the building blocks that are needed to
|
|
@@ -91,14 +92,15 @@ public class TestFileAppend extends TestCase {
|
|
Thread.sleep(1000);
|
|
Thread.sleep(1000);
|
|
} catch (InterruptedException e) {}
|
|
} catch (InterruptedException e) {}
|
|
done = true;
|
|
done = true;
|
|
- String[][] locations = fileSys.getFileCacheHints(name, 0, fileSize);
|
|
|
|
|
|
+ BlockLocation[] locations = fileSys.getFileBlockLocations(name, 0,
|
|
|
|
+ fileSize);
|
|
if (locations.length < numBlocks) {
|
|
if (locations.length < numBlocks) {
|
|
System.out.println("Number of blocks found " + locations.length);
|
|
System.out.println("Number of blocks found " + locations.length);
|
|
done = false;
|
|
done = false;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
for (int idx = 0; idx < numBlocks; idx++) {
|
|
for (int idx = 0; idx < numBlocks; idx++) {
|
|
- if (locations[idx].length < repl) {
|
|
|
|
|
|
+ if (locations[idx].getHosts().length < repl) {
|
|
System.out.println("Block index " + idx + " not yet replciated.");
|
|
System.out.println("Block index " + idx + " not yet replciated.");
|
|
done = false;
|
|
done = false;
|
|
break;
|
|
break;
|