This is an automated email from the ASF dual-hosted git repository. ddanielr pushed a commit to branch 3.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit eb7f7833b6fe21c664196217e66d911c9e83dc45 Merge: 0f6bcf8cbc 2950699947 Author: Daniel Roberts ddanielr <ddani...@gmail.com> AuthorDate: Wed Mar 12 01:19:08 2025 +0000 Merge branch '2.1' into 3.1 .../main/java/org/apache/accumulo/gc/GCRun.java | 40 +++++++++++++++++----- .../accumulo/gc/GarbageCollectionAlgorithm.java | 9 +++-- .../accumulo/gc/SimpleGarbageCollectorTest.java | 3 +- 3 files changed, 40 insertions(+), 12 deletions(-) diff --cc server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java index f298e724d1,22275c9e11..d47f75c36b --- a/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java +++ b/server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java @@@ -63,6 -66,9 +65,7 @@@ import org.apache.accumulo.core.metadat import org.apache.accumulo.core.metadata.schema.TabletMetadata; import org.apache.accumulo.core.metadata.schema.TabletsMetadata; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.util.Pair; + import org.apache.accumulo.core.util.Timer; -import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.core.util.threads.ThreadPools; import org.apache.accumulo.core.volume.Volume; import org.apache.accumulo.server.ServerContext; @@@ -279,15 -296,17 +287,17 @@@ public class GCRun implements GarbageCo List<GcCandidate> processedDeletes = Collections.synchronizedList(new ArrayList<>()); - minimizeDeletes(confirmedDeletes, processedDeletes, fs, log); + minimizeDeletes(confirmedDeletes, processedDeletes, fs, log, loggingInterval); - ExecutorService deleteThreadPool = ThreadPools.getServerThreadPools() + ThreadPoolExecutor deleteThreadPool = ThreadPools.getServerThreadPools() .createExecutorService(config, Property.GC_DELETE_THREADS); - final List<Pair<Path,Path>> replacements = context.getVolumeReplacements(); + final Map<Path,Path> replacements = context.getVolumeReplacements(); + log.info("Batch {} attempting to delete {} gcCandidate files", batchCount.get(), + confirmedDeletes.size()); + Timer timer = Timer.startNew(); for (final GcCandidate delete : confirmedDeletes.values()) { - Runnable deleteTask = () -> { boolean removeFlag = false; @@@ -406,9 -430,34 +421,10 @@@ inUse += i; } - @Override - @Deprecated - public Iterator<Map.Entry<String,Replication.Status>> getReplicationNeededIterator() { - AccumuloClient client = context; - try { - Scanner s = org.apache.accumulo.core.replication.ReplicationTable.getScanner(client); - org.apache.accumulo.core.replication.ReplicationSchema.StatusSection.limit(s); - return Iterators.transform(s.iterator(), input -> { - String file = input.getKey().getRow().toString(); - Replication.Status stat; - try { - stat = Replication.Status.parseFrom(input.getValue().get()); - } catch (InvalidProtocolBufferException e) { - log.warn("Could not deserialize protobuf for: {}", input.getKey()); - stat = null; - } - return Maps.immutableEntry(file, stat); - }); - } catch (org.apache.accumulo.core.replication.ReplicationTableOfflineException e) { - // No elements that we need to preclude - return Collections.emptyIterator(); - } - } - @VisibleForTesting static void minimizeDeletes(SortedMap<String,GcCandidate> confirmedDeletes, - List<GcCandidate> processedDeletes, VolumeManager fs, Logger logger) { + List<GcCandidate> processedDeletes, VolumeManager fs, Logger logger, + Duration loggingInterval) { Set<Path> seenVolumes = new HashSet<>(); // when deleting a dir and all files in that dir, only need to delete the dir.