Skip to content

Conversation

@kl2400033266
Copy link
Contributor

@kl2400033266 kl2400033266 commented Nov 26, 2025

Which Issue(s) This PR Fixes

Fixes #4363

Brief Description

This PR removes the unused table_size_for method from the TopicQueueLock implementation in rocketmq-store/src/base/topic_queue_lock.rs. The method was identified as dead code and removing it helps clean up the codebase.

Changes Made

  • Removed the table_size_for method (lines 71-85) from topic_queue_lock.rs
  • The method was a copy from Java HashMap implementation but was never used in the Rust codebase

Testing

The existing test suite confirms this method is not required for any functionality. All tests continue to pass after removal.

Summary by CodeRabbit

  • Refactor
    • Removed an internal helper and its associated tests as part of code cleanup.
    • No changes to public APIs or external behavior; only tests unrelated to lock creation and zero-capacity handling remain.

✏️ Tip: You can customize this high-level summary in your review settings.

Fixes mxsm#4363

This commit removes the unused table_size_for method from the TopicQueueLock implementation in rocketmq-store/src/base/topic_queue_lock.rs.
Copilot AI review requested due to automatic review settings November 26, 2025 14:29
@rocketmq-rust-bot
Copy link
Collaborator

🔊@kl2400033266 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Removed the private table_size_for helper from rocketmq-store/src/base/topic_queue_lock.rs and deleted its associated tests. No public API changes; internal logic that previously used the helper was inlined or adjusted.

Changes

Cohort / File(s) Summary
Helper removal
rocketmq-store/src/base/topic_queue_lock.rs
Deleted the private table_size_for helper function and removed tests that referenced it. Internal uses were inlined or refactored; no exported symbols changed.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus areas:
    • Confirm all former uses of table_size_for were correctly inlined/refactored within topic_queue_lock.rs.
    • Verify removed tests were intentional and that remaining tests cover relevant behavior (creation, zero-capacity).
    • Check for any duplicated logic introduced by inlining.

Poem

🐰 I hopped through queues where helpers hid away,
The little function left at break of day.
Inlined and gone, the code now hums,
I munch on carrots, sing of crumbs.
A tidy hop — hooray! 🎋

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: removing an unused method from the codebase.
Linked Issues check ✅ Passed The PR successfully removes the unused table_size_for method as required by issue #4363, with all tests passing.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective of removing the table_size_for method and its associated tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50f2172 and fae9e38.

📒 Files selected for processing (1)
  • rocketmq-store/src/base/topic_queue_lock.rs (0 hunks)
💤 Files with no reviewable changes (1)
  • rocketmq-store/src/base/topic_queue_lock.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build & Test (windows-latest)
  • GitHub Check: Build & Test (macos-latest)
  • GitHub Check: Build & Test (ubuntu-latest)
  • GitHub Check: Code Coverage
  • GitHub Check: auto-approve

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

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 attempts to remove the table_size_for method from the TopicQueueLock implementation, claiming it is unused dead code. However, this change introduces critical compilation failures as the function is actively used by multiple test cases within the same file.

Key Issues

  • Critical Bug: The removed function is called by 7 test functions (lines 78-110)
  • The PR description incorrectly states "All tests continue to pass after removal"
  • The MAXIMUM_CAPACITY constant will also become unused after the proper cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

n + 1
}
}

Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The removal of the table_size_for function will cause compilation failures. Multiple tests in the same file (lines 78-110) call this function:

  • calculates_table_size_for_zero_capacity() (line 79)
  • calculates_table_size_for_one_capacity() (line 84)
  • calculates_table_size_for_exact_power_of_two() (line 89)
  • calculates_table_size_for_just_above_power_of_two() (line 94)
  • calculates_table_size_for_maximum_capacity() (line 99)
  • calculates_table_size_for_above_maximum_capacity() (line 104)
  • calculates_table_size_for_large_number() (line 109)

These tests need to be removed along with the function, or the function should not be removed if the functionality is still being tested.

Copilot uses AI. Check for mistakes.
@rocketmq-rust-bot
Copy link
Collaborator

🔊@kl2400033266 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@mxsm mxsm changed the title Remove unused table_size_for method [ISSUE #4363]Remove unused table_size_for method Nov 26, 2025
Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

@kl2400033266 Thanks for your contribution. LGTM

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.40%. Comparing base (eae838e) to head (fae9e38).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4364      +/-   ##
==========================================
- Coverage   28.43%   28.40%   -0.03%     
==========================================
  Files         630      630              
  Lines       90165    90133      -32     
==========================================
- Hits        25636    25604      -32     
  Misses      64529    64529              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

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

LGTM - All CI checks passed ✅

@mxsm mxsm merged commit 7aded2d into mxsm:main Nov 26, 2025
14 of 17 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge Difficulty level/Easy Easy ISSUE enhancement⚡️ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement⚡️] Remove table_size_for method from topic_queue_lock.rs

4 participants