Skip to content

Add a new picking algorithm in fifo compaction#14326

Closed
xingbowang wants to merge 4 commits intofacebook:mainfrom
xingbowang:2026_02_11_fifo_compact_policy
Closed

Add a new picking algorithm in fifo compaction#14326
xingbowang wants to merge 4 commits intofacebook:mainfrom
xingbowang:2026_02_11_fifo_compact_policy

Conversation

@xingbowang
Copy link
Contributor

Summary:

Add a new kv ratio based compaction picking algorithm in fifo compaction

Test Plan:

Unit test

Reviewers:

Subscribers:

Tasks:

Tags:

@meta-cla meta-cla bot added the CLA Signed label Feb 12, 2026
@xingbowang xingbowang force-pushed the 2026_02_11_fifo_compact_policy branch 2 times, most recently from e82b2a8 to 933c40f Compare February 13, 2026 17:17
@@ -0,0 +1,672 @@
# FIFO Compaction Strategy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't find wiki files in our github repo. I guess they are maintained outside of the source code base. I think we should probably move them inside the code base, as we are using AI to generate these document more and more frequently. keeping them in sync within the code base would help keep it up to date more easily.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea, though the idea of a wiki is easy editing by a broad set of people. If it's revision controlled and gated by maintainers, then it's just "documentation." We have gotten good outside contributions to the wiki, but I could see a model using revision control working better nowadays as most of the high-level user documentation updates could be automated.

const std::vector<FileMetaData*>& last_level_files =
vstorage->LevelFiles(last_level);

if (last_level == 0 &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

relocated to PickIntraL0Compaction function.

@xingbowang xingbowang force-pushed the 2026_02_11_fifo_compact_policy branch from 933c40f to fee5d71 Compare February 13, 2026 19:09
@xingbowang xingbowang marked this pull request as ready for review February 13, 2026 19:10
@meta-codesync
Copy link

meta-codesync bot commented Feb 13, 2026

@xingbowang has imported this pull request. If you are a Meta employee, you can view this in D93257941.

Copy link
Contributor

@pdillinger pdillinger left a comment

Choose a reason for hiding this comment

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

I'm not a compaction expert but overall LGTM, thanks!

// - PickTTLCompaction: estimate remaining data after dropping expired SSTs
// - PickSizeCompaction: estimate data freed per dropped SST file
// - PickRatioBasedIntraL0Compaction: compute SST ratio for target sizing
uint64_t EstimateTotalDataForSST(uint64_t sst_bytes, uint64_t total_sst,
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally looks good, but I find this function confusing, like what total_sst means. See https://www.internalfb.com/metamate/message/f68259e1-5513-4943-ae1f-75649182c25e

@xingbowang xingbowang force-pushed the 2026_02_11_fifo_compact_policy branch from 64c2626 to a7cf1bf Compare February 15, 2026 16:01
@meta-codesync
Copy link

meta-codesync bot commented Feb 15, 2026

@xingbowang has imported this pull request. If you are a Meta employee, you can view this in D93257941.

@meta-codesync meta-codesync bot closed this in b040ab8 Feb 15, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 15, 2026

@xingbowang merged this pull request in b040ab8.

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.

3 participants