michaelsembwever commented on code in PR #2254:
URL: https://github.com/apache/cassandra/pull/2254#discussion_r1184986922


##########
src/java/org/apache/cassandra/schema/CompressionParams.java:
##########
@@ -518,23 +527,36 @@ private static boolean removeEnabled(Map<String, String> 
options)
         return enabled == null || Boolean.parseBoolean(enabled);
     }
 
-    // chunkLength must be a power of 2 because we assume so when
-    // computing the chunk number from an uncompressed file offset (see
-    // CompressedRandomAccessReader.decompresseChunk())
-    public void validate() throws ConfigurationException
-    {
-        // if chunk length was not set (chunkLength == null), this is fine, 
default will be used
+    private static void validateChunkLength(String key, int chunkLength) 
throws ConfigurationException{
         if (chunkLength <= 0)
-            throw new ConfigurationException("Invalid negative or null " + 
CHUNK_LENGTH_IN_KB);
+            throw new ConfigurationException(invalidValue(key, "May not be <= 
0", chunkLength));
 
+        // chunkLength must be a power of 2 because we assume so when
+        // computing the chunk number from an uncompressed file offset (see
+        // CompressedRandomAccessReader.decompresseChunk())
         if ((chunkLength & (chunkLength - 1)) != 0)
-            throw new ConfigurationException(CHUNK_LENGTH_IN_KB + " must be a 
power of 2");
+            throw new ConfigurationException(invalidValue(key,  "Must be a 
power of 2", chunkLength));
+    }
 
+    private static void validateMinCompressRatio(double ratio) throws 
ConfigurationException {
+        if (ratio != DEFAULT_MIN_COMPRESS_RATIO && ratio < 1.0)
+            throw new ConfigurationException(invalidValue(MIN_COMPRESS_RATIO , 
"Can either be 0 or greater than or equal to 1", ratio));
+
+    }
+
+    private static void validateMaxCompressedLength(int maxCompressedLength, 
int chunkLength) throws ConfigurationException {

Review Comment:
   nit: brace on newline.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to