Provide min/max key info for compaction callback function#204
Merged
greensky00 merged 1 commit intoeBay:masterfrom Apr 30, 2025
Merged
Provide min/max key info for compaction callback function#204greensky00 merged 1 commit intoeBay:masterfrom
greensky00 merged 1 commit intoeBay:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for providing min/max key information to the compaction callback function. Key changes include:
- Adding a new test (callback_l1_test) to validate that min/max keys are correctly provided.
- Updating TableFile compaction functions to extract and pass min/max keys to the compaction callback.
- Renaming inconsistent function names (from compactToManully to compactToManually) and updating related declarations.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/jungle/compaction_test.cc | Added test case for compaction callback with min/max key validations |
| src/table_file_compaction.cc | Updated compaction functions to extract min/max keys and fixed a renaming issue |
| src/table_file.h | Changed function declarations to reflect the updated compaction method names |
| include/libjungle/db_config.h | Updated documentation for CompactionCbParams to include minKey and maxKey |
Comments suppressed due to low confidence (2)
tests/jungle/compaction_test.cc:368
- Add a check to ensure that params.rec.kv.key.size is greater than 1 before extracting the substring to avoid potential out-of-bound issues.
std::string num_str = std::string((char*)params.rec.kv.key.data + 1, params.rec.kv.key.size - 1);
src/table_file_compaction.cc:151
- Consider verifying that the iterator successfully retrieves a valid record before using the key data for setting min_key. This check can help prevent undefined behavior in case the table file is empty.
itr.get(rec_out);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.