test: cql-pytest: test_describe: clamp bloom filter's fp rate

before this change, we use `round(random.random(), 5)` for
the value of `bloom_filter_fp_chance` config option. there are
chances that this expression could return a number lower or equal
to 6.71e-05.

but we do have a minimal for this option, which is defined by
`utils::bloom_calculations::probs`. and the minimal false positive
rate is 6.71e-05.

we are observing test failures where the we are using 0 for
the option, and scylla right rejected it with the error message of
```
bloom_filter_fp_chance must be larger than 6.71e-05 and less than or equal to 1.0 (got 0)
```.

so, in this change, to address the test failure, we always use a number
slightly greater or equal to a number slightly greater to the minimum to
ensure that the randomly picked number is in the range of supported
false positive rate.

Fixes #13313
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #13314
This commit is contained in:
Kefu Chai
2023-03-24 14:55:45 +08:00
committed by Avi Kivity
parent d5488dba69
commit 33f4012eeb

View File

@@ -804,7 +804,14 @@ def new_random_table(cql, keyspace, udts=[]):
compressions = ["LZ4Compressor", "SnappyCompressor", "DeflateCompressor"]
extras["compression"] = f"{{'sstable_compression': '{random.choice(compressions)}'}}"
extras["bloom_filter_fp_chance"] = round(random.random(), 5)
# see the last element of `probs` defined by scylladb/utils/bloom_calculation.cc,
# the minimum false positive rate supported by the bloom filter is determined by
# prob's element with the greatest number of buckets. also, because random.random()
# could return 0.0, not to mention round() could round a small enough float to 0,
# let's add an epislon to ensure that the randomly picked chance is not equal to the
# minimum.
min_supported_bloom_filter_fp_chance = 6.71e-5 + 1e-5
extras["bloom_filter_fp_chance"] = max(min_supported_bloom_filter_fp_chance, round(random.random(), 5))
extras["crc_check_chance"] = round(random.random(), 5)
extras["gc_grace_seconds"] = random.randrange(100000, 1000000)
min_idx_interval = random.randrange(100, 1000)