Skip to content

Comments

Provide min/max key info for compaction callback function#204

Merged
greensky00 merged 1 commit intoeBay:masterfrom
greensky00:pr1
Apr 30, 2025
Merged

Provide min/max key info for compaction callback function#204
greensky00 merged 1 commit intoeBay:masterfrom
greensky00:pr1

Conversation

@greensky00
Copy link
Contributor

No description provided.

@greensky00 greensky00 requested a review from Copilot April 30, 2025 05:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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);

@greensky00 greensky00 merged commit 6b4bc53 into eBay:master Apr 30, 2025
1 check passed
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.

1 participant