steffenvan commented on code in PR #1136:
URL: https://github.com/apache/jackrabbit-oak/pull/1136#discussion_r1347106722


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/indexstore/IndexStoreUtils.java:
##########
@@ -39,6 +40,23 @@
 public class IndexStoreUtils {
     public static final String METADATA_SUFFIX = ".metadata";
 
+    public static final String OAK_INDEXER_USE_ZIP = "oak.indexer.useZip";
+    public static final String OAK_INDEXER_USE_LZ4 = "oak.indexer.useLZ4";
+
+    public static boolean compressionEnabled() {
+        return Boolean.parseBoolean(System.getProperty(OAK_INDEXER_USE_ZIP, 
"true"));
+    }
+
+    public static boolean useLZ4() {
+        return Boolean.parseBoolean(System.getProperty(OAK_INDEXER_USE_LZ4, 
"true"));
+    }
+
+    public static Compression compressionAlgorithm() {

Review Comment:
   I think this is slightly ambiguous. It seems like USE_ZIP has two meanings: 
whether to enable compression **and** use GZIP to compress? But LZ4 only 
indicates whether we use LZ4. So if we disable ZIP but enable LZ4, it wouldn't 
be used. On the other hand, if we enable ZIP, we will use compression *and* 
GZIP. 
   
   Small thing, but I think this looks a bit simpler:
   ```java
   public static Compression compressionAlgorithm() {
       if (!compressionEnabled()) {
           return Compression.NONE;
       }
       return useLZ4() ? LZ4_INSTANCE : Compression.GZIP;
   }
   ```
   
   Perhaps we could also add a comment like: `LZ4 takes precedence over GZIP if 
both are enabled.`
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to