@Test public void testCleanupIndexOpWithoutCommonParentVolume() throws IOException { File v1 = new File(accumuloDir, "v1"), v2 = new File(accumuloDir, "v2"); assertTrue(v1.mkdirs() || v1.isDirectory()); assertTrue(v2.mkdirs() || v2.isDirectory()); File tmp1 = new File(v1, "tmp"), tmp2 = new File(v2, "tmp"); assertTrue(tmp1.mkdirs() || tmp1.isDirectory()); assertTrue(tmp2.mkdirs() || tmp2.isDirectory()); Path tmpPath1 = new Path(tmp1.toURI()), tmpPath2 = new Path(tmp2.toURI()); HashMap<Property,String> testProps = new HashMap<>(); testProps.put(Property.INSTANCE_VOLUMES, v1.toURI() + "," + v2.toURI()); try (var fs = VolumeManagerImpl.getLocalForTesting(accumuloDir.getAbsolutePath())) { FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<>()); assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists()); FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<>()); assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists()); } }
protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator> readers) throws IOException { for (FileSKVIterator r : readers) { try { if (r != null) r.close(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } } if (tmpDir != null) { FileSystem actualFs = fs.getFileSystemByPath(tmpDir); if (actualFs.exists(tmpDir)) { fs.deleteRecursively(tmpDir); return; } log.error("Did not delete tmp dir because it wasn't a tmp dir {}", tmpDir); } }
FileUtil { protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator> readers) throws IOException { for (FileSKVIterator r : readers) { try { if (r != null) r.close(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } } if (tmpDir != null) { FileSystem actualFs = fs.getFileSystemByPath(tmpDir); if (actualFs.exists(tmpDir)) { fs.deleteRecursively(tmpDir); return; } log.error("Did not delete tmp dir because it wasn't a tmp dir {}", tmpDir); } } }
FileUtil { protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator> readers) throws IOException { for (FileSKVIterator r : readers) { try { if (r != null) r.close(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } } if (tmpDir != null) { FileSystem actualFs = fs.getFileSystemByPath(tmpDir); if (actualFs.exists(tmpDir)) { fs.deleteRecursively(tmpDir); return; } log.error("Did not delete tmp dir because it wasn't a tmp dir {}", tmpDir); } }  }
FileUtil { protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator> readers) throws IOException { for (FileSKVIterator r : readers) { try { if (r != null) r.close(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } } if (tmpDir != null) { FileSystem actualFs = fs.getFileSystemByPath(tmpDir); if (actualFs.exists(tmpDir)) { fs.deleteRecursively(tmpDir); return; } log.error("Did not delete tmp dir because it wasn't a tmp dir {}", tmpDir); } }  static Collection<TabletFile> reduceFiles(ServerContext context, Configuration conf,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, int maxFiles, Path tmpDir,
      int pass); static SortedMap<Double,Key> findMidPoint(ServerContext context, String tabletDir,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, double minSplit); static double estimatePercentageLTE(ServerContext context, String tabletDir,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, Text splitRow); static SortedMap<Double,Key> findMidPoint(ServerContext context, String tabletDirectory,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, double minSplit,
      boolean useIndex); static Map<TabletFile,FileInfo> tryToGetFirstAndLastRows(ServerContext context,
      Set<TabletFile> mapfiles); static WritableComparable<Key> findLastKey(ServerContext context,
      Collection<TabletFile> mapFiles); static Map<KeyExtent,Long> estimateSizes(ServerContext context, Path mapFile,
      long fileSize, List<KeyExtent> extents); }
FileUtil { protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator> readers) throws IOException { for (FileSKVIterator r : readers) { try { if (r != null) r.close(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } } if (tmpDir != null) { FileSystem actualFs = fs.getFileSystemByPath(tmpDir); if (actualFs.exists(tmpDir)) { fs.deleteRecursively(tmpDir); return; } log.error("Did not delete tmp dir because it wasn't a tmp dir {}", tmpDir); } }  static Collection<TabletFile> reduceFiles(ServerContext context, Configuration conf,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, int maxFiles, Path tmpDir,
      int pass); static SortedMap<Double,Key> findMidPoint(ServerContext context, String tabletDir,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, double minSplit); static double estimatePercentageLTE(ServerContext context, String tabletDir,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, Text splitRow); static SortedMap<Double,Key> findMidPoint(ServerContext context, String tabletDirectory,
      Text prevEndRow, Text endRow, Collection<TabletFile> mapFiles, double minSplit,
      boolean useIndex); static Map<TabletFile,FileInfo> tryToGetFirstAndLastRows(ServerContext context,
      Set<TabletFile> mapfiles); static WritableComparable<Key> findLastKey(ServerContext context,
      Collection<TabletFile> mapFiles); static Map<KeyExtent,Long> estimateSizes(ServerContext context, Path mapFile,
      long fileSize, List<KeyExtent> extents);  }