ionutzpi commented on code in PR #1526:
URL: https://github.com/apache/jackrabbit-oak/pull/1526#discussion_r1642735284


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyState.java:
##########
@@ -38,24 +45,64 @@
 import org.apache.jackrabbit.oak.plugins.memory.StringPropertyState;
 import org.apache.jackrabbit.oak.plugins.value.Conversions;
 import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * PropertyState implementation with lazy parsing of the JSOP encoded value.
  */
 final class DocumentPropertyState implements PropertyState {
 
+    private static final Logger LOG = 
LoggerFactory.getLogger(DocumentPropertyState.class);
+
     private final DocumentNodeStore store;
 
     private final String name;
 
     private final String value;
 
     private PropertyState parsed;
+    private final byte[] compressedValue;
+    private final Compression compression;
+
+    private static final int DEFAULT_COMPRESSION_THRESHOLD =
+            SystemPropertySupplier.create("oak.mongo.compressionThreshold", 
-1).get();
 
     DocumentPropertyState(DocumentNodeStore store, String name, String value) {
+        this(store, name, value, Compression.GZIP);
+    }
+
+    DocumentPropertyState(DocumentNodeStore store, String name, String value, 
Compression compression) {
         this.store = store;
         this.name = name;
-        this.value = value;
+        if (DEFAULT_COMPRESSION_THRESHOLD == -1) {
+            this.value = value;
+            this.compression = null;
+            this.compressedValue = null;
+        } else {
+            this.compression = compression;
+            int size = value.length();
+            String localValue = value;
+            byte[] localCompressedValue = null;
+            if (compression != null && size > DEFAULT_COMPRESSION_THRESHOLD) {

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to