This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ed60943d4c OAK-11690 : removed usage of Guava's Iterators.partition 
with oak-commons (#2274)
ed60943d4c is described below

commit ed60943d4c94a5da3977f0c5e55779ceaf29ba9a
Author: Rishabh Kumar <rishabhdaim1...@gmail.com>
AuthorDate: Thu May 8 10:16:16 2025 +0530

    OAK-11690 : removed usage of Guava's Iterators.partition with oak-commons 
(#2274)
    
    Co-authored-by: Rishabh Kumar <d...@adobe.com>
---
 .../jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java      | 5 +++--
 .../jackrabbit/oak/plugins/document/VersionGarbageCollector.java    | 6 ++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git 
a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
 
b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
index ec017e40d2..aa3eb76fb3 100644
--- 
a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
+++ 
b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java
@@ -65,6 +65,7 @@ import org.apache.jackrabbit.core.data.DataRecord;
 import org.apache.jackrabbit.core.data.DataStoreException;
 import org.apache.jackrabbit.oak.api.jmx.CheckpointMBean;
 import org.apache.jackrabbit.oak.commons.FileIOUtils;
+import org.apache.jackrabbit.oak.commons.collections.IteratorUtils;
 import org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator;
 import org.apache.jackrabbit.oak.commons.time.Stopwatch;
 import org.apache.jackrabbit.oak.plugins.blob.datastore.BlobIdTracker;
@@ -522,7 +523,7 @@ public class MarkSweepGarbageCollector implements 
BlobGarbageCollector {
             iterator =
                     FileUtils.lineIterator(fs.getGcCandidates(), 
StandardCharsets.UTF_8.name());
 
-            Iterator<List<String>> partitions = Iterators.partition(iterator, 
getBatchCount());
+            Iterator<List<String>> partitions = 
IteratorUtils.partition(iterator, getBatchCount());
             while (partitions.hasNext()) {
                 List<String> ids = partitions.next();
                 count += ids.size();
@@ -639,7 +640,7 @@ public class MarkSweepGarbageCollector implements 
BlobGarbageCollector {
 
                             try {
                                 Iterator<String> idIter = 
blobStore.resolveChunks(blobId);
-                                Iterator<List<String>> partitions = 
Iterators.partition(idIter, getBatchCount());
+                                Iterator<List<String>> partitions = 
IteratorUtils.partition(idIter, getBatchCount());
                                 while (partitions.hasNext()) {
                                     List<String> idBatch = 
partitions.next().stream()
                                             .map(id -> {
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
index 418da521b7..2f5eabd780 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
@@ -77,7 +77,6 @@ import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
 
-import static org.apache.jackrabbit.guava.common.collect.Iterators.partition;
 import static java.util.concurrent.TimeUnit.MICROSECONDS;
 import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
 import static org.apache.jackrabbit.oak.plugins.document.Collection.SETTINGS;
@@ -2441,7 +2440,7 @@ public class VersionGarbageCollector {
             }
             monitor.info("Proceeding to delete [{}] documents [{}]", 
numDocuments, label);
 
-            Iterator<List<String>> idListItr = partition(docIdsToDelete, 
DELETE_BATCH_SIZE);
+            Iterator<List<String>> idListItr = 
IteratorUtils.partition(docIdsToDelete, DELETE_BATCH_SIZE);
             int deletedCount = 0;
             int lastLoggedCount = 0;
             int recreatedCount = 0;
@@ -2542,8 +2541,7 @@ public class VersionGarbageCollector {
 
             int deletedCount = 0;
             int lastLoggedCount = 0;
-            Iterator<List<String>> idListItr =
-                    partition(getPrevDocIdsToDelete(), DELETE_BATCH_SIZE);
+            Iterator<List<String>> idListItr = 
IteratorUtils.partition(getPrevDocIdsToDelete(), DELETE_BATCH_SIZE);
             while (idListItr.hasNext() && !cancel.get()) {
                 List<String> deletionBatch = idListItr.next();
                 deletedCount += deletionBatch.size();

Reply via email to