pika icon indicating copy to clipboard operation
pika copied to clipboard

fix: write-buffer-size overflow

Open Z-G-H1 opened this issue 1 month ago • 1 comments

fix https://github.com/OpenAtomFoundation/pikiwidb/issues/3183 修复在 pika v3.5.5中设置 write-buffer-size 值大于 2147483647时,write-buffer-size 会变成负数的问题

Summary by CodeRabbit

  • Improvements

    • write-buffer-size setting now accepts larger 64-bit values for high-capacity deployments.
  • Tests

    • New integration test verifies setting and retrieving very large write-buffer-size values.
    • Unit tests updated to use tolerant numeric comparisons for floating-point results.
  • Chores

    • CI workflow refined: targeted workspace cleanup, updated macOS runner and compiler toolchain handling, and improved build/configuration reliability.

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

Z-G-H1 avatar Nov 26 '25 07:11 Z-G-H1

Walkthrough

Updated PikaConf setter to accept a 64-bit value, adjusted its call site, added an integration test that sets write-buffer-size to 3000000000, tightened floating-point test assertions to numeric comparisons, and revised macOS CI runner, toolchain resolution, and targeted cleanup steps in the workflow.

Changes

Cohort / File(s) Summary
Configuration Type Signature Update
include/pika_conf.h
void SetWriteBufferSize(const int& value)void SetWriteBufferSize(int64_t value) (signature change to match int64_t member).
Call Site Adjustment
src/pika_admin.cc
Removed explicit static_cast and pass the value directly to the updated SetWriteBufferSize parameter type.
Integration Test Addition
tests/integration/server_test.go
New test "should ConfigSet write-buffer-size large value" sets write-buffer-size to 3000000000, expects OK, and verifies ConfigGet returns that value.
CI Workflow Updates
.github/workflows/pika.yml
Bumped macOS runner to macos-14, updated ccache key, derive GCC prefix (gcc@13) for compiler paths, and narrowed workspace cleanup targets (removed broad system deletions).
Test Precision Fix
src/storage/tests/hashes_test.cc
Replaced string equality for numeric results with std::stod + ASSERT_NEAR (tolerance 1e-9) in HIncrbyfloat tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify no other public call sites or downstream consumers rely on the old SetWriteBufferSize(const int&) signature.
  • Check ABI/export implications for headers used by external builds.
  • Validate the new integration test for flakiness on different architectures/CI runners.
  • Confirm macOS CI compiler prefix resolution works reliably on macos-14 runners.

Possibly related PRs

  • OpenAtomFoundation/pikiwidb#2880 — related conversion of integer configuration fields in PikaConf to int64_t.
  • OpenAtomFoundation/pikiwidb#3204 — overlapping changes to .github/workflows/pika.yml cleanup steps.
  • OpenAtomFoundation/pikiwidb#2924 — other CI workflow adjustments in .github/workflows/pika.yml.

Suggested reviewers

  • Mixficsol
  • chejinge

Poem

🐇 I hop through bytes both wide and deep,
No signed trap now wakes from sleep.
Three billion carrots in my store,
My buffer grows and worries no more.
Hoppity-hop, code safe once more! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The changes to .github/workflows/pika.yml (runner/compiler updates) and src/storage/tests/hashes_test.cc (numeric assertion precision) appear unrelated to the write-buffer-size overflow fix. Remove unrelated workflow infrastructure changes and hash test precision updates; focus only on write-buffer-size int64_t conversion and related code/tests.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing write-buffer-size overflow by updating parameter type from int to int64_t to handle values > 2,147,483,647.
Linked Issues check ✅ Passed The PR directly fixes the reported issue #3183 by changing SetWriteBufferSize parameter type from int to int64_t, enabling values > 2,147,483,647, and adds an integration test validating the fix works for 3,000,000,000.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 658b9d5c1ee022ac95f8ec8a34baaf4b71e99552 and 23057893407534ba01a4ae935912d679d1f24040.

📒 Files selected for processing (1)
  • .github/workflows/pika.yml (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pika.yml
⏰ 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). (4)
  • GitHub Check: Analyze (go)
  • GitHub Check: build_on_ubuntu
  • GitHub Check: build_on_centos
  • GitHub Check: build_on_macos

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.

coderabbitai[bot] avatar Nov 26 '25 07:11 coderabbitai[bot]