Skip to content

store/helper: use hex encoding for region key in log#65560

Merged
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
MkDev11:fix-region-key-logging-65357
Jan 20, 2026
Merged

store/helper: use hex encoding for region key in log#65560
ti-chi-bot[bot] merged 2 commits intopingcap:masterfrom
MkDev11:fix-region-key-logging-65357

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented Jan 13, 2026

What problem does this PR solve?

Issue Number: ref #65357

Problem Summary: When logging a failed region key decode in NewFrameItemFromRegionKey, zap.ByteString is used which assumes valid UTF-8. Non-UTF8 binary keys get displayed with Unicode replacement characters (\uFFFD), making logs unhelpful for debugging.

What changed and how does it work?

Use hex.EncodeToString instead of zap.ByteString to display the region key in hex format, which properly represents all binary data.

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.
    • This is a logging format change only, no functional behavior change

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

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. contribution This PR is from a community contributor. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 13, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 13, 2026

Hi @MkDev11. 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 the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Jan 13, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 13, 2026

Welcome @MkDev11!

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. 😃

@pingcap-cla-assistant
Copy link
Copy Markdown

pingcap-cla-assistant bot commented Jan 13, 2026

CLA assistant check
All committers have signed the CLA.

@MkDev11 MkDev11 removed their assignment Jan 13, 2026
@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 13, 2026

/ok-to-test

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 13, 2026

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

Details

In response to this:

/ok-to-test

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
Copy Markdown

tiprow bot commented Jan 13, 2026

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

Details

In response to this:

/ok-to-test

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.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 13, 2026

/assign @sylzd

@lance6716
Copy link
Copy Markdown
Contributor

/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 14, 2026
@MkDev11 MkDev11 requested a review from lance6716 January 14, 2026 03:02
@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 14, 2026

/assign @lance6716

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 14, 2026

@lance6716 could you please approve this small PR? :)

Copy link
Copy Markdown
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

/cc @YangKeao

@ti-chi-bot ti-chi-bot bot requested a review from YangKeao January 14, 2026 03:23
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.6032%. Comparing base (812bd31) to head (4aff1a9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65560        +/-   ##
================================================
- Coverage   77.7946%   77.6032%   -0.1914%     
================================================
  Files          1992       1916        -76     
  Lines        544075     531755     -12320     
================================================
- Hits         423261     412659     -10602     
+ Misses       119155     119088        -67     
+ Partials       1659          8      -1651     
Flag Coverage Δ
integration 41.5232% <0.0000%> (-6.6640%) ⬇️
unit 76.7272% <100.0000%> (+0.3049%) ⬆️

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

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 48.7423% <ø> (-12.2924%) ⬇️
🚀 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.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 20, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-14 03:24:34.305766356 +0000 UTC m=+414318.367631265: ☑️ agreed by lance6716.
  • 2026-01-20 08:00:23.597992249 +0000 UTC m=+480851.211949105: ☑️ agreed by YangKeao.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

@YangKeao thanks for your quick approval. Could you please merge it now?

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

/retest

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

@YangKeao @lance6716 That failing check is not related to the PR. Please let me know if you can merge it.

@lance6716
Copy link
Copy Markdown
Contributor

/retest

@lance6716
Copy link
Copy Markdown
Contributor

merging is automatically done by bot. we can only retry flaky tests.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

Thanks for your reply!

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

/retest-required

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

@lance6716 could you please let me know why bot doesn't merge my PR yet?

@tangenta
Copy link
Copy Markdown
Contributor

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2026
@ti-chi-bot ti-chi-bot bot requested review from YangKeao and lance6716 January 20, 2026 14:16
@MkDev11 MkDev11 force-pushed the fix-region-key-logging-65357 branch from cb687c9 to b1e641c Compare January 20, 2026 14:22
@MkDev11 MkDev11 requested a review from tangenta January 20, 2026 14:23
@MkDev11 MkDev11 force-pushed the fix-region-key-logging-65357 branch from b1e641c to 1ff91ae Compare January 20, 2026 14:28
@lance6716
Copy link
Copy Markdown
Contributor

/lgtm
/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta, YangKeao

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [YangKeao,lance6716,tangenta]

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

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

/retest-required

@MkDev11 MkDev11 force-pushed the fix-region-key-logging-65357 branch from 1ff91ae to 406b339 Compare January 20, 2026 15:00
MkDev11 and others added 2 commits January 20, 2026 17:07
Use hex.EncodeToString instead of zap.ByteString to display region
keys in logs. zap.ByteString assumes valid UTF-8 and replaces invalid
bytes with Unicode replacement characters, making the output unhelpful
for debugging binary keys.

Close pingcap#65357
@MkDev11 MkDev11 force-pushed the fix-region-key-logging-65357 branch from 406b339 to 4aff1a9 Compare January 20, 2026 15:08
@YangKeao
Copy link
Copy Markdown
Member

/retest

1 similar comment
@YangKeao
Copy link
Copy Markdown
Member

/retest

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented Jan 20, 2026

all checks passed!

@ti-chi-bot ti-chi-bot bot merged commit e9c1bbb into pingcap:master Jan 20, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 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. lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants