You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by nf...@apache.org on 2024/06/18 07:32:29 UTC

(jackrabbit-oak) branch trunk updated: OAK-10899 - Do not remove field with size estimation from NodeDocuments downloaded from Mongo (#1530)

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

nfsantos 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 7bee7ce779 OAK-10899 - Do not remove field with size estimation from NodeDocuments downloaded from Mongo (#1530)
7bee7ce779 is described below

commit 7bee7ce77913d8149688f14c8fc1c9cdfbea0f1d
Author: Nuno Santos <ns...@adobe.com>
AuthorDate: Tue Jun 18 09:32:24 2024 +0200

    OAK-10899 - Do not remove field with size estimation from NodeDocuments downloaded from Mongo (#1530)
---
 .../indexer/document/flatfile/pipelined/NodeDocumentCodec.java      | 6 +++---
 .../document/flatfile/pipelined/PipelinedMongoDownloadTask.java     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/NodeDocumentCodec.java b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/NodeDocumentCodec.java
index 061da1e874..81c0796bd7 100644
--- a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/NodeDocumentCodec.java
+++ b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/NodeDocumentCodec.java
@@ -36,7 +36,7 @@ import org.bson.codecs.DecoderContext;
 import org.bson.codecs.EncoderContext;
 import org.bson.codecs.configuration.CodecRegistry;
 
-import java.util.Map;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 /**
@@ -55,7 +55,7 @@ import java.util.TreeMap;
  */
 public class NodeDocumentCodec implements Codec<NodeDocument> {
     // The estimated size is stored in the NodeDocument itself
-    public final static String SIZE_FIELD = "__ESTIMATED_SIZE__";
+    public final static String SIZE_FIELD = "_ESTIMATED_SIZE_";
     private final MongoDocumentStore store;
     private final Collection<NodeDocument> collection;
     private final BsonTypeCodecMap bsonTypeCodecMap;
@@ -145,7 +145,7 @@ public class NodeDocumentCodec implements Codec<NodeDocument> {
         return value;
     }
 
-    private Map<Revision, Object> readDocument(BsonReader reader, MutableInt estimatedSizeOfCurrentObject) {
+    private SortedMap<Revision, Object> readDocument(BsonReader reader, MutableInt estimatedSizeOfCurrentObject) {
         TreeMap<Revision, Object> map = new TreeMap<>(StableRevisionComparator.REVERSE);
         reader.readStartDocument();
         while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
diff --git a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedMongoDownloadTask.java b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedMongoDownloadTask.java
index 54a0bdae21..fa21c51e9a 100644
--- a/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedMongoDownloadTask.java
+++ b/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedMongoDownloadTask.java
@@ -670,7 +670,7 @@ public class PipelinedMongoDownloadTask implements Callable<PipelinedMongoDownlo
                         batch[nextIndex] = next;
                         nextIndex++;
                         // The NodeDocumentCodec always adds this field.
-                        int docSize = (int) next.remove(NodeDocumentCodec.SIZE_FIELD);
+                        int docSize = (int) next.get(NodeDocumentCodec.SIZE_FIELD);
                         batchSize += docSize;
                         documentsDownloadedTotalBytes += docSize;
                         downloadStageStatistics.incrementDocumentsDownloadedTotalBytes(docSize);