pranavshenoy commented on code in PR #4087: URL: https://github.com/apache/cassandra/pull/4087#discussion_r2040871848
########## src/java/org/apache/cassandra/db/compaction/unified/Controller.java: ########## @@ -624,7 +629,7 @@ public static Map<String, String> validateOptions(Map<String, String> options) t MIN_SSTABLE_SIZE_OPTION)); int limit = (int) Math.ceil(targetSSTableSize * INVERSE_SQRT_2); if (sizeInBytes >= limit) - throw new ConfigurationException(String.format("Invalid configuration, %s (%s) should be less than the target size minimum: %s", + throw new ConfigurationException(String.format("Invalid configuration, %s (%s) should be less than 70% of the target size minimum: %s", Review Comment: Changed the type to long and have added the test case for this. Thanks Let me know your thoughts. ########## test/unit/org/apache/cassandra/db/compaction/unified/ControllerTest.java: ########## @@ -121,6 +121,18 @@ public void testValidateOptionsIntegers() testValidateOptions(true); } + @Test + public void testValidateOptionsInvalidTargetSSTableSize() + { + try { + Map<String, String> options = new HashMap<>(); + options.putIfAbsent(Controller.TARGET_SSTABLE_SIZE_OPTION, "12E899"); + Controller.validateOptions(options); + fail("Passing invalid number should have caused exception"); + } catch(ConfigurationException e) { + } + } + Review Comment: added these test cases. Thanks ########## src/java/org/apache/cassandra/db/compaction/unified/Controller.java: ########## @@ -519,6 +519,11 @@ public static Map<String, String> validateOptions(Map<String, String> options) t try { targetSSTableSize = FBUtilities.parseHumanReadableBytes(s); + if (targetSSTableSize == Long.MAX_VALUE || targetSSTableSize == Long.MIN_VALUE) { + throw new ConfigurationException(String.format("%s %s is out of range of Long.", + TARGET_SSTABLE_SIZE_OPTION, + s)); + } Review Comment: @Claudenw Thanks for the reviewing my PR. I have made the changes to the current PR. -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org