Skip to content

[Store] Fix error log spam for non-memory replicas in DiscardedReplicas#1626

Merged
stmatengss merged 1 commit intokvcache-ai:mainfrom
he-yufeng:fix/discard-replica-type-check
Mar 10, 2026
Merged

[Store] Fix error log spam for non-memory replicas in DiscardedReplicas#1626
stmatengss merged 1 commit intokvcache-ai:mainfrom
he-yufeng:fix/discard-replica-type-check

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Fixes #1618

Root Cause

DiscardedReplicas (master_service.h) iterates all discarded replicas and calls get_memory_buffer_size() on each. This method only handles MEMORY replicas — for DISK or LOCAL_DISK, it logs "Invalid replica type: DISK" and returns 0.

In L3/DFS scenarios where DISK replicas are routinely discarded, this produces continuous error log spam (as reported in #1618).

Changes

  1. master_service.h: Guard get_memory_buffer_size() call with is_memory_replica() in DiscardedReplicas constructor. Functionally equivalent (non-memory types already return 0) but eliminates the error log.

  2. replica.h: Add LOCAL_DISK to the operator<< string map for ReplicaType. It was missing — printing a LOCAL_DISK type showed "UNKNOWN" instead of "LOCAL_DISK".

DiscardedReplicas iterates all replicas and calls get_memory_buffer_size(),
which logs "Invalid replica type: DISK" for non-memory replicas. In L3/DFS
scenarios where DISK replicas are routinely discarded, this produces
continuous error log spam.

Guard the call with is_memory_replica() so only memory replicas contribute
to the size counter. Functionally equivalent (non-memory types already
return 0) but eliminates the misleading error logs.

Also add LOCAL_DISK to the ReplicaType operator<< string map — it was
missing, causing LOCAL_DISK to print as "UNKNOWN" in diagnostics.

Fixes kvcache-ai#1618
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue causing continuous error log spam in L3/DFS scenarios by preventing an invalid method call on non-memory replicas. It also improves logging clarity by ensuring all replica types are correctly represented in string output. The changes aim to reduce noise in system logs and enhance debugging capabilities without altering core functionality.

Highlights

  • Log Spam Reduction: Introduced a conditional check (is_memory_replica()) in the DiscardedReplicas constructor within master_service.h to prevent get_memory_buffer_size() from being called on non-memory replicas, thereby eliminating error log spam for DISK and LOCAL_DISK types.
  • Replica Type Logging: Extended the operator<< string map for ReplicaType in replica.h to include LOCAL_DISK, ensuring that LOCAL_DISK replica types are correctly printed as "LOCAL_DISK" instead of "UNKNOWN".

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • mooncake-store/include/master_service.h
    • Added a check if (replica.is_memory_replica()) before calling replica.get_memory_buffer_size() in the DiscardedReplicas constructor.
  • mooncake-store/include/replica.h
    • Included ReplicaType::LOCAL_DISK with its string representation "LOCAL_DISK" in the replica_type_strings map for the operator<< overload.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the error log spam from DiscardedReplicas by adding a guard to prevent calls to get_memory_buffer_size() for non-memory replicas. It also correctly adds the missing LOCAL_DISK replica type to its string conversion operator, fixing an incorrect log output. The changes are sound and well-targeted. I've added one suggestion to improve the performance of the enum-to-string conversion in replica.h by using a more efficient data structure.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mooncake-store/include/replica.h 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@stmatengss stmatengss self-assigned this Mar 10, 2026
@stmatengss
Copy link
Copy Markdown
Collaborator

Clear fix. LGTM. THX

@stmatengss stmatengss merged commit d864d12 into kvcache-ai:main Mar 10, 2026
16 checks passed
whn09 pushed a commit to whn09/Mooncake that referenced this pull request Apr 4, 2026
…as (kvcache-ai#1626)

DiscardedReplicas iterates all replicas and calls get_memory_buffer_size(),
which logs "Invalid replica type: DISK" for non-memory replicas. In L3/DFS
scenarios where DISK replicas are routinely discarded, this produces
continuous error log spam.

Guard the call with is_memory_replica() so only memory replicas contribute
to the size counter. Functionally equivalent (non-memory types already
return 0) but eliminates the misleading error logs.

Also add LOCAL_DISK to the ReplicaType operator<< string map — it was
missing, causing LOCAL_DISK to print as "UNKNOWN" in diagnostics.

Fixes kvcache-ai#1618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: E0306 11:12:10.776882 116419 replica.h:281] Invalid replica type: DISK

3 participants