Skip to content

contrib: fix columnar hub IaConfig default value#10864

Open
yongman wants to merge 1 commit into
pingcap:masterfrom
yongman:fix-config-default-value
Open

contrib: fix columnar hub IaConfig default value#10864
yongman wants to merge 1 commit into
pingcap:masterfrom
yongman:fix-config-default-value

Conversation

@yongman
Copy link
Copy Markdown
Member

@yongman yongman commented May 22, 2026

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • Tests

    • Added unit tests to validate default configuration behavior across different operating systems.
  • Bug Fixes

    • Updated default configuration values to be OS-aware, with Linux-specific and macOS-specific defaults for memory and disk capacity settings.

Review Change Stack

Signed-off-by: yongman <yming0221@gmail.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels May 22, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign searise for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pantheon-ai
Copy link
Copy Markdown

pantheon-ai Bot commented May 22, 2026

@yongman I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details.

⏳ This process typically takes 10-30 minutes depending on the complexity of the changes.

ℹ️ Learn more details on Pantheon AI.

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

ConfigFile removes the automatic Default derive and implements a custom Default that uses OS-specific helper functions to set IaConfig capacity defaults: Linux uses 20% memory and 70% disk percentages, while macOS uses 100MB absolute values. Unit tests validate this behavior across operating systems.

Changes

ConfigFile Default Implementation

Layer / File(s) Summary
Custom Default implementation with OS-specific helpers
contrib/tiflash-columnar-hub/hub-runtime/src/run.rs
Removed Default derive from ConfigFile and added OS-specific update_default_ia_config helpers for Linux and macOS, plus a custom impl Default for ConfigFile that initializes IaConfig capacity defaults via these helpers before constructing the rest of the config.
Unit tests for OS-specific defaults
contrib/tiflash-columnar-hub/hub-runtime/src/run.rs
Added tests that assert ConfigFile::default() and minimal TOML configs missing an [ia] section correctly populate ia.mem_cap and ia.disk_cap with OS-specific expected values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through Linux lands and Mac terrain,
Setting safe defaults without strain,
Percentages here, bytes there,
With tests to show the defaults care,
Config grows wise with rabbit's flair! 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description uses the required template structure but all substantive sections are incomplete or empty: Problem Summary is missing, commit-message block is empty, and all checklist items are unchecked. Fill in the Problem Summary section, provide implementation details in the commit-message block, check applicable test and side-effect items, and confirm documentation impacts.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: implementing a fix for IaConfig default values in the columnar hub module.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 22, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
contrib/tiflash-columnar-hub/hub-runtime/src/run.rs (1)

1428-1447: 💤 Low value

Consider adding test coverage for non-Linux/macOS platforms.

The test only validates Linux and macOS defaults. If you add a fallback for other operating systems (per the critical issue above), consider adding a test branch for those platforms as well.

📝 Optional test enhancement
     #[test]
     fn test_config_file_default_uses_proxy_compatible_ia_defaults() {
         let config = ConfigFile::default();
         #[cfg(target_os = "linux")]
         {
             assert_eq!(config.ia.mem_cap, AbsoluteOrPercentSize::Percent(20.0));
             assert_eq!(config.ia.disk_cap, AbsoluteOrPercentSize::Percent(70.0));
         }
         #[cfg(target_os = "macos")]
         {
             assert_eq!(
                 config.ia.mem_cap,
                 AbsoluteOrPercentSize::Abs(ReadableSize::mb(100))
             );
             assert_eq!(
                 config.ia.disk_cap,
                 AbsoluteOrPercentSize::Abs(ReadableSize::mb(100))
             );
         }
+        #[cfg(not(any(target_os = "linux", target_os = "macos")))]
+        {
+            // Fallback platforms should use conservative absolute defaults
+            assert_eq!(
+                config.ia.mem_cap,
+                AbsoluteOrPercentSize::Abs(ReadableSize::mb(100))
+            );
+            assert_eq!(
+                config.ia.disk_cap,
+                AbsoluteOrPercentSize::Abs(ReadableSize::mb(100))
+            );
+        }
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs` around lines 1428 -
1447, The test test_config_file_default_uses_proxy_compatible_ia_defaults only
asserts Linux and macOS behavior; add a third cfg branch for non-Linux/macOS
targets (e.g. #[cfg(not(any(target_os = "linux", target_os = "macos")))]) that
constructs ConfigFile::default() and asserts config.ia.mem_cap and
config.ia.disk_cap equal the intended fallback AbsoluteOrPercentSize values (use
the same enum variants as in other branches); reference ConfigFile::default,
config.ia.mem_cap, config.ia.disk_cap, AbsoluteOrPercentSize, and
ReadableSize::mb when mirroring the expected values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs`:
- Around line 172-184: The function update_default_ia_config is only defined for
linux and macos causing build failures on other targets where it's referenced;
add a portable fallback or conditional call: either provide a non-conditional
implementation of update_default_ia_config(ia: &mut IaConfig) that sets sane
defaults for other platforms, or wrap the site that calls
update_default_ia_config in the same #[cfg(...)] checks so it's only called
where the function exists; refer to the update_default_ia_config function and
the IaConfig type to locate where to add the fallback or the cfg gating.

---

Nitpick comments:
In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs`:
- Around line 1428-1447: The test
test_config_file_default_uses_proxy_compatible_ia_defaults only asserts Linux
and macOS behavior; add a third cfg branch for non-Linux/macOS targets (e.g.
#[cfg(not(any(target_os = "linux", target_os = "macos")))]) that constructs
ConfigFile::default() and asserts config.ia.mem_cap and config.ia.disk_cap equal
the intended fallback AbsoluteOrPercentSize values (use the same enum variants
as in other branches); reference ConfigFile::default, config.ia.mem_cap,
config.ia.disk_cap, AbsoluteOrPercentSize, and ReadableSize::mb when mirroring
the expected values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dc93ab0c-30e2-40ca-808c-5bbadafc9bbf

📥 Commits

Reviewing files that changed from the base of the PR and between 61d37c1 and f971059.

📒 Files selected for processing (1)
  • contrib/tiflash-columnar-hub/hub-runtime/src/run.rs

Comment thread contrib/tiflash-columnar-hub/hub-runtime/src/run.rs
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented May 22, 2026

@yongman: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-sanitizer-asan f971059 link false /test pull-sanitizer-asan
pull-sanitizer-tsan f971059 link false /test pull-sanitizer-tsan

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant