Package org.apache.hadoop.hbase.io

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


      try {
        FileLink link = null;
        switch (fileInfo.getType()) {
          case HFILE:
            Path inputPath = new Path(fileInfo.getHfile());
            link = new HFileLink(inputRoot, inputArchive, inputPath);
            break;
          case WAL:
            link = new HLogLink(inputRoot, fileInfo.getWalServer(), fileInfo.getWalName());
            break;
          default:
View Full Code Here


      Reference reference = Reference.read(fs, status.getPath());
      return new StoreFileInfo(conf, fs, status, reference);
    }

    // else create a store file link. The link file does not exists on filesystem though.
    HFileLink link = new HFileLink(conf,
      HFileLink.createPath(regionInfoForFs.getTable(), regionInfoForFs.getEncodedName()
        , familyName, status.getPath().getName()));
    return new StoreFileInfo(conf, fs, status, link);
  }
View Full Code Here

   * @param storeFilePath
   * @return a FileLink which could read from pre-namespace paths.
   * @throws IOException
   */
  public FileLink getFileLinkWithPreNSPath(Path storeFilePath) throws IOException {
    HFileLink link = new HFileLink(getConf(), storeFilePath);
    List<Path> pathsToProcess = getPreNSPathsForHFileLink(link);
    pathsToProcess.addAll(Arrays.asList(link.getLocations()));
    return new FileLink(pathsToProcess);
  }
View Full Code Here

    final ArrayList corruptedFiles = new ArrayList();
    SnapshotReferenceUtil.visitTableStoreFiles(fs, snapshotDir, new FSVisitor.StoreFileVisitor() {
      public void storeFile (final String region, final String family, final String hfile)
          throws IOException {
        HFileLink link = HFileLink.create(util.getConfiguration(), table, region, family, hfile);
        if (corruptedFiles.size() % 2 == 0) {
          fs.delete(link.getAvailablePath(fs));
          corruptedFiles.add(hfile);
        }
      }
    });
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

     * @return the store file information
     */
    FileInfo addStoreFile(final String region, final String family, final String hfile)
          throws IOException {
      TableName table = snapshotTable;
      HFileLink link = HFileLink.create(conf, table, region, family, hfile);
      boolean inArchive = false;
      long size = -1;
      try {
        if ((inArchive = fs.exists(link.getArchivePath()))) {
          size = fs.getFileStatus(link.getArchivePath()).getLen();
          hfileArchiveSize += size;
          hfileArchiveCount++;
        } else {
          size = link.getFileStatus(fs).getLen();
          hfileSize += size;
          hfilesCount++;
        }
      } catch (FileNotFoundException e) {
        hfilesMissing++;
View Full Code Here

      linkPath = new Path(family, HFileLink.createHFileLinkName(tableName,
        regionInfo.getEncodedName(), fileName));
    }

    // check if the linked file exists (in the archive, or in the table dir)
    HFileLink link = new HFileLink(services.getConfiguration(), linkPath);
    if (!link.exists(fs)) {
      throw new CorruptedSnapshotException("Can't find hfile: " + fileName
          + " in the real (" + link.getOriginPath() + ") or archive (" + link.getArchivePath()
          + ") directory for the primary table.", snapshot);
    }
  }
View Full Code Here

    Path preNamespaceTempPath = new Path(rootDir, ".tmp/table/21212abcdc33/cf/0906db948c48");
    boolean preNSTablePathExists = false;
    boolean preNSArchivePathExists = false;
    boolean preNSTempPathExists = false;
    assertTrue(HFileLink.isHFileLink(aFileLink));
    HFileLink hFileLink = new HFileLink(TEST_UTIL.getConfiguration(), aFileLink);
    assertTrue(hFileLink.getArchivePath().toString().startsWith(rootDir.toString()));

    HFileV1Detector t = new HFileV1Detector();
    t.setConf(TEST_UTIL.getConfiguration());
    FileLink fileLink = t.getFileLinkWithPreNSPath(aFileLink);
    //assert it has 6 paths (2 NS, 2 Pre NS, and 2 .tmp)  to look.
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) || StoreFileInfo.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

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.