Class SequentialBlockGroupIdGenerator
java.lang.Object
org.apache.hadoop.util.SequentialNumber
org.apache.hadoop.hdfs.server.blockmanagement.SequentialBlockGroupIdGenerator
- All Implemented Interfaces:
org.apache.hadoop.util.IdGenerator
@Private
public class SequentialBlockGroupIdGenerator
extends org.apache.hadoop.util.SequentialNumber
Generate the next valid block group ID by incrementing the maximum block
group ID allocated so far, with the first 2^10 block group IDs reserved.
HDFS-EC introduces a hierarchical protocol to name blocks and groups:
Contiguous: {reserved block IDs | flag | block ID}
Striped: {reserved block IDs | flag | block group ID | index in group}
Following n bits of reserved block IDs, The (n+1)th bit in an ID
distinguishes contiguous (0) and striped (1) blocks. For a striped block,
bits (n+2) to (64-m) represent the ID of its block group, while the last m
bits represent its index of the group. The value m is determined by the
maximum number of blocks in a group (MAX_BLOCKS_IN_GROUP).
Note that the
nextValue() methods requires external lock to
guarantee IDs have no conflicts.-
Method Summary
Methods inherited from class org.apache.hadoop.util.SequentialNumber
equals, getCurrentValue, hashCode, setCurrentValue, setIfGreater, skipTo
-
Method Details
-
nextValue
public long nextValue()- Specified by:
nextValuein interfaceorg.apache.hadoop.util.IdGenerator- Overrides:
nextValuein classorg.apache.hadoop.util.SequentialNumber
-