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

Add verification on mergeSpans #772

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Jun 20, 2024

It might be helpful to detect issue such as #705

cc @fuweid @tjungblu

@ahrtr ahrtr force-pushed the verify_freelist_20240620 branch 2 times, most recently from 3f4ad0f to a792979 Compare June 21, 2024 09:34
freelist.go Show resolved Hide resolved
freelist_hmap.go Outdated Show resolved Hide resolved
There shouldn't have any duplicated free page IDs, or overlap
between the new free page IDs and the existing free page IDs.

Signed-off-by: Benjamin Wang <[email protected]>
@tjungblu
Copy link
Contributor

/lgtm

thanks for adding those, let's see if we can find some triggers of this

@tjungblu
Copy link
Contributor

this is highly off topic here, but I wonder if we can also implement a much simpler freelist with plain bitsets. We would have a much more compact in-memory representation and would get unions/intersections for free.

Had some good experience with github.com/bits-and-blooms/bitset recently while creating that defrag/page usage video.

@ahrtr
Copy link
Member Author

ahrtr commented Jun 21, 2024

this is highly off topic here, but I wonder if we can also implement a much simpler freelist with plain bitsets. We would have a much more compact in-memory representation and would get unions/intersections for free.

Had some good experience with github.com/bits-and-blooms/bitset recently while creating that defrag/page usage video.

I am not satisfied with the bbolt freelist management for a long time. I have been thinking how to refactor it and improve the situation.

I am open to any idea on this and happy to discuss it further. Will take a look at github.com/bits-and-blooms/bitset later.

@ahrtr
Copy link
Member Author

ahrtr commented Jun 21, 2024

I am not satisfied with the bbolt freelist management for a long time

There isn't a clear interface and hard to understand. I am thinking to

  • define a clear interface & clarify the behavior.
  • try to decouple it with the bbolt;
  • add more dedicated test for the freelist management

@tjungblu
Copy link
Contributor

yep, that would also be my first course of action. Pull the two implementations under a common interface, then have proper testing for those.

@ahrtr
Copy link
Member Author

ahrtr commented Jun 24, 2024

github.com/bits-and-blooms/bitset

I just had a quick look at the project. It seems not quite related to our usage o freelist management. It manages a mapping between non-negative integers and boolean values; while bbolt freelist management just needs to remember a list of free page IDs.

If you still think it might be helpful or related, please feel free to raise a separate ticket to discuss. thx

@ahrtr ahrtr merged commit f8ffaee into etcd-io:main Jun 24, 2024
16 checks passed
@ahrtr ahrtr deleted the verify_freelist_20240620 branch June 24, 2024 09:54
@tjungblu
Copy link
Contributor

tjungblu commented Jun 24, 2024

If you still think it might be helpful or related, please feel free to raise a separate ticket to discuss. thx

will do. You can use a bitset to map from PageId->Free/Used. Since you're packing 64 bools into one int64, you have a much lower memory/file usage. Finding continuous free blocks is also cheaper, since you can just bitshift along the int64.

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

Successfully merging this pull request may close these issues.

3 participants