Examples of RaidTask


Examples of org.apache.hadoop.hdfs.server.protocol.RaidTask

    // Assign raiding task to scheduledNode
    if (scheduleNode == null) {
      // All parity blocks are generated, no need to raid
      return false;
    }
    RaidTask rt = new RaidTask(codec, stripeBlocks, stripeDatanodes, toRaidIdxs);
    writeLock();
    try {
      scheduleNode.addRaidEncodingTask(rt);
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("Stripe* NameSystem: Blocks " + sb.toString()
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.protocol.RaidTask

   
    for (int i = 0; i < numMissingBlocks; i++) {
      toRaidIdxs[i] = random.nextInt(numBlocks);
    }
   
    return new RaidTask(codec, blocks, locations, toRaidIdxs);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.protocol.RaidTask

   *
   */
  @Test
  public void testWriteRaidTask() throws IOException {
    // xor
    RaidTask task = generateRaidTask(RaidCodec.getCodec("xor"), 2, 11, 1);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    task.write(new DataOutputStream(out));
    byte[] buffer = out.toByteArray();
   
    // read and verify
    ByteArrayInputStream in = new ByteArrayInputStream(buffer);
    RaidTask newTask = new RaidTask();
    newTask.readFields(new DataInputStream(in));
    assertTrue(verifyRaidTask(task, newTask));
   
    // rs
    task = generateRaidTask(RaidCodec.getCodec("rs"), 1, 14, 4);
    out = new ByteArrayOutputStream();
    task.write(new DataOutputStream(out));
    buffer = out.toByteArray();
   
    // read and verify
    in = new ByteArrayInputStream(buffer);
    newTask = new RaidTask();
    newTask.readFields(new DataInputStream(in));
    assertTrue(verifyRaidTask(task, newTask));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.protocol.RaidTask

  /**
   * Test RaidTask with illegal argument
   */
  @Test
  public void testIllegalArgument() throws IOException {
    RaidTask task = null;
    try {
      task = generateRaidTask(RaidCodec.getCodec("not_exist"), 2, 11, 1);
      fail("codec does not exist");
    } catch (IllegalArgumentException ex) {
      // ignore
      LOG.warn(ex);
    }
   
    try {
      task = new RaidTask(RaidCodec.getCodec("xor"), null, null, null);
      fail("null arguments");
    } catch (IllegalArgumentException ex) {
      // ignore
      LOG.warn(ex);
    }
   
    try {
      task = new RaidTask(RaidCodec.getCodec("xor"), new Block[] {new Block()},
          new ArrayList<ArrayList<DatanodeInfo>>(), new int[] {0});
      fail("all blocks should have locations");
    } catch (IllegalArgumentException ex) {
      // ignore
      LOG.warn(ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.