Package org.apache.hadoop.hbase.io

Examples of org.apache.hadoop.hbase.io.HFileLink


    SnapshotReferenceUtil.visitReferencedFiles(fs, snapshotDir,
      new SnapshotReferenceUtil.FileVisitor() {
        public void storeFile (final String region, final String family, final String hfile)
            throws IOException {
          Path path = new Path(family, HFileLink.createHFileLinkName(table, region, hfile));
          long size = new HFileLink(conf, path).getFileStatus(fs).getLen();
          files.add(new Pair<Path, Long>(path, size));
        }

        public void recoveredEdits (final String region, final String logfile)
            throws IOException {
View Full Code Here


    this.dataBlockEncoder =
        dataBlockEncoder == null ? NoOpDataBlockEncoder.INSTANCE
            : dataBlockEncoder;

    if (HFileLink.isHFileLink(p)) {
      this.link = new HFileLink(conf, p);
      LOG.debug("Store file " + p + " is a link");
    } else if (isReference(p)) {
      this.reference = Reference.read(fs, p);
      this.referencePath = getReferredToFile(this.path);
      if (HFileLink.isHFileLink(this.referencePath)) {
        this.link = new HFileLink(conf, this.referencePath);
      }
      LOG.debug("Store file " + p + " is a " + reference.getFileRegion() +
        " reference to " + this.referencePath);
    } else if (!isHFile(p)) {
      throw new IOException("path=" + path + " doesn't look like a valid StoreFile");
View Full Code Here

    }

    private FSDataInputStream openSourceFile(final Path path) {
      try {
        if (HFileLink.isHFileLink(path)) {
          return new HFileLink(inputRoot, inputArchive, path).open(inputFs);
        } else if (isHLogLinkPath(path)) {
          String serverName = path.getParent().getName();
          String logName = path.getName();
          return new HLogLink(inputRoot, serverName, logName).open(inputFs);
        }
View Full Code Here

    }

    private FileStatus getFileStatus(final FileSystem fs, final Path path) {
      try {
        if (HFileLink.isHFileLink(path)) {
          HFileLink link = new HFileLink(inputRoot, inputArchive, path);
          return link.getFileStatus(fs);
        } else if (isHLogLinkPath(path)) {
          String serverName = path.getParent().getName();
          String logName = path.getName();
          return new HLogLink(inputRoot, serverName, logName).getFileStatus(fs);
        }
View Full Code Here

    Path outPath = new Path(familyDir, refLink + '.' + clonedRegionName);

    // Create the new reference
    Path linkPath = new Path(familyDir,
      HFileLink.createHFileLinkName(tableName, regionInfo.getEncodedName(), hfileName));
    InputStream in = new HFileLink(conf, linkPath).open(fs);
    OutputStream out = fs.create(outPath);
    IOUtils.copyBytes(in, out, conf);
  }
View Full Code Here

    SnapshotReferenceUtil.visitReferencedFiles(fs, snapshotDir,
      new SnapshotReferenceUtil.FileVisitor() {
        public void storeFile (final String region, final String family, final String hfile)
            throws IOException {
          Path path = new Path(family, HFileLink.createHFileLinkName(table, region, hfile));
          HFileLink link = new HFileLink(conf, path);
          boolean inArchive = false;
          long size = -1;
          try {
            if ((inArchive = fs.exists(link.getArchivePath()))) {
              size = fs.getFileStatus(link.getArchivePath()).getLen();
              hfileArchiveSize.addAndGet(size);
              hfileArchiveCount.addAndGet(1);
            } else {
              size = link.getFileStatus(fs).getLen();
              hfileSize.addAndGet(size);
              hfilesCount.addAndGet(1);
            }
          } catch (FileNotFoundException e) {
            hfilesMissing.addAndGet(1);
View Full Code Here

    Path outPath = new Path(familyDir, refLink + '.' + clonedRegionName);

    // Create the new reference
    InputStream in;
    if (linkPath != null) {
      in = new HFileLink(conf, linkPath).open(fs);
    } else {
      linkPath = new Path(new Path(HRegion.getRegionDir(snapshotDir, regionInfo.getEncodedName()),
                      familyDir.getName()), hfileName);
      in = fs.open(linkPath);
    }
View Full Code Here

    SnapshotReferenceUtil.visitReferencedFiles(fs, snapshotDir,
      new SnapshotReferenceUtil.FileVisitor() {
        public void storeFile (final String region, final String family, final String hfile)
            throws IOException {
          Path path = HFileLink.createPath(table, region, family, hfile);
          long size = new HFileLink(conf, path).getFileStatus(fs).getLen();
          files.add(new Pair<Path, Long>(path, size));
        }

        public void recoveredEdits (final String region, final String logfile)
            throws IOException {
View Full Code Here

     * if the file is not found.
     */
    private FSDataInputStream openSourceFile(Context context, final Path path) throws IOException {
      try {
        if (HFileLink.isHFileLink(path) || StoreFile.isReference(path)) {
          return new HFileLink(inputRoot, inputArchive, path).open(inputFs);
        } else if (isHLogLinkPath(path)) {
          String serverName = path.getParent().getName();
          String logName = path.getName();
          return new HLogLink(inputRoot, serverName, logName).open(inputFs);
        }
View Full Code Here

    }

    private FileStatus getSourceFileStatus(Context context, final Path path) throws IOException {
      try {
        if (HFileLink.isHFileLink(path) || StoreFile.isReference(path)) {
          HFileLink link = new HFileLink(inputRoot, inputArchive, path);
          return link.getFileStatus(inputFs);
        } else if (isHLogLinkPath(path)) {
          String serverName = path.getParent().getName();
          String logName = path.getName();
          return new HLogLink(inputRoot, serverName, logName).getFileStatus(inputFs);
        }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.HFileLink

Copyright © 2018 www.massapicom. 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.