[
https://issues.apache.org/jira/browse/CASSANDRA-18870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767114#comment-17767114
]
Maxwell Guo edited comment on CASSANDRA-18870 at 9/20/23 1:21 PM:
------------------------------------------------------------------
Sorry, I may not have noticed, rebase again.
as for this code in the test case :
{code:java}
try
{
createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int)
WITH bloom_filter_fp_chance = 0.0000001");
fail("Expected an fp chance of 0.0000001 to be rejected");
}
catch (ConfigurationException exc) { }
{code}
The test wants to see if the cql :
{code:java}
"CREATE TABLE %s (a int PRIMARY KEY, b int) WITH bloom_filter_fp_chance =
0.0000001 "
{code}
with bloom_filter_fp_chance = 0.0000001 is meaningful, see [bf validation
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/TableParams.java#L156].
if bf chance is less than minBloomFilterFpChanceValue or bigger than 1 ,
{code:java}
fail("%s must be larger than %s and less than or equal to 1.0 (got %s)",
BLOOM_FILTER_FP_CHANCE,
minBloomFilterFpChanceValue,
bloomFilterFpChance);
{code}
should be thrown. The test case's catch body do not doing the exception
message validation .So no matter the cql is illegal or not , the test will
still pass.
Actually the right code should be :
{code:java}
try
{
createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int)
WITH bloom_filter_fp_chance = 0.0000001");
fail("Expected an fp chance of 0.0000001 to be rejected");
}
catch (ConfigurationException exc)
{
assertTrue(exc.getMessage().contains("bloom_filter_fp_chance must be
larger than " + BloomCalculations.minSupportedBloomFilterFpChance() + " and
less than or equal to 1.0 (got 1.0E-7)"))
}
{code}
was (Author: maxwellguo):
Sorry, I may not have noticed, rebase again.
as for this code in the test case :
{code:java}
try
{
createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int)
WITH bloom_filter_fp_chance = 0.0000001");
fail("Expected an fp chance of 0.0000001 to be rejected");
}
catch (ConfigurationException exc) { }
{code}
The test wants to see if the cql :
{code:java}
"CREATE TABLE %s (a int PRIMARY KEY, b int) WITH bloom_filter_fp_chance =
0.0000001 "
{code}
with bloom_filter_fp_chance = 0.0000001 is meaningful, see [bf validation
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/TableParams.java#L156].
if bf chance is less than minBloomFilterFpChanceValue or bigger than 1 ,
{code:java}
fail("%s must be larger than %s and less than or equal to 1.0 (got %s)",
BLOOM_FILTER_FP_CHANCE,
minBloomFilterFpChanceValue,
bloomFilterFpChance);
{code}
should be thrown. The test case's catch body do not doing the exception
message validation .
Actually the right code should be :
{code:java}
try
{
createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int)
WITH bloom_filter_fp_chance = 0.0000001");
fail("Expected an fp chance of 0.0000001 to be rejected");
}
catch (ConfigurationException exc)
{
assertTrue(exc.getMessage().contains("bloom_filter_fp_chance must be
larger than " + BloomCalculations.minSupportedBloomFilterFpChance() + " and
less than or equal to 1.0 (got 1.0E-7)"))
}
{code}
> Invalid ut check for CreateTableValidationTest
> ----------------------------------------------
>
> Key: CASSANDRA-18870
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18870
> Project: Cassandra
> Issue Type: Bug
> Components: Test/unit
> Reporter: Maxwell Guo
> Assignee: Maxwell Guo
> Priority: Normal
> Fix For: 5.x
>
>
> https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java#L40
> This test case testInvalidBloomFilterFPRatio() makes no sense and cannot
> achieve the desired purpose.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]