/** * This method will clean up the local folders and files created during compaction process */ private void deleteTempStoreLocation() { if (null != tempStoreLocation) { for (String tempLoc : tempStoreLocation) { try { CarbonUtil.deleteFoldersAndFiles(new File(tempLoc)); } catch (IOException | InterruptedException e) { LOGGER.error("Problem deleting local folders during compaction: " + e.getMessage()); } } } }
/** * This method will be used to delete sort temp location is it is exites */ public static void deleteSortLocationIfExists(String[] locations) { for (String loc : locations) { File file = new File(loc); if (file.exists()) { try { CarbonUtil.deleteFoldersAndFiles(file); } catch (IOException | InterruptedException e) { LOGGER.error("Failed to delete " + loc, e); } } } }
@Override public Void call() throws Exception { long startTime = System.currentTimeMillis(); String[] locArray = StringUtils.split(localStoreLocations, File.pathSeparator); for (String loc : locArray) { try { CarbonUtil.deleteFoldersAndFiles(new File(loc)); } catch (IOException | InterruptedException e) { LOGGER.error("Failed to delete local data load folder location: " + loc, e); } } LOGGER.info( "Deleted the local store location: " + localStoreLocations + " : Time taken: " + ( System.currentTimeMillis() - startTime)); return null; } });
public static void deleteStorePath(String path) { try { FileType fileType = FileFactory.getFileType(path); if (FileFactory.isFileExist(path, fileType)) { CarbonFile carbonFile = FileFactory.getCarbonFile(path, fileType); CarbonUtil.deleteFoldersAndFiles(carbonFile); } } catch (IOException | InterruptedException e) { LOGGER.error("Unable to delete the given path :: " + e.getMessage()); } }
public CarbonLoadModel createTableAndLoadModel(boolean deleteOldStore) throws Exception { if (deleteOldStore) { File storeDir = new File(storePath); CarbonUtil.deleteFoldersAndFiles(storeDir); } CarbonTable table = createTable(absoluteTableIdentifier); writeDictionary(csvPath, table); return buildCarbonLoadModel(table, csvPath, absoluteTableIdentifier); }
public static void dropDatabaseDirectory(String databasePath) throws IOException, InterruptedException { FileFactory.FileType fileType = FileFactory.getFileType(databasePath); if (FileFactory.isFileExist(databasePath, fileType)) { CarbonFile dbPath = FileFactory.getCarbonFile(databasePath, fileType); CarbonUtil.deleteFoldersAndFiles(dbPath); } }
CarbonUtil.deleteFoldersAndFiles(invalidFile); return true; } catch (IOException e) {
CarbonUtil.deleteFoldersAndFiles(staleFolder); } catch (IOException | InterruptedException e) { LOGGER.error("Failed to delete stale folder: " + e.getMessage());