Java 类org.apache.hadoop.hdfs.protocol.FSLimitException 实例源码

项目:hadoop    文件:FSDirSnapshotOp.java   
/** Verify if the snapshot name is legal. */
static void verifySnapshotName(FSDirectory fsd, String snapshotName,
    String path)
    throws FSLimitException.PathComponentTooLongException {
  if (snapshotName.contains(Path.SEPARATOR)) {
    throw new HadoopIllegalArgumentException(
        "Snapshot name cannot contain \"" + Path.SEPARATOR + "\"");
  }
  final byte[] bytes = DFSUtil.string2Bytes(snapshotName);
  fsd.verifyINodeName(bytes);
  fsd.verifyMaxComponentLength(bytes, path);
}
项目:aliyun-oss-hadoop-fs    文件:FSDirSnapshotOp.java   
/** Verify if the snapshot name is legal. */
static void verifySnapshotName(FSDirectory fsd, String snapshotName,
    String path)
    throws FSLimitException.PathComponentTooLongException {
  if (snapshotName.contains(Path.SEPARATOR)) {
    throw new HadoopIllegalArgumentException(
        "Snapshot name cannot contain \"" + Path.SEPARATOR + "\"");
  }
  final byte[] bytes = DFSUtil.string2Bytes(snapshotName);
  fsd.verifyINodeName(bytes);
  fsd.verifyMaxComponentLength(bytes, path);
}
项目:big-c    文件:FSDirSnapshotOp.java   
/** Verify if the snapshot name is legal. */
static void verifySnapshotName(FSDirectory fsd, String snapshotName,
    String path)
    throws FSLimitException.PathComponentTooLongException {
  if (snapshotName.contains(Path.SEPARATOR)) {
    throw new HadoopIllegalArgumentException(
        "Snapshot name cannot contain \"" + Path.SEPARATOR + "\"");
  }
  final byte[] bytes = DFSUtil.string2Bytes(snapshotName);
  fsd.verifyINodeName(bytes);
  fsd.verifyMaxComponentLength(bytes, path);
}
项目:hops    文件:FSDirectory.java   
/**
 * Verify that filesystem limit constraints are not violated
 *
 * @throws PathComponentTooLongException
 *     child's name is too long
 * @throws MaxDirectoryItemsExceededException
 *     items per directory is exceeded
 */
protected <T extends INode> void verifyFsLimits(INode[] pathComponents,
    int pos, T child)
    throws FSLimitException, StorageException, TransactionContextException {
  boolean includeChildName = false;
  try {
    if (maxComponentLength != 0) {
      int length = child.getLocalName().length();
      if (length > maxComponentLength) {
        includeChildName = true;
        throw new PathComponentTooLongException(maxComponentLength, length);
      }
    }
    if (maxDirItems != 0) {
      INodeDirectory parent = (INodeDirectory) pathComponents[pos - 1];
      int count = parent.getChildrenList().size();
      if (count >= maxDirItems) {
        throw new MaxDirectoryItemsExceededException(maxDirItems, count);
      }
    }
  } catch (FSLimitException e) {
    String badPath = getFullPathName(pathComponents, pos - 1);
    if (includeChildName) {
      badPath += Path.SEPARATOR + child.getLocalName();
    }
    e.setPathName(badPath);
    // Do not throw if edits log is still being processed
    if (ready) {
      throw (e);
    }
    // log pre-existing paths that exceed limits
    NameNode.LOG
        .error("FSDirectory.verifyFsLimits - " + e.getLocalizedMessage());
  }
}
项目:hops    文件:TestFsLimits.java   
@Override
public <T extends INode> void verifyFsLimits(INode[] pathComponents,
    int pos, T child)
    throws FSLimitException, StorageException, TransactionContextException {
  super.verifyFsLimits(pathComponents, pos, child);
}