rishabhdaim commented on code in PR #1473: URL: https://github.com/apache/jackrabbit-oak/pull/1473#discussion_r1609709936
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyState.java: ########## @@ -38,24 +43,59 @@ 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 String value; private PropertyState parsed; + private byte[] compressedValue; + private final Compression compression = Compression.GZIP; + + private static final int DEFAULT_COMPRESSION_THRESHOLD = Integer.getInteger("oak.mongo.compressionThreshold", 1024); DocumentPropertyState(DocumentNodeStore store, String name, String value) { this.store = store; this.name = name; - this.value = value; + + int size = value.getBytes().length; + if (size > DEFAULT_COMPRESSION_THRESHOLD) { + try { + compressedValue = compress(value.getBytes()); + this.value = null; + } catch (Exception e) { + // if compression fails, store the value as is + this.value = value; Review Comment: please log a `WARN` message here. -- 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: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org