/** * Removes the empty Meta recovery WAL directory. * @param walFactoryId A unique identifier for WAL factory which was used by Filesystem to make a * Meta recovery WAL directory inside WAL directory path. */ private void removeHBCKMetaRecoveryWALDir(String walFactoryId) throws IOException { Path walLogDir = new Path(new Path(CommonFSUtils.getWALRootDir(getConf()), HConstants.HREGION_LOGDIR_NAME), walFactoryId); FileSystem fs = CommonFSUtils.getWALFileSystem(getConf()); FileStatus[] walFiles = FSUtils.listStatus(fs, walLogDir, null); if (walFiles == null || walFiles.length == 0) { LOG.info("HBCK meta recovery WAL directory is empty, removing it now."); if (!FSUtils.deleteDirectory(fs, walLogDir)) { LOG.warn("Couldn't clear the HBCK Meta recovery WAL directory " + walLogDir); } } }
/** * Delete the region directory if exists. * @param conf * @param hri * @return True if deleted the region directory. * @throws IOException */ public static boolean deleteRegionDir(final Configuration conf, final HRegionInfo hri) throws IOException { Path rootDir = getRootDir(conf); FileSystem fs = rootDir.getFileSystem(conf); return deleteDirectory(fs, new Path(getTableDir(rootDir, hri.getTable()), hri.getEncodedName())); }
if (!FSUtils.deleteDirectory(fs, tempPath)) { LOG.warn("Failed cleanup of " + tempPath);
private void cleanupTmpDir() throws IOException { FSUtils.deleteDirectory(this.fs, getTmpDir()); }
/** * Deletes a table's directory from the file system if exists. Used in unit * tests. */ public static void deleteTableDescriptorIfExists(String tableName, Configuration conf) throws IOException { FileSystem fs = FSUtils.getCurrentFileSystem(conf); FileStatus status = getTableInfoPath(fs, FSUtils.getRootDir(conf), tableName); // The below deleteDirectory works for either file or directory. if (status != null && fs.exists(status.getPath())) { FSUtils.deleteDirectory(fs, status.getPath()); } }
/** * Stops mini hbase, zk, and hdfs clusters. * * @see {@link #startMiniCluster(int)} */ public void shutdownMiniCluster() throws Exception { LOG.info("Shutting down minicluster"); shutdownMiniHBaseCluster(); if (!this.passedZkCluster) { shutdownMiniZKCluster(); } shutdownMiniDFSCluster(); // Lily Change: if clearData is true, delete the clusterTestBuildDir if (clearData) { // Clean up our directory. if (this.clusterTestDir != null && this.clusterTestDir.exists()) { // Need to use deleteDirectory because File.delete required dir is empty. if (!FSUtils.deleteDirectory(FileSystem.getLocal(this.conf), new Path(this.clusterTestDir.toString()))) { LOG.warn("Failed delete of " + this.clusterTestDir.toString()); } this.clusterTestDir = null; } } LOG.info("Minicluster is down"); }
boolean removedExistingSubdir = FSUtils.deleteDirectory(fs, tableInfoDir); if (removedExistingSubdir) { LOG.info("Removed existing subdir at: " + tableInfoDir);
/** * Delete the region directory if exists. * @param conf * @param hri * @return True if deleted the region directory. * @throws IOException */ public static boolean deleteRegionDir(final Configuration conf, final HRegionInfo hri) throws IOException { Path rootDir = getRootDir(conf); FileSystem fs = rootDir.getFileSystem(conf); return deleteDirectory(fs, new Path(getTableDir(rootDir, hri.getTable()), hri.getEncodedName())); }
if (!FSUtils.deleteDirectory(fs, p)) { LOG.warn("Failed cleanup of " + p); if (!FSUtils.deleteDirectory(fs, status.getPath())) { LOG.warn("Failed delete of " + status.getPath() + "; continuing");
if (!FSUtils.deleteDirectory(fs, tempPath)) { LOG.warn("Failed cleanup of " + tempPath);
FSUtils.deleteDirectory(this.fs, new Path(regiondir, MERGEDIR));