Java 类org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException 实例源码

项目:hadoop    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:big-c    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hadoop-plus    文件:DataNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);
  if (e instanceof SocketException || e instanceof SocketTimeoutException
      || e instanceof ClosedByInterruptException 
      || e.getMessage().startsWith("An established connection was aborted")
      || e.getMessage().startsWith("Broken pipe")
      || e.getMessage().startsWith("Connection reset")
      || e.getMessage().contains("java.nio.channels.SocketChannel")) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
            " related exception");  
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:hadoop-plus    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:PDHC    文件:CheckerNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);
  if (e instanceof SocketException || e instanceof SocketTimeoutException
      || e instanceof ClosedByInterruptException 
      || e.getMessage().startsWith("An established connection was aborted")
      || e.getMessage().startsWith("Broken pipe")
      || e.getMessage().startsWith("Connection reset")
      || e.getMessage().contains("java.nio.channels.SocketChannel")) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
            " related exception");  
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:FlexMap    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hops    文件:TestRoundRobinVolumeChoosingPolicy.java   
@Test
public void testRRPolicyExceptionMessage() throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  final RoundRobinVolumeChoosingPolicy<FsVolumeSpi> policy =
      new RoundRobinVolumeChoosingPolicy<>();
  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch (DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600 +
            " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hadoop-TCP    文件:DataNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);
  if (e instanceof SocketException || e instanceof SocketTimeoutException
      || e instanceof ClosedByInterruptException 
      || e.getMessage().startsWith("An established connection was aborted")
      || e.getMessage().startsWith("Broken pipe")
      || e.getMessage().startsWith("Connection reset")
      || e.getMessage().contains("java.nio.channels.SocketChannel")) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
            " related exception");  
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:hadoop-TCP    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hadoop-on-lustre    文件:FSDataset.java   
synchronized FSVolume getNextVolume(long blockSize) throws IOException {

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) { return volume; }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Insufficient space for an additional block");
    }
  }
}
项目:hardfs    文件:DataNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);
  if (e instanceof SocketException || e instanceof SocketTimeoutException
      || e instanceof ClosedByInterruptException 
      || e.getMessage().startsWith("An established connection was aborted")
      || e.getMessage().startsWith("Broken pipe")
      || e.getMessage().startsWith("Connection reset")
      || e.getMessage().contains("java.nio.channels.SocketChannel")) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
            " related exception");  
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:hardfs    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:hadoop-on-lustre2    文件:DataNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);
  if (isNetworkRelatedException(e)) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
            " related exception");  
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:hadoop-on-lustre2    文件:TestRoundRobinVolumeChoosingPolicy.java   
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
项目:cumulus    文件:FSDataset.java   
synchronized FSVolume getNextVolume(long blockSize) throws IOException {

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) { return volume; }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Insufficient space for an additional block");
    }
  }
}
项目:hortonworks-extension    文件:FSDataset.java   
synchronized FSVolume getNextVolume(long blockSize) throws IOException {

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) { return volume; }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Insufficient space for an additional block");
    }
  }
}
项目:hortonworks-extension    文件:FSDataset.java   
synchronized FSVolume getNextVolume(long blockSize) throws IOException {

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) { return volume; }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Insufficient space for an additional block");
    }
  }
}
项目:hadoop    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:hadoop    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hadoop    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)
      && countdown.isSatisfied()) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:aliyun-oss-hadoop-fs    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:big-c    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:big-c    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:big-c    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)
      && countdown.isSatisfied()) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)
      && countdown.isSatisfied()) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hadoop-EAR    文件:FSDataset.java   
private FSVolume getNextVolume(long blockSize) throws IOException {
  FSVolume[] volumes = this.getVolumes();

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if (curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) {
      return volume;
    }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException(
          "Insufficient space for an additional block");
    }
  }
}
项目:hadoop-EAR    文件:DataNode.java   
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {
  if (e instanceof ClosedByInterruptException
      || e instanceof java.io.InterruptedIOException) {
    return;
  }
  LOG.warn("checkDiskError: exception: ", e);

  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
项目:hadoop-plus    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, final long blockSize
    ) throws IOException {
  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) { return volume; }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:hadoop-plus    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hadoop-plus    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)
      && countdown.isSatisfied()) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:FlexMap    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
项目:FlexMap    文件:FsDatasetImpl.java   
@Override // FsDatasetSpi
public synchronized ReplicaInPipeline createRbw(StorageType storageType,
    ExtendedBlock b, boolean allowLazyPersist) throws IOException {
  ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
      b.getBlockId());
  if (replicaInfo != null) {
    throw new ReplicaAlreadyExistsException("Block " + b +
    " already exists in state " + replicaInfo.getState() +
    " and thus cannot be created.");
  }
  // create a new block
  FsVolumeImpl v;
  while (true) {
    try {
      if (allowLazyPersist) {
        // First try to place the block on a transient volume.
        v = volumes.getNextTransientVolume(b.getNumBytes());
        datanode.getMetrics().incrRamDiskBlocksWrite();
      } else {
        v = volumes.getNextVolume(storageType, b.getNumBytes());
      }
    } catch (DiskOutOfSpaceException de) {
      if (allowLazyPersist) {
        datanode.getMetrics().incrRamDiskBlocksWriteFallback();
        allowLazyPersist = false;
        continue;
      }
      throw de;
    }
    break;
  }
  // create an rbw file to hold block in the designated volume
  File f = v.createRbwFile(b.getBlockPoolId(), b.getLocalBlock());
  ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(b.getBlockId(), 
      b.getGenerationStamp(), v, f.getParentFile(), b.getNumBytes());
  volumeMap.add(b.getBlockPoolId(), newReplicaInfo);

  return newReplicaInfo;
}
项目:FlexMap    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:FlexMap    文件:DataTransferTestUtil.java   
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)
      && countdown.isSatisfied()) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
项目:hops    文件:RoundRobinVolumeChoosingPolicy.java   
@Override
public synchronized V chooseVolume(final List<V> volumes,
    final long blockSize) throws IOException {
  if (volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }

  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if (curVolume >= volumes.size()) {
    curVolume = 0;
  }

  int startVolume = curVolume;
  long maxAvailable = 0;

  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }

    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }

    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException(
          "Out of space: " + "The volume with the most available space (=" +
              maxAvailable + " B) is less than the block size (=" +
              blockSize + " B).");
    }
  }
}
项目:hops    文件:DataNode.java   
/**
 * Check if there is no space in disk
 *
 * @param e
 *     that caused this checkDiskError call
 */
protected void checkDiskError(Exception e) throws IOException {

  LOG.warn("checkDiskError: exception: ", e);

  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}