Skip to content

executor: normalize IEC binary unit display for config values#65350

Closed
majiayu000 wants to merge 2 commits intopingcap:masterfrom
majiayu000:fix-51740-mismatch-unit-of-configuration-1231-0116
Closed

executor: normalize IEC binary unit display for config values#65350
majiayu000 wants to merge 2 commits intopingcap:masterfrom
majiayu000:fix-51740-mismatch-unit-of-configuration-1231-0116

Conversation

@majiayu000
Copy link

What problem does this PR solve?

Issue Number: close #51740

Problem Summary:
When displaying configuration values via SHOW CONFIG, byte size values like "24MiB" were not matching the user's input format "24MB". This caused confusion as users expected to see the same unit notation they used when setting config values.

What changed and how does it work?

Added a normalizeByteSizeUnit function that converts IEC binary unit suffixes (MiB, GiB, KiB, TiB, PiB, EiB) to SI decimal unit suffixes (MB, GB, KB, TB, PB, EB) for display consistency.

The docker/go-units library parses both "MB" and "MiB" as binary units (1024-based) but outputs using IEC notation ("MiB"). This change normalizes the display to use SI notation ("MB") to match user expectations.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Fixed a display mismatch where configuration byte sizes set with SI units (MB, GB) were shown with IEC units (MiB, GiB) in SHOW CONFIG output.

When displaying configuration values via SHOW CONFIG, byte size
values like "24MiB" are now normalized to "24MB" for consistency
with the input format. This fixes the mismatch where users input
"24MB" but see "24MiB" in the output.

The docker/go-units library parses both "MB" and "MiB" as binary
units (1024-based) but outputs using IEC notation ("MiB"). This
change normalizes the display to use SI notation ("MB") to match
user expectations.

Fixes pingcap#51740

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.com>
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. contribution This PR is from a community contributor. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 30, 2025

Hi @majiayu000. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@ti-chi-bot ti-chi-bot bot added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. labels Dec 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 30, 2025

Welcome @majiayu000!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 30, 2025

[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 kennytm 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

@pingcap-cla-assistant
Copy link

pingcap-cla-assistant bot commented Dec 30, 2025

CLA assistant check
All committers have signed the CLA.

@tiprow
Copy link

tiprow bot commented Dec 30, 2025

Hi @majiayu000. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@majiayu000
Copy link
Author

/test all

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 31, 2025

@majiayu000: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/test all

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.

1 similar comment
@tiprow
Copy link

tiprow bot commented Dec 31, 2025

@majiayu000: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/test all

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.

@yiliu-pingcap
Copy link

@pantheon-bot, can you comprehensively review this pr?

@lance6716
Copy link
Contributor

I think we should keep the original input from user? Not normalize them to 24MiB (before your PR) or 24MB (after your PR)

@majiayu000
Copy link
Author

@lance6716 Thanks for the suggestion about keeping original user input. I implemented raw-size preservation at the source components and opened PRs:\n- tikv/tikv#19257\n- tikv/pd#10126\n- pingcap/tidb-engine-ext#450 (tiflash-proxy)\n\nThese keep the original size string in /config when the parsed bytes match the current value (so we don't show mismatched units). Does this align with your expectation? Any other components you'd like to cover (e.g. TiProxy)?

@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 4, 2026
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.0754%. Comparing base (8c3f0a5) to head (a8c5bf8).
⚠️ Report is 431 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65350        +/-   ##
================================================
+ Coverage   70.7729%   77.0754%   +6.3024%     
================================================
  Files          1902       1914        +12     
  Lines        518934     537702     +18768     
================================================
+ Hits         367265     414436     +47171     
+ Misses       127126     122269      -4857     
+ Partials      24543        997     -23546     
Flag Coverage Δ
integration 41.5397% <0.0000%> (-6.6395%) ⬇️
unit 76.7743% <100.0000%> (+11.1045%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 56.6191% <ø> (+3.7490%) ⬆️
parser ∅ <ø> (∅)
br 48.8150% <ø> (-9.5103%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@majiayu000
Copy link
Author

Closing this PR due to extended inactivity. Happy to reopen if there's still interest — feel free to comment.

@majiayu000 majiayu000 closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Mismatch unit of configuration item when set and then get config via SQL

4 participants