Method to prioritize a bunch of candidate peers of a block manager.
Method to prioritize a bunch of candidate peers of a block manager. This implementation replicates the behavior of block replication in HDFS. For a given number of replicas needed, we choose a peer within the rack, one outside and remaining blockmanagers are chosen at random, in that order till we meet the number of replicas needed. This works best with a total replication factor of 3, like HDFS.
Id of the current BlockManager for self identification
A list of peers of a BlockManager
Set of peers already replicated to
BlockId of the block being replicated. This can be used as a source of randomness if needed.
Number of peers we need to replicate to
A prioritized list of peers. Lower the index of a peer, higher its priority