当前位置: 首页>>代码示例>>Java>>正文


Java HBaseFileSystem.deleteFileFromFileSystem方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.HBaseFileSystem.deleteFileFromFileSystem方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseFileSystem.deleteFileFromFileSystem方法的具体用法?Java HBaseFileSystem.deleteFileFromFileSystem怎么用?Java HBaseFileSystem.deleteFileFromFileSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.HBaseFileSystem的用法示例。


在下文中一共展示了HBaseFileSystem.deleteFileFromFileSystem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createWAP

import org.apache.hadoop.hbase.HBaseFileSystem; //导入方法依赖的package包/类
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir,
    FileSystem fs, Configuration conf)
throws IOException {
  Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true);
  if (regionedits == null) {
    return null;
  }
  if (fs.exists(regionedits)) {
    LOG.warn("Found existing old edits file. It could be the "
        + "result of a previous failed split attempt. Deleting "
        + regionedits + ", length="
        + fs.getFileStatus(regionedits).getLen());
    if (!HBaseFileSystem.deleteFileFromFileSystem(fs, regionedits)) {
      LOG.warn("Failed delete of old " + regionedits);
    }
  }
  Writer w = createWriter(fs, regionedits, conf);
  LOG.debug("Creating writer path=" + regionedits + " region="
      + Bytes.toStringBinary(region));
  return (new WriterAndPath(regionedits, w));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:22,代码来源:HLogSplitter.java

示例2: delete

import org.apache.hadoop.hbase.HBaseFileSystem; //导入方法依赖的package包/类
@Override
public void delete() throws IOException {
  if (!compactedIndexFiles.isEmpty()) {
    for (Path indexfile : compactedIndexFiles) {
      if (!HBaseFileSystem.deleteFileFromFileSystem(fs, indexfile)) throw new IOException(
          "Failed to delete:" + indexfile);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:HFileArchiver.java

示例3: convertRegionEditsToTemp

import org.apache.hadoop.hbase.HBaseFileSystem; //导入方法依赖的package包/类
Path convertRegionEditsToTemp(Path rootdir, Path edits, String tmpname) {
  List<String> components = new ArrayList<String>(10);
  do {
    components.add(edits.getName());
    edits = edits.getParent();
  } while (edits.depth() > rootdir.depth());
  Path ret = ZKSplitLog.getSplitLogDir(rootdir, tmpname);
  for (int i = components.size() - 1; i >= 0; i--) {
    ret = new Path(ret, components.get(i));
  }
  try {
    if (fs.exists(ret)) {
      LOG.warn("Found existing old temporary edits file. It could be the "
          + "result of a previous failed split attempt. Deleting "
          + ret + ", length="
          + fs.getFileStatus(ret).getLen());
      if (!HBaseFileSystem.deleteFileFromFileSystem(fs, ret)) {
        LOG.warn("Failed delete of old " + ret);
      }
    }
    Path dir = ret.getParent();
    if (!fs.exists(dir) && !HBaseFileSystem.makeDirOnFileSystem(fs, dir)) { 
        LOG.warn("mkdir failed on " + dir);
    }
  } catch (IOException e) {
    LOG.warn("Could not prepare temp staging area ", e);
    // ignore, exceptions will be thrown elsewhere
  }
  return ret;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:31,代码来源:HLogSplitter.java

示例4: isZeroLengthThenDelete

import org.apache.hadoop.hbase.HBaseFileSystem; //导入方法依赖的package包/类
private static boolean isZeroLengthThenDelete(final FileSystem fs, final Path p)
    throws IOException {
  FileStatus stat = fs.getFileStatus(p);
  if (stat.getLen() > 0) return false;
  LOG.warn("File " + p + " is zero-length, deleting.");
  HBaseFileSystem.deleteFileFromFileSystem(fs, p);
  return true;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:9,代码来源:HRegion.java

示例5: closeStreams

import org.apache.hadoop.hbase.HBaseFileSystem; //导入方法依赖的package包/类
/**
 * Close all of the output streams.
 * @return the list of paths written.
 */
private List<Path> closeStreams() throws IOException {
  Preconditions.checkState(!closeAndCleanCompleted);

  List<Path> paths = new ArrayList<Path>();
  List<IOException> thrown = Lists.newArrayList();
  closeLogWriters(thrown);
  for (Map.Entry<byte[], WriterAndPath> logWritersEntry : logWriters
      .entrySet()) {
    WriterAndPath wap = logWritersEntry.getValue();
    Path dst = getCompletedRecoveredEditsFilePath(wap.p,
        regionMaximumEditLogSeqNum.get(logWritersEntry.getKey()));
    try {
      if (!dst.equals(wap.p) && fs.exists(dst)) {
        LOG.warn("Found existing old edits file. It could be the "
            + "result of a previous failed split attempt. Deleting " + dst
            + ", length=" + fs.getFileStatus(dst).getLen());
        if (!HBaseFileSystem.deleteFileFromFileSystem(fs, dst)) {
          LOG.warn("Failed deleting of old " + dst);
          throw new IOException("Failed deleting of old " + dst);
        }
      }
      // Skip the unit tests which create a splitter that reads and writes
      // the data without touching disk. TestHLogSplit#testThreading is an
      // example.
      if (fs.exists(wap.p)) {
        if (!HBaseFileSystem.renameDirForFileSystem(fs, wap.p, dst)) {
          throw new IOException("Failed renaming " + wap.p + " to " + dst);
        }
        LOG.debug("Rename " + wap.p + " to " + dst);
      }
    } catch (IOException ioe) {
      LOG.error("Couldn't rename " + wap.p + " to " + dst, ioe);
      thrown.add(ioe);
      continue;
    }
    paths.add(dst);
  }
  if (!thrown.isEmpty()) {
    throw MultipleIOException.createIOException(thrown);
  }

  closeAndCleanCompleted = true;
  return paths;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:49,代码来源:HLogSplitter.java


注:本文中的org.apache.hadoop.hbase.HBaseFileSystem.deleteFileFromFileSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。