|
@@ -24,7 +24,6 @@ import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_
|
|
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
|
|
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
-import org.apache.hadoop.hdfs.protocol.ErasureCodingInfo;
|
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
@@ -36,6 +35,7 @@ import static org.junit.Assert.assertTrue;
|
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
import org.apache.hadoop.hdfs.server.namenode.ErasureCodingSchemaManager;
|
|
import org.apache.hadoop.hdfs.server.namenode.ErasureCodingSchemaManager;
|
|
import org.apache.hadoop.hdfs.util.StripedBlockUtil;
|
|
import org.apache.hadoop.hdfs.util.StripedBlockUtil;
|
|
|
|
+import org.apache.hadoop.io.erasurecode.ECSchema;
|
|
import org.junit.After;
|
|
import org.junit.After;
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
@@ -54,8 +54,7 @@ public class TestDFSStripedInputStream {
|
|
private DistributedFileSystem fs;
|
|
private DistributedFileSystem fs;
|
|
private final Path dirPath = new Path("/striped");
|
|
private final Path dirPath = new Path("/striped");
|
|
private Path filePath = new Path(dirPath, "file");
|
|
private Path filePath = new Path(dirPath, "file");
|
|
- private ErasureCodingInfo info = new ErasureCodingInfo(filePath.toString(),
|
|
|
|
- ErasureCodingSchemaManager.getSystemDefaultSchema());
|
|
|
|
|
|
+ private final ECSchema schema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
private final short DATA_BLK_NUM = HdfsConstants.NUM_DATA_BLOCKS;
|
|
private final short DATA_BLK_NUM = HdfsConstants.NUM_DATA_BLOCKS;
|
|
private final short PARITY_BLK_NUM = HdfsConstants.NUM_PARITY_BLOCKS;
|
|
private final short PARITY_BLK_NUM = HdfsConstants.NUM_PARITY_BLOCKS;
|
|
private final int CELLSIZE = HdfsConstants.BLOCK_STRIPED_CELL_SIZE;
|
|
private final int CELLSIZE = HdfsConstants.BLOCK_STRIPED_CELL_SIZE;
|
|
@@ -92,8 +91,8 @@ public class TestDFSStripedInputStream {
|
|
NUM_STRIPE_PER_BLOCK, false);
|
|
NUM_STRIPE_PER_BLOCK, false);
|
|
LocatedBlocks lbs = fs.getClient().namenode.getBlockLocations(
|
|
LocatedBlocks lbs = fs.getClient().namenode.getBlockLocations(
|
|
filePath.toString(), 0, BLOCK_GROUP_SIZE * numBlocks);
|
|
filePath.toString(), 0, BLOCK_GROUP_SIZE * numBlocks);
|
|
- final DFSStripedInputStream in =
|
|
|
|
- new DFSStripedInputStream(fs.getClient(), filePath.toString(), false, info);
|
|
|
|
|
|
+ final DFSStripedInputStream in = new DFSStripedInputStream(fs.getClient(),
|
|
|
|
+ filePath.toString(), false, schema);
|
|
|
|
|
|
List<LocatedBlock> lbList = lbs.getLocatedBlocks();
|
|
List<LocatedBlock> lbList = lbs.getLocatedBlocks();
|
|
for (LocatedBlock aLbList : lbList) {
|
|
for (LocatedBlock aLbList : lbList) {
|
|
@@ -129,7 +128,7 @@ public class TestDFSStripedInputStream {
|
|
}
|
|
}
|
|
DFSStripedInputStream in =
|
|
DFSStripedInputStream in =
|
|
new DFSStripedInputStream(fs.getClient(),
|
|
new DFSStripedInputStream(fs.getClient(),
|
|
- filePath.toString(), false, info);
|
|
|
|
|
|
+ filePath.toString(), false, schema);
|
|
int readSize = BLOCK_GROUP_SIZE;
|
|
int readSize = BLOCK_GROUP_SIZE;
|
|
byte[] readBuffer = new byte[readSize];
|
|
byte[] readBuffer = new byte[readSize];
|
|
int ret = in.read(0, readBuffer, 0, readSize);
|
|
int ret = in.read(0, readBuffer, 0, readSize);
|
|
@@ -156,8 +155,7 @@ public class TestDFSStripedInputStream {
|
|
}
|
|
}
|
|
DFSTestUtil.createStripedFile(cluster, filePath, null, numBlocks,
|
|
DFSTestUtil.createStripedFile(cluster, filePath, null, numBlocks,
|
|
NUM_STRIPE_PER_BLOCK, false);
|
|
NUM_STRIPE_PER_BLOCK, false);
|
|
- LocatedBlocks lbs = fs.getClient().namenode.getBlockLocations(
|
|
|
|
- filePath.toString(), 0, fileSize);
|
|
|
|
|
|
+ LocatedBlocks lbs = fs.getClient().namenode.getBlockLocations(filePath.toString(), 0, fileSize);
|
|
|
|
|
|
assert lbs.getLocatedBlocks().size() == numBlocks;
|
|
assert lbs.getLocatedBlocks().size() == numBlocks;
|
|
for (LocatedBlock lb : lbs.getLocatedBlocks()) {
|
|
for (LocatedBlock lb : lbs.getLocatedBlocks()) {
|
|
@@ -175,7 +173,7 @@ public class TestDFSStripedInputStream {
|
|
|
|
|
|
DFSStripedInputStream in =
|
|
DFSStripedInputStream in =
|
|
new DFSStripedInputStream(fs.getClient(), filePath.toString(),
|
|
new DFSStripedInputStream(fs.getClient(), filePath.toString(),
|
|
- false, info);
|
|
|
|
|
|
+ false, schema);
|
|
|
|
|
|
byte[] expected = new byte[fileSize];
|
|
byte[] expected = new byte[fileSize];
|
|
|
|
|