/** * Get the full path of the HFile referenced by the back reference * * @param conf {@link Configuration} to read for the archive directory name * @param linkRefPath Link Back Reference path * @return full path of the referenced hfile * @throws IOException on unexpected error. */ public static Path getHFileFromBackReference(final Configuration conf, final Path linkRefPath) throws IOException { return getHFileFromBackReference(FSUtils.getRootDir(conf), linkRefPath); }
hfilePath = HFileLink.getHFileFromBackReference( new Path(FSUtils.getRootDir(getConf()), HConstants.HBASE_TEMP_DIRECTORY), filePath); if (fs.exists(hfilePath)) { hfilePath = HFileLink.getHFileFromBackReference(MobUtils.getMobHome(getConf()), filePath); if (fs.exists(hfilePath)) { return false; hfilePath = HFileLink.getHFileFromBackReference(FSUtils.getRootDir(getConf()), filePath); return !fs.exists(hfilePath); } catch (IOException e) {
tableName.getNameAsString().replace(TableName.NAMESPACE_DELIM, '=')); Path linkPath = new Path(cfDir, refStoreFileName); assertEquals(linkPath, HFileLink.getHFileFromBackReference(rootDir, storeFileDir));
/** * Get the full path of the HFile referenced by the back reference * * @param conf {@link Configuration} to read for the archive directory name * @param linkRefPath Link Back Reference path * @return full path of the referenced hfile * @throws IOException on unexpected error. */ public static Path getHFileFromBackReference(final Configuration conf, final Path linkRefPath) throws IOException { return getHFileFromBackReference(FSUtils.getRootDir(conf), linkRefPath); }
/** * Get the full path of the HFile referenced by the back reference * * @param conf {@link Configuration} to read for the archive directory name * @param linkRefPath Link Back Reference path * @return full path of the referenced hfile * @throws IOException on unexpected error. */ public static Path getHFileFromBackReference(final Configuration conf, final Path linkRefPath) throws IOException { return getHFileFromBackReference(FSUtils.getRootDir(conf), linkRefPath); } }
@Override public synchronized boolean isFileDeletable(Path filePath) { if (this.fs == null) return false; // HFile Link is always deletable if (HFileLink.isHFileLink(filePath)) return true; // If the file is inside a link references directory, means that is a back ref link. // The back ref can be deleted only if the referenced file doesn't exists. Path parentDir = filePath.getParent(); if (HFileLink.isBackReferencesDir(parentDir)) { try { Path hfilePath = HFileLink.getHFileFromBackReference(getConf(), filePath); return !fs.exists(hfilePath); } catch (IOException e) { LOG.error("Couldn't verify if the referenced file still exists, keep it just in case"); return false; } } // HFile is deletable only if has no links try { Path backRefDir = HFileLink.getBackReferencesDir(parentDir, filePath.getName()); return FSUtils.listStatus(fs, backRefDir) == null; } catch (IOException e) { LOG.error("Couldn't get the references, not deleting file, just in case"); return false; } }
hfilePath = HFileLink.getHFileFromBackReference( new Path(FSUtils.getRootDir(getConf()), HConstants.HBASE_TEMP_DIRECTORY), filePath); if (fs.exists(hfilePath)) { return false; hfilePath = HFileLink.getHFileFromBackReference(FSUtils.getRootDir(getConf()), filePath); return !fs.exists(hfilePath); } catch (IOException e) {
tableName.getNameAsString().replace(TableName.NAMESPACE_DELIM, '=')); Path linkPath = new Path(cfDir, refStoreFileName); assertEquals(linkPath, HFileLink.getHFileFromBackReference(rootDir, storeFileDir));