tiflow icon indicating copy to clipboard operation
tiflow copied to clipboard

dm: Add marker option to redact info log

Open db-will opened this issue 9 months ago • 6 comments

What problem does this PR solve?

Issue Number: close #11489

What is changed and how it works?

Add marker option similar to other components(https://docs.pingcap.com/tidb/stable/log-redaction) for redacting info log

Check List

Tests

Manual test with following config to start dm worker:

...
# Log configuration.
log-level = "debug"
log-file = ".log/dm-worker.log"
redact-info-log = "marker"
...

By testing with a dm task, we can see the related logs:

[2025/02/23 02:04:21.316 -05:00] [DEBUG] [baseconn.go:184] ["execute statement"] [task=testdm] [unit="binlog replication"] [query="INSERT INTO `testdm`.`t1` (`id`,`uid`,`name`,`info`) VALUES (?,?,?,?)"] [argument="‹[20250223 3 Williama <nil>]›"]

We are expected to see sensitive data is wrapped by '‹' and '›' marker like other components.

Questions

Will it cause performance regression or break compatibility?

No

Do you need to update user documentation, design documentation or monitoring documentation?

Yes, here are a few documentation needed to be updated:

  • https://docs.pingcap.com/tidb/stable/log-redaction
  • https://docs.pingcap.com/tidb/stable/dm-worker-configuration-file

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

DM enhances log redaction and supports marking user data in DM worker logs with and . Based on the marked logs, you can decide whether to redact the marked information when displaying the logs, thus increasing the flexibility of log redaction.

db-will avatar Feb 23 '25 07:02 db-will

[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 gmhdbjd, yudongusa for approval, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

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

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

ti-chi-bot[bot] avatar Feb 23 '25 07:02 ti-chi-bot[bot]

Hi @db-will. 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.

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[bot] avatar Feb 23 '25 07:02 ti-chi-bot[bot]

/ok-to-test

lance6716 avatar Jun 05 '25 04:06 lance6716

@lance6716: GitHub didn't allow me to request PR reviews from the following users: OliverS929.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Can we reuse TiDB's, or other packages redact functions?

/cc @GMHDBJD @OliverS929

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[bot] avatar Jun 05 '25 05:06 ti-chi-bot[bot]

Codecov Report

Attention: Patch coverage is 4.16667% with 92 lines in your changes missing coverage. Please review.

Project coverage is 55.0300%. Comparing base (4c38b91) to head (f3e300e). Report is 30 commits behind head on master.

:x: Your patch check has failed because the patch coverage (4.1666%) is below the target coverage (60.0000%). You can increase the patch coverage or adjust the target coverage. :x: Your project check has failed because the head coverage (55.0300%) is below the target coverage (60.0000%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
Components Coverage Δ
cdc 59.2611% <ø> (-0.3447%) :arrow_down:
dm 50.0239% <4.1666%> (-0.1143%) :arrow_down:
engine 53.2279% <ø> (+0.0112%) :arrow_up:
Flag Coverage Δ
unit 55.0300% <4.1666%> (-0.2022%) :arrow_down:

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

@@               Coverage Diff                @@
##             master     #12070        +/-   ##
================================================
- Coverage   55.2321%   55.0300%   -0.2022%     
================================================
  Files          1029       1030         +1     
  Lines        142924     143309       +385     
================================================
- Hits          78940      78863        -77     
- Misses        58190      58646       +456     
- Partials       5794       5800         +6     
:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 05 '25 05:06 codecov[bot]

@db-will: The following test 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-dm-integration-test f3e300e164e8d04f893537ecf669f074b3093ba5 link true /test pull-dm-integration-test

Full PR test history. Your PR dashboard.

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.

ti-chi-bot[bot] avatar Jun 05 '25 05:06 ti-chi-bot[bot]