Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix double precision ,module bloomfilter double to string #830

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

heyone-top
Copy link
Contributor

fix double precision ,module double to string
当我们使用redisshake迁移的时候 发现 bloomfilter 模块 无法迁移 精度超过 0.000001的 ratio字段,因为最后他会白这个精度 ratio修改成0,这会导致 记载 boomfilter过滤器的实例无法 bgsave,因为 ratio默认不会为0, 最后经过排查发现是 redisshake精度转换有问题。
tips: ratio每次库容 都会 降低一个数量级。
迁移后 目标端会成为这种情况。

127.0.0.1:6379> bf.debug myboom
1) "size:1372567"
2) "bytes:4194304 bits:33554432 hashes:24 hashwidth:64 capacity:1000200 size:1000200 ratio:0"
3) "bytes:16777216 bits:134217728 hashes:26 hashwidth:64 capacity:3683950 size:372367 ratio:0"

当然我也查看了一下 调用此函数的其他地方,tairzset 的rewrite 功能也会导致 精度丧失。我觉得这是一个比较严重的 bug。

fix double precision ,module double to string
@CLAassistant
Copy link

CLAassistant commented Jun 16, 2024

CLA assistant check
All committers have signed the CLA.

@suxb201
Copy link
Member

suxb201 commented Jun 17, 2024

%g 并不会提高输出精度,且出现科学计数法时会导致出错。考虑下:%.15f

@heyone-top
Copy link
Contributor Author

heyone-top commented Jun 17, 2024

%g 并不会提高输出精度,且出现科学计数法时会导致出错。考虑下:%.15f

嗯,我是看了 对应的调用地方 都处理了科学计数法,不过 这个是float64类型,你这个表示 也是没问题的。double小数位:2^52 = 4503599627370496,一共16位,所以 %.15f 比较好。我再更新一下

update  float64 precision
@suxb201 suxb201 merged commit 10e2003 into tair-opensource:v4 Jun 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants