|
@@ -53,6 +53,7 @@ public class TestStripedINodeFile {
|
|
|
|
|
|
private static final ECSchema testSchema
|
|
private static final ECSchema testSchema
|
|
= ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
= ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
+ private static final int cellSize = HdfsConstants.BLOCK_STRIPED_CELL_SIZE;
|
|
|
|
|
|
private static INodeFile createStripedINodeFile() {
|
|
private static INodeFile createStripedINodeFile() {
|
|
return new INodeFile(HdfsConstants.GRANDFATHER_INODE_ID, null, perm, 0L, 0L,
|
|
return new INodeFile(HdfsConstants.GRANDFATHER_INODE_ID, null, perm, 0L, 0L,
|
|
@@ -69,22 +70,20 @@ public class TestStripedINodeFile {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedTotalBlockCount() {
|
|
public void testBlockStripedTotalBlockCount() {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStriped blockInfoStriped
|
|
BlockInfoStriped blockInfoStriped
|
|
- = new BlockInfoStriped(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk, testSchema, cellSize);
|
|
assertEquals(9, blockInfoStriped.getTotalBlockNum());
|
|
assertEquals(9, blockInfoStriped.getTotalBlockNum());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedLength()
|
|
public void testBlockStripedLength()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStriped blockInfoStriped
|
|
BlockInfoStriped blockInfoStriped
|
|
- = new BlockInfoStriped(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk, testSchema, cellSize);
|
|
inf.addBlock(blockInfoStriped);
|
|
inf.addBlock(blockInfoStriped);
|
|
assertEquals(1, inf.getBlocks().length);
|
|
assertEquals(1, inf.getBlocks().length);
|
|
}
|
|
}
|
|
@@ -92,12 +91,11 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedConsumedSpace()
|
|
public void testBlockStripedConsumedSpace()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStriped blockInfoStriped
|
|
BlockInfoStriped blockInfoStriped
|
|
- = new BlockInfoStriped(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk, testSchema, cellSize);
|
|
blockInfoStriped.setNumBytes(1);
|
|
blockInfoStriped.setNumBytes(1);
|
|
inf.addBlock(blockInfoStriped);
|
|
inf.addBlock(blockInfoStriped);
|
|
// 0. Calculate the total bytes per stripes <Num Bytes per Stripes>
|
|
// 0. Calculate the total bytes per stripes <Num Bytes per Stripes>
|
|
@@ -119,16 +117,15 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testMultipleBlockStripedConsumedSpace()
|
|
public void testMultipleBlockStripedConsumedSpace()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk1 = new Block(1);
|
|
Block blk1 = new Block(1);
|
|
BlockInfoStriped blockInfoStriped1
|
|
BlockInfoStriped blockInfoStriped1
|
|
- = new BlockInfoStriped(blk1, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk1, testSchema, cellSize);
|
|
blockInfoStriped1.setNumBytes(1);
|
|
blockInfoStriped1.setNumBytes(1);
|
|
Block blk2 = new Block(2);
|
|
Block blk2 = new Block(2);
|
|
BlockInfoStriped blockInfoStriped2
|
|
BlockInfoStriped blockInfoStriped2
|
|
- = new BlockInfoStriped(blk2, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk2, testSchema, cellSize);
|
|
blockInfoStriped2.setNumBytes(1);
|
|
blockInfoStriped2.setNumBytes(1);
|
|
inf.addBlock(blockInfoStriped1);
|
|
inf.addBlock(blockInfoStriped1);
|
|
inf.addBlock(blockInfoStriped2);
|
|
inf.addBlock(blockInfoStriped2);
|
|
@@ -140,12 +137,11 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedFileSize()
|
|
public void testBlockStripedFileSize()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStriped blockInfoStriped
|
|
BlockInfoStriped blockInfoStriped
|
|
- = new BlockInfoStriped(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk, testSchema, cellSize);
|
|
blockInfoStriped.setNumBytes(100);
|
|
blockInfoStriped.setNumBytes(100);
|
|
inf.addBlock(blockInfoStriped);
|
|
inf.addBlock(blockInfoStriped);
|
|
// Compute file size should return actual data
|
|
// Compute file size should return actual data
|
|
@@ -157,12 +153,11 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedUCFileSize()
|
|
public void testBlockStripedUCFileSize()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStripedUnderConstruction bInfoStripedUC
|
|
BlockInfoStripedUnderConstruction bInfoStripedUC
|
|
- = new BlockInfoStripedUnderConstruction(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStripedUnderConstruction(blk, testSchema, cellSize);
|
|
bInfoStripedUC.setNumBytes(100);
|
|
bInfoStripedUC.setNumBytes(100);
|
|
inf.addBlock(bInfoStripedUC);
|
|
inf.addBlock(bInfoStripedUC);
|
|
assertEquals(100, inf.computeFileSize());
|
|
assertEquals(100, inf.computeFileSize());
|
|
@@ -172,12 +167,11 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedComputeQuotaUsage()
|
|
public void testBlockStripedComputeQuotaUsage()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStriped blockInfoStriped
|
|
BlockInfoStriped blockInfoStriped
|
|
- = new BlockInfoStriped(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStriped(blk, testSchema, cellSize);
|
|
blockInfoStriped.setNumBytes(100);
|
|
blockInfoStriped.setNumBytes(100);
|
|
inf.addBlock(blockInfoStriped);
|
|
inf.addBlock(blockInfoStriped);
|
|
|
|
|
|
@@ -195,12 +189,11 @@ public class TestStripedINodeFile {
|
|
@Test
|
|
@Test
|
|
public void testBlockStripedUCComputeQuotaUsage()
|
|
public void testBlockStripedUCComputeQuotaUsage()
|
|
throws IOException, InterruptedException {
|
|
throws IOException, InterruptedException {
|
|
- ECSchema defaultSchema = ErasureCodingSchemaManager.getSystemDefaultSchema();
|
|
|
|
INodeFile inf = createStripedINodeFile();
|
|
INodeFile inf = createStripedINodeFile();
|
|
inf.addStripedBlocksFeature();
|
|
inf.addStripedBlocksFeature();
|
|
Block blk = new Block(1);
|
|
Block blk = new Block(1);
|
|
BlockInfoStripedUnderConstruction bInfoStripedUC
|
|
BlockInfoStripedUnderConstruction bInfoStripedUC
|
|
- = new BlockInfoStripedUnderConstruction(blk, testSchema);
|
|
|
|
|
|
+ = new BlockInfoStripedUnderConstruction(blk, testSchema, cellSize);
|
|
bInfoStripedUC.setNumBytes(100);
|
|
bInfoStripedUC.setNumBytes(100);
|
|
inf.addBlock(bInfoStripedUC);
|
|
inf.addBlock(bInfoStripedUC);
|
|
|
|
|