HDFS-15143. LocatedStripedBlock returns wrong block type. Contributed by Ayush Saxena.

This commit is contained in:
Ayush Saxena 2020-01-28 19:34:21 +05:30
parent 3f01c48106
commit f876dc228b
2 changed files with 13 additions and 0 deletions

View File

@ -77,6 +77,11 @@ public boolean isStriped() {
return true;
}
@Override
public BlockType getBlockType() {
return BlockType.STRIPED;
}
public Token<BlockTokenIdentifier>[] getBlockTokens() {
return blockTokens;
}

View File

@ -22,6 +22,7 @@
import org.apache.hadoop.fs.StorageType;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.StripedFileTestUtil;
import org.apache.hadoop.hdfs.protocol.BlockType;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
@ -173,6 +174,13 @@ private byte[][] createInternalBlkBuffers(int bgSize) {
return bufs;
}
@Test
public void testLocatedStripedBlockType() {
LocatedStripedBlock lsb =
new LocatedStripedBlock(null, null, null, null, null, 0, false, null);
assertEquals(BlockType.STRIPED, lsb.getBlockType());
}
@Test
public void testParseDummyStripedBlock() {
LocatedStripedBlock lsb = createDummyLocatedBlock(