HDFS-15143. LocatedStripedBlock returns wrong block type. Contributed by Ayush Saxena.
This commit is contained in:
parent
3f01c48106
commit
f876dc228b
|
@ -77,6 +77,11 @@ public class LocatedStripedBlock extends LocatedBlock {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockType getBlockType() {
|
||||||
|
return BlockType.STRIPED;
|
||||||
|
}
|
||||||
|
|
||||||
public Token<BlockTokenIdentifier>[] getBlockTokens() {
|
public Token<BlockTokenIdentifier>[] getBlockTokens() {
|
||||||
return blockTokens;
|
return blockTokens;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.google.common.base.Preconditions;
|
||||||
import org.apache.hadoop.fs.StorageType;
|
import org.apache.hadoop.fs.StorageType;
|
||||||
import org.apache.hadoop.hdfs.DFSTestUtil;
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
||||||
import org.apache.hadoop.hdfs.StripedFileTestUtil;
|
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.DatanodeInfo;
|
||||||
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
||||||
|
@ -173,6 +174,13 @@ public class TestStripedBlockUtil {
|
||||||
return bufs;
|
return bufs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLocatedStripedBlockType() {
|
||||||
|
LocatedStripedBlock lsb =
|
||||||
|
new LocatedStripedBlock(null, null, null, null, null, 0, false, null);
|
||||||
|
assertEquals(BlockType.STRIPED, lsb.getBlockType());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseDummyStripedBlock() {
|
public void testParseDummyStripedBlock() {
|
||||||
LocatedStripedBlock lsb = createDummyLocatedBlock(
|
LocatedStripedBlock lsb = createDummyLocatedBlock(
|
||||||
|
|
Loading…
Reference in New Issue