Skip to content

fix: some bugs for v4.0.2#3223

Merged
chejinge merged 5 commits intoOpenAtomFoundation:unstablefrom
chenbt-hz:unstable
Mar 9, 2026
Merged

fix: some bugs for v4.0.2#3223
chejinge merged 5 commits intoOpenAtomFoundation:unstablefrom
chenbt-hz:unstable

Conversation

@chenbt-hz
Copy link
Collaborator

@chenbt-hz chenbt-hz commented Feb 13, 2026

  1. CMakeLists.txt 移除不需要的文件
    2.修复\x00 set error
    3.fix rate_limiter_bandwidth_ overflow
    4.fix ttl error for hlen update cache(后续还要处理其他命令,未完成)

Summary by CodeRabbit

  • Bug Fixes

    • Resolved potential overflow issue in rate limiter bandwidth calculation on 32-bit systems
    • Fixed user key encoding to correctly process remaining data bytes
  • Performance

    • Adjusted HLen command caching strategy for improved efficiency

Copilot AI review requested due to automatic review settings February 13, 2026 07:30
@github-actions github-actions bot added the ☢️ Bug Something isn't working label Feb 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

This PR addresses multiple bug fixes and build configuration adjustments: simplifying CMake build version setup with template-based generation, removing the UpdateCache flag from HLenCmd to correct cache behavior, fixing integer overflow in rate-limiter bandwidth with 64-bit literals, and correcting pointer arithmetic in user key encoding.

Changes

Cohort / File(s) Summary
Build Configuration
CMakeLists.txt
Simplified PIKA_BUILD_VERSION_CC variable assignment to single-line, added debug message, and introduced configure_file call for template-based build_version.cc generation at build time.
Command Cache Behavior
src/pika_command.cc
Removed UpdateCache flag from HLenCmd initialization while preserving ReadCache, altering automatic cache update behavior for the command.
Rate-Limiter Configuration
src/pika_conf.cc
Fixed potential integer overflow by changing rate-limiter bandwidth upper-bound assignment from 32-bit to 64-bit literal (10LL \* 1024 \* 1024 \* 1024) to ensure proper handling on 32-bit platforms.
Storage Key Encoding
src/storage/include/storage/storage_define.h
Corrected pointer advancement in EncodeUserKey by adding dst_ptr adjustment for remaining bytes before appending the key delimiter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

☢️ Bug

Poem

🐰 Whiskers twitch with fixing glee,
Bugs be gone, now all runs free!
Overflow squashed, pointers set right,
Cache behavior shining bright!

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix: some bugs for v4.0.2' is vague and overly broad, using generic language that fails to convey meaningful information about the specific bugs being fixed. Replace with a more descriptive title that highlights the primary bug fixes, such as 'fix: rate_limiter overflow, HLEN cache update, and key encoding issues' or focus on the most critical fix.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into unstable

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
CMakeLists.txt (1)

793-806: Build version generation via configure_file is a clean approach.

Using a .in template with configure_file is standard CMake practice. The version info is captured at configure time (when CMake is run), not at build time. This means the git SHA and build date won't change on subsequent rebuilds unless CMake is re-run. If you need the version to update on every build, consider using add_custom_command instead.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

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 fixes four bugs for the v4.0.2 release of Pika, a Redis-compatible persistent storage system. The changes address issues with build configuration, key encoding, rate limiter overflow, and cache consistency for the HLEN command.

Changes:

  • Remove unnecessary file reference from CMake build configuration
  • Fix pointer increment bug in key encoding when handling null bytes (\x00)
  • Fix integer overflow in rate limiter bandwidth calculation
  • Remove cache update flag from HLEN command to prevent TTL-related cache inconsistencies

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
CMakeLists.txt Removes incorrect file reference (src/pika_cache_load_thread.cc) from PIKA_BUILD_VERSION_CC variable
src/storage/include/storage/storage_define.h Adds missing pointer increment after memcpy to correctly position delimiter when encoding keys with null bytes
src/pika_conf.cc Adds LL suffix to 10GB calculation to prevent integer overflow in rate_limiter_bandwidth_ assignment
src/pika_command.cc Removes kCmdFlagsUpdateCache flag from HLenCmd to fix cache TTL handling issues

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

@chejinge chejinge self-requested a review March 9, 2026 07:44
@chejinge chejinge merged commit bc72424 into OpenAtomFoundation:unstable Mar 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants