diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java index 72a46691838..6496f500e9f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java @@ -606,16 +606,24 @@ private TableMgmtStats manageTablets(Iterator iter, state, goal, actions, tm.getLogs().size()); } - if (actions.contains(ManagementAction.NEEDS_SPLITTING)) { + final boolean needsSplit = actions.contains(ManagementAction.NEEDS_SPLITTING); + if (needsSplit) { LOG.debug("{} may need splitting.", tm.getExtent()); manager.getSplitter().initiateSplit(new SeedSplitTask(manager, tm.getExtent())); } if (actions.contains(ManagementAction.NEEDS_COMPACTING) && compactionGenerator != null) { - var jobs = compactionGenerator.generateJobs(tm, - TabletManagementIterator.determineCompactionKinds(actions)); - LOG.debug("{} may need compacting adding {} jobs", tm.getExtent(), jobs.size()); - manager.getCompactionCoordinator().addJobs(tm, jobs); + // Check if tablet needs splitting, priority should be giving to splits over + // compactions because it's best to compact after a split + if (!needsSplit) { + var jobs = compactionGenerator.generateJobs(tm, + TabletManagementIterator.determineCompactionKinds(actions)); + LOG.debug("{} may need compacting adding {} jobs", tm.getExtent(), jobs.size()); + manager.getCompactionCoordinator().addJobs(tm, jobs); + } else { + LOG.trace("skipping compaction job generation because {} may need splitting.", + tm.getExtent()); + } } if (actions.contains(ManagementAction.NEEDS_LOCATION_UPDATE) diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java index 925da279fc5..4e49b825b0f 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java @@ -852,10 +852,14 @@ public boolean test(TabletMetadata tabletMetadata) { final FileSystem fs = vol.getFileSystem(); for (ExternalCompactionId ecid : ecidsForTablet) { final String fileSuffix = "_tmp_" + ecid.canonical(); - FileStatus[] files = fs.listStatus(new Path(volPath), (path) -> { - return path.getName().endsWith(fileSuffix); - }); - if (files.length > 0) { + FileStatus[] files = null; + try { + files = fs.listStatus(new Path(volPath), + (path) -> path.getName().endsWith(fileSuffix)); + } catch (FileNotFoundException e) { + LOG.trace("Failed to list tablet dir {}", volPath, e); + } + if (files != null) { for (FileStatus file : files) { if (!fs.delete(file.getPath(), false)) { LOG.warn("Unable to delete ecid tmp file: {}: ", file.getPath());