Packages

c

org.apache.spark.storage

BasicBlockReplicationPolicy

class BasicBlockReplicationPolicy extends BlockReplicationPolicy with Logging

Developer API
Annotations
@DeveloperApi()
Source
BlockReplicationPolicy.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BasicBlockReplicationPolicy
  2. Logging
  3. BlockReplicationPolicy
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BasicBlockReplicationPolicy()

Value Members

  1. def prioritize(blockManagerId: BlockManagerId, peers: Seq[BlockManagerId], peersReplicatedTo: HashSet[BlockManagerId], blockId: BlockId, numReplicas: Int): List[BlockManagerId]

    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.

    blockManagerId

    Id of the current BlockManager for self identification

    peers

    A list of peers of a BlockManager

    peersReplicatedTo

    Set of peers already replicated to

    blockId

    BlockId of the block being replicated. This can be used as a source of randomness if needed.

    numReplicas

    Number of peers we need to replicate to

    returns

    A prioritized list of peers. Lower the index of a peer, higher its priority

    Definition Classes
    BasicBlockReplicationPolicyBlockReplicationPolicy