This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch OAK-11519 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 08832828f029cfd32631083c3a6c6132aa5507ac Author: Rishabh Kumar <[email protected]> AuthorDate: Mon Feb 24 19:43:44 2025 +0530 OAK-11519 : removed usage of Iterables.partition with oak-commons (IterableUtils) --- .../org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java | 4 ++-- .../org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java | 4 ++-- .../apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java | 4 ++-- .../apache/jackrabbit/oak/plugins/document/UnsavedModifications.java | 3 ++- .../jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java | 3 ++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java index 2964c840f0..c925f9bb03 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java @@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.plugins.document; import static org.apache.jackrabbit.oak.commons.conditions.Validate.checkArgument; import static java.util.Objects.requireNonNull; -import static org.apache.jackrabbit.guava.common.collect.Iterables.partition; import static org.apache.jackrabbit.guava.common.collect.Iterables.transform; import static java.util.Collections.singletonList; import static java.util.Objects.nonNull; @@ -82,6 +81,7 @@ import org.apache.jackrabbit.oak.api.CommitFailedException; import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.cache.CacheStats; import org.apache.jackrabbit.oak.commons.PerfLogger; +import org.apache.jackrabbit.oak.commons.collections.IterableUtils; import org.apache.jackrabbit.oak.commons.collections.ListUtils; import org.apache.jackrabbit.oak.commons.collections.SetUtils; import org.apache.jackrabbit.oak.commons.conditions.Validate; @@ -1981,7 +1981,7 @@ public final class DocumentNodeStore new ResetDiff(previous.asTrunkRevision(), operations)); LOG.debug("reset: applying {} operations", operations.size()); // apply reset operations - for (List<UpdateOp> ops : partition(operations.values(), getCreateOrUpdateBatchSize())) { + for (List<UpdateOp> ops : IterableUtils.partition(operations.values(), getCreateOrUpdateBatchSize())) { store.createOrUpdate(NODES, ops); } } diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java index b5a81c639f..94d160445b 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingBcSweeper2.java @@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.plugins.document; import static java.util.Objects.requireNonNull; import static org.apache.jackrabbit.guava.common.collect.Iterables.filter; -import static org.apache.jackrabbit.guava.common.collect.Iterables.partition; import static org.apache.jackrabbit.guava.common.collect.Iterables.transform; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.COMMITROOT_OR_REVISIONS; @@ -33,6 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import org.apache.jackrabbit.oak.commons.TimeDurationFormatter; +import org.apache.jackrabbit.oak.commons.collections.IterableUtils; import org.apache.jackrabbit.oak.plugins.document.util.Utils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -120,7 +120,7 @@ final class MissingBcSweeper2 { lastLog = startOfScan; Iterable<Map.Entry<Path, UpdateOp>> ops = sweepOperations(documents); - for (List<Map.Entry<Path, UpdateOp>> batch : partition(ops, INVALIDATE_BATCH_SIZE)) { + for (List<Map.Entry<Path, UpdateOp>> batch : IterableUtils.partition(ops, INVALIDATE_BATCH_SIZE)) { Map<Path, UpdateOp> updates = new HashMap<>(); for (Map.Entry<Path, UpdateOp> entry : batch) { updates.put(entry.getKey(), entry.getValue()); diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java index 4ef6929c8a..cf76ae8f78 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import org.apache.jackrabbit.oak.commons.TimeDurationFormatter; +import org.apache.jackrabbit.oak.commons.collections.IterableUtils; import org.apache.jackrabbit.oak.plugins.document.util.Utils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,7 +33,6 @@ import org.slf4j.LoggerFactory; import static java.util.Objects.requireNonNull; import static org.apache.jackrabbit.guava.common.collect.Iterables.filter; -import static org.apache.jackrabbit.guava.common.collect.Iterables.partition; import static org.apache.jackrabbit.guava.common.collect.Iterables.transform; import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.isDeletedEntry; import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.removeCommitRoot; @@ -150,7 +150,7 @@ final class NodeDocumentSweeper { } Iterable<Map.Entry<Path, UpdateOp>> ops = sweepOperations(documents); - for (List<Map.Entry<Path, UpdateOp>> batch : partition(ops, INVALIDATE_BATCH_SIZE)) { + for (List<Map.Entry<Path, UpdateOp>> batch : IterableUtils.partition(ops, INVALIDATE_BATCH_SIZE)) { Map<Path, UpdateOp> updates = new HashMap<>(); for (Map.Entry<Path, UpdateOp> entry : batch) { updates.put(entry.getKey(), entry.getValue()); diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java index ebf55bcbde..b8a6f184aa 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.function.Supplier; +import org.apache.jackrabbit.oak.commons.collections.IterableUtils; import org.apache.jackrabbit.oak.plugins.document.util.MapFactory; import org.apache.jackrabbit.oak.plugins.document.util.Utils; import org.jetbrains.annotations.NotNull; @@ -164,7 +165,7 @@ class UnsavedModifications { stats.num = pending.size(); List<UpdateOp> updates = new ArrayList<>(); Map<Path, Revision> pathToRevision = new HashMap<>(); - for (Iterable<Map.Entry<Path, Revision>> batch : Iterables.partition( + for (Iterable<Map.Entry<Path, Revision>> batch : IterableUtils.partition( pending.entrySet(), BACKGROUND_MULTI_UPDATE_LIMIT)) { for (Map.Entry<Path, Revision> entry : batch) { Path p = entry.getKey(); diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java index e09f220801..4d1fd661cb 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java @@ -47,6 +47,7 @@ import java.util.Objects; import java.util.Set; import org.apache.jackrabbit.oak.commons.PerfLogger; +import org.apache.jackrabbit.oak.commons.collections.IterableUtils; import org.apache.jackrabbit.oak.commons.collections.ListUtils; import org.apache.jackrabbit.oak.commons.collections.SetUtils; import org.apache.jackrabbit.oak.plugins.document.Document; @@ -757,7 +758,7 @@ public class RDBDocumentStoreJDBC { List<RDBRow> rows = new ArrayList<RDBRow>(); - for (List<String> keys : Iterables.partition(allKeys, RDBJDBCTools.MAX_IN_CLAUSE)) { + for (List<String> keys : IterableUtils.partition(allKeys, RDBJDBCTools.MAX_IN_CLAUSE)) { long pstart = PERFLOG.start(PERFLOG.isDebugEnabled() ? ("reading: " + keys) : null); PreparedStatementComponent inClause = RDBJDBCTools.createInStatement("ID", keys, tmd.isIdBinary());
