Hello,

I've done some initial work for making the volume-block choosing
policy pluggable (so that methods other than round-robin may be
provided).

The following is my initial interface design, and am looking for
comments/critique/etc. w.r.t.
https://issues.apache.org/jira/browse/HDFS-1120's scope, before I
start pushing out some tests + patches:

/**************************************************
 * BlockVolumeChoosingPolicy allows a DataNode to
 * specify what policy is to be used while choosing
 * a volume for a block request.
 *
 ***************************************************/
public interface BlockVolumeChoosingPolicy extends Configurable {

  /**
   * Returns a specific FSVolume after applying a suitable choice algorithm
   * to place a given block, given a list of FSVolumes and the block
   * size sought for storage.
   * @param volumes - the array of FSVolumes that are available.
   * @param blockSize - the size of the block for which a volume is sought.
   * @return the chosen volume to store the block.
   * @throws IOException when disks are unavailable or are full.
   */
  public FSVolume chooseVolume(FSVolume[] volumes, long blockSize)
    throws IOException;

}

This can be neatly used within FSVolumeSet.getNextVolume() [Maybe this
too needs to be renamed, since it may not make sense as 'next' once it
becomes pluggable]

Looking forward to a discussion.

-- 
Harsh J
http://harshj.com

Reply via email to