HDFS-8427. Remove dataBlockNum and parityBlockNum from BlockInfoStriped. Contributed by Kai Sasaki.
This commit is contained in:
parent
45db1a0b72
commit
744ef17792
@ -241,3 +241,6 @@
|
|||||||
|
|
||||||
HDFS-8323. Bump GenerationStamp for write faliure in DFSStripedOutputStream.
|
HDFS-8323. Bump GenerationStamp for write faliure in DFSStripedOutputStream.
|
||||||
(Tsz Wo Nicholas Sze via jing9)
|
(Tsz Wo Nicholas Sze via jing9)
|
||||||
|
|
||||||
|
HDFS-8427. Remove dataBlockNum and parityBlockNum from BlockInfoStriped.
|
||||||
|
(Kai Sasaki via jing9)
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import org.apache.hadoop.hdfs.protocol.Block;
|
import org.apache.hadoop.hdfs.protocol.Block;
|
||||||
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.BlockUCState;
|
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.BlockUCState;
|
||||||
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.apache.hadoop.io.erasurecode.ECSchema;
|
||||||
|
|
||||||
@ -39,8 +38,6 @@
|
|||||||
* array to record the block index for each triplet.
|
* array to record the block index for each triplet.
|
||||||
*/
|
*/
|
||||||
public class BlockInfoStriped extends BlockInfo {
|
public class BlockInfoStriped extends BlockInfo {
|
||||||
private final short dataBlockNum;
|
|
||||||
private final short parityBlockNum;
|
|
||||||
private final ECSchema schema;
|
private final ECSchema schema;
|
||||||
/**
|
/**
|
||||||
* Always the same size with triplets. Record the block index for each triplet
|
* Always the same size with triplets. Record the block index for each triplet
|
||||||
@ -54,8 +51,6 @@ public BlockInfoStriped(Block blk, ECSchema schema) {
|
|||||||
indices = new byte[schema.getNumDataUnits() + schema.getNumParityUnits()];
|
indices = new byte[schema.getNumDataUnits() + schema.getNumParityUnits()];
|
||||||
initIndices();
|
initIndices();
|
||||||
this.schema = schema;
|
this.schema = schema;
|
||||||
this.dataBlockNum = (short)schema.getNumDataUnits();
|
|
||||||
this.parityBlockNum = (short)schema.getNumParityUnits();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockInfoStriped(BlockInfoStriped b) {
|
BlockInfoStriped(BlockInfoStriped b) {
|
||||||
@ -64,15 +59,16 @@ public BlockInfoStriped(Block blk, ECSchema schema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public short getTotalBlockNum() {
|
public short getTotalBlockNum() {
|
||||||
return (short) (dataBlockNum + parityBlockNum);
|
return (short) (this.schema.getNumDataUnits()
|
||||||
|
+ this.schema.getNumParityUnits());
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getDataBlockNum() {
|
public short getDataBlockNum() {
|
||||||
return dataBlockNum;
|
return (short) this.schema.getNumDataUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getParityBlockNum() {
|
public short getParityBlockNum() {
|
||||||
return parityBlockNum;
|
return (short) this.schema.getNumParityUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ECSchema getSchema() {
|
public ECSchema getSchema() {
|
||||||
@ -210,7 +206,8 @@ public long spaceConsumed() {
|
|||||||
// be the total of data blocks and parity blocks because
|
// be the total of data blocks and parity blocks because
|
||||||
// `getNumBytes` is the total of actual data block size.
|
// `getNumBytes` is the total of actual data block size.
|
||||||
return StripedBlockUtil.spaceConsumedByStripedBlock(getNumBytes(),
|
return StripedBlockUtil.spaceConsumedByStripedBlock(getNumBytes(),
|
||||||
dataBlockNum, parityBlockNum, BLOCK_STRIPED_CELL_SIZE);
|
this.schema.getNumDataUnits(), this.schema.getNumParityUnits(),
|
||||||
|
BLOCK_STRIPED_CELL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user