提交 0adf4482 编写于 作者: A antirez

PFSELFTEST: less false positives.

This is just a quickfix, for the nature of the test the right way to fix
it is to average the error of N runs, since otherwise it is always
possible to get a false positive with a bad run, or to minimize too much
this possibility we may end testing with too much "large" error ranges.
上级 b9bb7e2d
...@@ -1386,7 +1386,7 @@ void pfselftestCommand(redisClient *c) { ...@@ -1386,7 +1386,7 @@ void pfselftestCommand(redisClient *c) {
* The test adds unique elements and check that the estimated value * The test adds unique elements and check that the estimated value
* is always reasonable bounds. * is always reasonable bounds.
* *
* We check that the error is smaller than 4 times than the expected * We check that the error is smaller than a few times than the expected
* standard error, to make it very unlikely for the test to fail because * standard error, to make it very unlikely for the test to fail because
* of a "bad" run. * of a "bad" run.
* *
...@@ -1422,8 +1422,16 @@ void pfselftestCommand(redisClient *c) { ...@@ -1422,8 +1422,16 @@ void pfselftestCommand(redisClient *c) {
/* Check error. */ /* Check error. */
if (j == checkpoint) { if (j == checkpoint) {
int64_t abserr = checkpoint - (int64_t)hllCount(hdr,NULL); int64_t abserr = checkpoint - (int64_t)hllCount(hdr,NULL);
uint64_t maxerr = ceil(relerr*6*checkpoint);
/* Adjust the max error we expect for cardinality 10
* since from time to time it is statistically likely to get
* much higher error due to collision, resulting into a false
* positive. */
if (j == 10) maxerr = 1;
if (abserr < 0) abserr = -abserr; if (abserr < 0) abserr = -abserr;
if (abserr > (uint64_t)(relerr*4*checkpoint)) { if (abserr > maxerr) {
addReplyErrorFormat(c, addReplyErrorFormat(c,
"TESTFAILED Too big error. card:%llu abserr:%llu", "TESTFAILED Too big error. card:%llu abserr:%llu",
(unsigned long long) checkpoint, (unsigned long long) checkpoint,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册