Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Solved the problem of commandstate statistics duplication #3028

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

Mixficsol
Copy link
Collaborator

@Mixficsol Mixficsol commented Feb 25, 2025

fix: #3027

Summary by CodeRabbit

  • Chores
    • Simplified the automated dependency installation process.
    • Updated server configuration settings with revised network port references and clearer auto-tuning parameters.
  • Refactor
    • Enhanced internal command tracking to improve usage statistics accuracy.

Copy link

coderabbitai bot commented Feb 25, 2025

Walkthrough

The pull request simplifies the macOS build job by removing Homebrew update and extra dependency installation steps, leaving only a reduced set of packages to install. In the configuration file, port offset comments and the rate limiter setting have been updated. Additionally, the PikaClientConn method now updates command statistics using the command option (opt) instead of the first argument (argv[0]). The overall structure and public interfaces remain unchanged.

Changes

File(s) Change Summary
.github/workflows/pika.yml Removed lines from the "Install Deps" step in the macOS build job, eliminating Homebrew update and installation of Python 3.12, autoconf, protobuf, llvm, wget, and git.
conf/pika.conf Updated port offset comments from port+10000 to port+10001 and revised the rate limiter setting from a boolean (true) to a string (yes) in commented configuration options.
src/pika_client_conn.cc Modified the ReadCmdInCache method to update command statistics using opt instead of argv[0] as the key in the cmdstat_map.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant Conn as PikaClientConn
    C->>Conn: Send command with option
    Conn->>Conn: Extract command option (opt)
    Conn->>Conn: Update cmdstat_map using opt as key
Loading

Possibly related PRs

  • fix:fix CI #2924: Updates similar dependency installation commands in the macOS build job, aligning with the removal of extra packages and Homebrew update steps.

Poem

Hop, hop, through lines of code I bound,
Cleaning up workflows, a simpler path is found.
Ports now whisper a new offset tune,
While command stats dance under an updated moon.
I’m a playful rabbit, celebrating each refined round!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Feb 25, 2025
@Mixficsol Mixficsol force-pushed the config_bug branch 8 times, most recently from 76582c5 to 959f8bf Compare February 25, 2025 11:23
@Mixficsol Mixficsol marked this pull request as ready for review February 25, 2025 15:57
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26d10e6 and 36d4d7b.

📒 Files selected for processing (3)
  • .github/workflows/pika.yml (1 hunks)
  • conf/pika.conf (2 hunks)
  • src/pika_client_conn.cc (1 hunks)
🔇 Additional comments (3)
.github/workflows/pika.yml (1)

158-158:

✅ Verification successful

Simplified macOS dependency installation

This change reduces the number of dependencies installed for macOS builds, which should speed up CI execution.

Let's verify that the removed dependencies ([email protected], protobuf, autoconf, llvm, wget, git) aren't needed elsewhere in the workflow:


🏁 Script executed:

#!/bin/bash
# Check for potential usages of the removed dependencies in the workflow
echo "Checking for potential usages of removed dependencies..."
grep -r "python" --include="*.yml" .github/workflows/ || echo "No direct Python references"
grep -r "protobuf" --include="*.yml" .github/workflows/ || echo "No direct protobuf references"
grep -r "autoconf" --include="*.yml" .github/workflows/ || echo "No direct autoconf references"
grep -r "llvm" --include="*.yml" .github/workflows/ || echo "No direct llvm references"
grep -r "wget" --include="*.yml" .github/workflows/ || echo "No direct wget references"

Length of output: 1240


Simplified macOS Installation Verified

  • Verified that the use of "python" in .github/workflows/codeql.yml is simply part of the language configuration and not an installation dependency.
  • Confirmed that "protobuf" and "autoconf" still appear in .github/workflows/pika.yml and .github/workflows/release.yml, which are used for Linux builds.
  • Noted that "wget" is referenced only in Linux workflows, and no direct usage of "llvm" was detected.

This confirms that the removal of [email protected], protobuf, autoconf, llvm, wget, and git from the macOS installation is safe and appropriate for speeding up CI on macOS.

conf/pika.conf (2)

6-7:

✅ Verification successful

Updated port offset documentation

The documentation now correctly indicates that port+10001 is used for Rsync instead of port+10000.

Let's verify if this port offset is used consistently in the codebase:


🏁 Script executed:

#!/bin/bash
# Look for references to port offsets in the code
echo "Checking for port offset references in codebase..."
grep -r "10000" --include="*.cc" --include="*.h" src/ || echo "No direct references to port+10000"
grep -r "10001" --include="*.cc" --include="*.h" src/ || echo "No direct references to port+10001"

Length of output: 19249


Port Offset Documentation Update Verified

The changes in conf/pika.conf (lines 6–7) now correctly document that Rsync uses port+10001 instead of port+10000. A search through the codebase confirmed that there are no direct references to “port+10001,” indicating that this port offset is only used in the documentation as intended.


503-503:

❓ Verification inconclusive

Standardized boolean configuration value

Changed boolean representation from true to yes for consistency with other configuration options.

Let's check if other boolean configs in the file use the same format:


🏁 Script executed:

#!/bin/bash
# Check boolean formats in configuration file
echo "Checking boolean formats in pika.conf..."
grep -n "true\|false" conf/pika.conf
grep -n "yes\|no" conf/pika.conf | head -10

Length of output: 1184


Standardized Boolean Value for Rate-Limiter Auto-Tune

The change updating the rate-limiter-auto-tuned configuration to use “yes” shows consistency with several options (e.g., rtc-cache-read and slow-cmd-pool use “yes”/“no”). However, the grep output reveals that a few options (like disable_auto_compactions and wash-data) still use “true/false.” Please verify whether this mixed usage is intentional or if you plan to standardize all boolean values across the file.

Comment on lines +374 to +375
(*cmdstat_map)[opt].cmd_count.fetch_add(1);
(*cmdstat_map)[opt].cmd_time_consuming.fetch_add(time_stat_->total_time());
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fixed commandstate statistics duplication

This change correctly addresses the problem mentioned in the PR title. Now command statistics are consistently tracked using the command option (opt) instead of the first argument (argv[0]). This ensures proper statistics accounting and aligns with how statistics are tracked elsewhere in the code (see lines 209-210).

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.

info Commandstats may error
1 participant