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

kv对校验失败后尝试发现下一个节点时,检索范围的问题 #45

Closed
mrsuiqi opened this issue Nov 24, 2020 · 10 comments
Closed

Comments

@mrsuiqi
Copy link

mrsuiqi commented Nov 24, 2020

函数get_next_kv_addr中,发现pre_kv的crc校验失败,会触发find_next_kv_addr来尝试发现下一个kv_node。
但是在传递参数的的时候终止地址似乎有些问题。
终止地址传递的是sector结束地址减去sector_hdr的长度,但是sector_hdr是放在sector的头部的,这样看起来会导致find的时候没有对sector最后一部分地址进行检查。
劳烦作者看一下我的理解是否有问题

@armink
Copy link
Owner

armink commented Nov 24, 2020

你说的是这里吗?

image

@mrsuiqi
Copy link
Author

mrsuiqi commented Nov 24, 2020

是的

@armink
Copy link
Owner

armink commented Nov 25, 2020

看着确实是个 bug

应该是从 sector->addr + SECTOR_HDR_DATA_SIZEsector->addr + db_sec_size(db)

@mrsuiqi
Copy link
Author

mrsuiqi commented Nov 25, 2020

起始地址的话,看了下应该是没什么问题,只是逻辑比较绕。终止地址sector->addr+db_sec_size(db)更合理。

@armink
Copy link
Owner

armink commented Nov 25, 2020

嗯,那你改下真机试试哈,没问题的话可以提交 PR 上来 😄

@joechenchen
Copy link

@mrsuiqi,兄弟,不提交PR吗?

@mrsuiqi
Copy link
Author

mrsuiqi commented Jan 19, 2021 via email

@likyo
Copy link

likyo commented Jan 22, 2021

同样遇到这个问题,最后定位到一个扇区的结尾才会出现此问题,修改后验证OK,线上的还是有bug的,作者还是尽快提交吧

@armink armink closed this as completed in 9487749 Jan 23, 2021
@joechenchen
Copy link

看代码起始地址之前加过SECTOR_HDR_DATA_SIZE,我这边是修改成addr = find_next_kv_addr(db, addr , sector->addr + db_sec_size(db)),难道我理解错误了

armink added a commit that referenced this issue Jan 23, 2021
@armink
Copy link
Owner

armink commented Jan 23, 2021

看代码起始地址之前加过SECTOR_HDR_DATA_SIZE,我这边是修改成addr = find_next_kv_addr(db, addr , sector->addr + db_sec_size(db)),难道我理解错误了

多谢反馈,已经改正了

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

No branches or pull requests

4 participants