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

bboltcachestorage: delete links outside of cursor #5692

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jsternberg
Copy link
Collaborator

The emptyBranchWithParents method could accidentally leave link entries that shouldn't exist. When finding these links, deleting during the iteration can sometimes cause the cursor to jump entries that should be deleted.

This changes the code path to delete the links outside of the iteration to avoid this.

This is caused by a long-standing bug in bolt that can't be fixed easily. See etcd-io/bbolt#611 for details.

@jsternberg
Copy link
Collaborator Author

Needs a test.

The `emptyBranchWithParents` method could accidentally leave link
entries that shouldn't exist. When finding these links, deleting during
the iteration can sometimes cause the cursor to jump entries that should
be deleted.

This changes the code path to delete the links outside of the iteration
to avoid this.

This is caused by a long-standing bug in bolt that can't be fixed
easily. See etcd-io/bbolt#611 for details.

Signed-off-by: Jonathan A. Sternberg <[email protected]>
@jsternberg jsternberg force-pushed the bbolt-delete-links-fix branch from 65d23c6 to f06c01d Compare January 30, 2025 17:19
@jsternberg jsternberg marked this pull request as ready for review February 5, 2025 22:01
@jsternberg
Copy link
Collaborator Author

I attempted to test this by creating a result and then having a bunch of links with different digests point to the same source and target ids and wasn't able to trigger it with the original code. I'm not sure what would be a good way to reproduce this. This has only happened a few times in a very large database and I'm not sure how big of a concern this is.

I've moved this from draft to open but I don't think I'll be able to create a test case to exercise this code since the theory on the cause is mostly theoretical from that one issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant