Skip to content

Replace bits-and-blooms/bitset with roaring bitmaps#2386

Merged
ValentaTomas merged 1 commit intomainfrom
replace-bitset-with-roaring
Apr 14, 2026
Merged

Replace bits-and-blooms/bitset with roaring bitmaps#2386
ValentaTomas merged 1 commit intomainfrom
replace-bitset-with-roaring

Conversation

@ValentaTomas
Copy link
Copy Markdown
Member

Replace all direct usage of bits-and-blooms/bitset with roaring/v2 (v2.17.0). Uses the new Ranges() iterator (#522) for range iteration in CreateMapping and BitmapRanges.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Medium Risk
Touches snapshot diff metadata and dirty-range iteration used for exporting memory/rootfs, so subtle bitmap semantic differences (cardinality, range boundaries, uint32 limits) could corrupt diffs or mappings if incorrect. No auth/security changes, but it impacts core snapshotting and I/O paths.

Overview
Replaces bits-and-blooms/bitset usage with roaring/v2 bitmaps across snapshot diff generation and export paths (block cache dirty tracking, range iteration, Firecracker memory metadata decoding, and header mapping construction), including switching range iteration to Bitmap.Ranges() and introducing a thread-safe syncroaring.Bitset wrapper for cache dirty ranges; updates related tests and diff-metadata builder APIs accordingly.

Reviewed by Cursor Bugbot for commit 071137e. Bugbot is set up for automated code reviews on this repo. Configure here.

@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch 6 times, most recently from fc7f1b4 to 0205899 Compare April 14, 2026 00:38
@ValentaTomas ValentaTomas marked this pull request as ready for review April 14, 2026 00:40
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch from 6ec4c90 to b81ec2a Compare April 14, 2026 00:49
Comment thread packages/orchestrator/go.mod Outdated
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch 2 times, most recently from b6fa8a5 to b0717ba Compare April 14, 2026 00:56
@ValentaTomas ValentaTomas marked this pull request as draft April 14, 2026 06:10
Comment thread packages/shared/pkg/atomicbitset/bitset.go Outdated
@ValentaTomas ValentaTomas marked this pull request as ready for review April 14, 2026 07:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa35957fa3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/shared/pkg/storage/header/metadata.go
Comment thread packages/orchestrator/go.mod Outdated
Comment thread packages/shared/go.mod Outdated
Comment thread packages/orchestrator/pkg/sandbox/block/tracker.go
Comment thread packages/orchestrator/pkg/sandbox/fc/client.go
Comment thread packages/orchestrator/pkg/sandbox/uffd/noop.go Outdated
Comment thread packages/orchestrator/pkg/sandbox/uffd/noop.go Outdated
Copy link
Copy Markdown
Contributor

@levb levb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few nits, otherwise LGTM

Comment thread packages/envd/internal/services/cgroups/cgroup2_test.go Outdated
Comment thread packages/orchestrator/pkg/sandbox/block/cache.go Outdated
Comment thread packages/orchestrator/pkg/sandbox/uffd/userfaultfd/helpers_test.go
Comment thread packages/shared/pkg/syncroaring/bitset.go
Comment thread packages/shared/pkg/syncroaring/bitset.go Outdated
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch 8 times, most recently from 7424c06 to 60f17c9 Compare April 14, 2026 19:32
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch from 60f17c9 to a55db6c Compare April 14, 2026 19:36
Copy link
Copy Markdown
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🚀 1 suggestion left in comments

@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch 2 times, most recently from 2057d3d to d975833 Compare April 14, 2026 19:48
Comment thread packages/orchestrator/pkg/sandbox/uffd/noop.go Outdated
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch from 9e25080 to 4b07195 Compare April 14, 2026 19:58
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b07195. Configure here.

Comment thread packages/shared/pkg/syncroaring/bitset.go
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch 4 times, most recently from a7e1dfb to 23076a3 Compare April 14, 2026 20:42
Use roaring v2.17.0 with the new Ranges() iterator throughout.
Remove bitset as a direct dependency.
@ValentaTomas ValentaTomas force-pushed the replace-bitset-with-roaring branch from 23076a3 to 071137e Compare April 14, 2026 20:43
@ValentaTomas ValentaTomas enabled auto-merge (squash) April 14, 2026 20:49
@dobrac dobrac requested a review from levb April 14, 2026 20:55
Copy link
Copy Markdown
Contributor

@levb levb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ValentaTomas ValentaTomas merged commit 634a8cc into main Apr 14, 2026
45 checks passed
@ValentaTomas ValentaTomas deleted the replace-bitset-with-roaring branch April 14, 2026 20:56
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