|
@@ -24,6 +24,7 @@ import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_
|
|
|
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
|
+import org.apache.hadoop.hdfs.protocol.ECInfo;
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
@@ -33,6 +34,7 @@ import static org.junit.Assert.assertEquals;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
|
+import org.apache.hadoop.hdfs.server.namenode.ECSchemaManager;
|
|
|
import org.apache.hadoop.hdfs.util.StripedBlockUtil;
|
|
|
import org.junit.After;
|
|
|
import org.junit.Before;
|
|
@@ -52,6 +54,8 @@ public class TestReadStripedFile {
|
|
|
private DistributedFileSystem fs;
|
|
|
private final Path dirPath = new Path("/striped");
|
|
|
private Path filePath = new Path(dirPath, "file");
|
|
|
+ private ECInfo info = new ECInfo(filePath.toString(),
|
|
|
+ ECSchemaManager.getSystemDefaultSchema());
|
|
|
private final short DATA_BLK_NUM = HdfsConstants.NUM_DATA_BLOCKS;
|
|
|
private final short PARITY_BLK_NUM = HdfsConstants.NUM_PARITY_BLOCKS;
|
|
|
private final int CELLSIZE = HdfsConstants.BLOCK_STRIPED_CELL_SIZE;
|
|
@@ -89,7 +93,7 @@ public class TestReadStripedFile {
|
|
|
LocatedBlocks lbs = fs.getClient().namenode.getBlockLocations(
|
|
|
filePath.toString(), 0, BLOCK_GROUP_SIZE * numBlocks);
|
|
|
final DFSStripedInputStream in =
|
|
|
- new DFSStripedInputStream(fs.getClient(), filePath.toString(), false);
|
|
|
+ new DFSStripedInputStream(fs.getClient(), filePath.toString(), false, info);
|
|
|
|
|
|
List<LocatedBlock> lbList = lbs.getLocatedBlocks();
|
|
|
for (LocatedBlock aLbList : lbList) {
|
|
@@ -124,7 +128,8 @@ public class TestReadStripedFile {
|
|
|
bg.getBlock().getBlockPoolId());
|
|
|
}
|
|
|
DFSStripedInputStream in =
|
|
|
- new DFSStripedInputStream(fs.getClient(), filePath.toString(), false);
|
|
|
+ new DFSStripedInputStream(fs.getClient(),
|
|
|
+ filePath.toString(), false, info);
|
|
|
int readSize = BLOCK_GROUP_SIZE;
|
|
|
byte[] readBuffer = new byte[readSize];
|
|
|
int ret = in.read(0, readBuffer, 0, readSize);
|
|
@@ -170,7 +175,7 @@ public class TestReadStripedFile {
|
|
|
|
|
|
DFSStripedInputStream in =
|
|
|
new DFSStripedInputStream(fs.getClient(), filePath.toString(),
|
|
|
- false);
|
|
|
+ false, info);
|
|
|
|
|
|
byte[] expected = new byte[fileSize];
|
|
|
|