Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: add tidb_log_desensitization global variable to control whether do desensitization when log query #18578

Merged
merged 5 commits into from
Jul 15, 2020

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Jul 15, 2020

What problem does this PR solve?

ref: #18566

Add tidb_log_desensitization global variable to control whether do desensitization when log query.

Here are some examples:

Before

[2020/07/15 13:39:17.601 +08:00] [INFO] [session.go:2247] [GENERAL_LOG] [conn=9] [user=root@127.0.0.1] [schemaVersion=36] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [current_db=test] [txn_mode=PESSIMISTIC] [sql="insert into t values (2,2),(3,3)"]
[2020/07/15 13:39:17.602 +08:00] [ERROR] [conn.go:737] ["command dispatched failed"] [conn=9] [connInfo="id:9, addr:127.0.0.1:54956 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="insert into t values (2,2),(3,3)"] [txn_mode=PESSIMISTIC] [err="[kv:1062]Duplicate entry '2' for key 'idx1'"]

Now

after set @@global.tidb_log_desensitization=1;;

[2020/07/15 13:38:36.353 +08:00] [INFO] [session.go:2247] [GENERAL_LOG] [conn=6] [user=root@127.0.0.1] [schemaVersion=36] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [current_db=test] [txn_mode=PESSIMISTIC] [sql="insert into t values ( ... ) , ( ... )"]
[2020/07/15 13:38:36.354 +08:00] [ERROR] [conn.go:737] ["command dispatched failed"] [conn=6] [connInfo="id:6, addr:127.0.0.1:54947 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="insert into t values ( ... ) , ( ... )"] [txn_mode=PESSIMISTIC] [err="[kv:1062]Duplicate entry '2' for key 'idx1'"]

What is changed and how it works?

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)
set @@global.tidb_log_desensitization=1;
set @@tidb_general_log=1;
-- execute some sql, and then check the tidb log output.

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • add tidb_log_desensitization global variable to control whether do desensitization when log query.

@crazycs520 crazycs520 added the type/enhancement The issue or PR belongs to an enhancement. label Jul 15, 2020
@crazycs520 crazycs520 requested a review from a team as a code owner July 15, 2020 05:45
@crazycs520 crazycs520 requested review from wshwsh12 and removed request for a team July 15, 2020 05:46
Signed-off-by: crazycs520 <[email protected]>
@github-actions github-actions bot added the sig/execution SIG execution label Jul 15, 2020
@nolouch nolouch added this to the v4.0.3 milestone Jul 15, 2020
@bb7133 bb7133 added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Jul 15, 2020
@crazycs520
Copy link
Contributor Author

/rebuild

@codecov
Copy link

codecov bot commented Jul 15, 2020

Codecov Report

Merging #18578 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #18578   +/-   ##
===========================================
  Coverage   79.2934%   79.2934%           
===========================================
  Files           540        540           
  Lines        145601     145601           
===========================================
  Hits         115452     115452           
  Misses        20858      20858           
  Partials       9291       9291           

@crazycs520
Copy link
Contributor Author

/run-all-tests

@tiancaiamao
Copy link
Contributor

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 15, 2020
@crazycs520
Copy link
Contributor Author

/run-all-tests

1 similar comment
@crazycs520
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot
Copy link
Contributor

@bb7133,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: execution(slack).

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Jul 15, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Jul 15, 2020
Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 15, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 297acf7 into pingcap:master Jul 15, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 15, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #18581

winoros added a commit that referenced this pull request Jul 15, 2020
…r do desensitization when log query (#18578) (#18581)

Co-authored-by: crazycs <[email protected]>
Co-authored-by: Yiding Cui <[email protected]>
Co-authored-by: bb7133 <[email protected]>
@lysu
Copy link
Contributor

lysu commented Jul 30, 2020

closes #18034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support general log desensitization
8 participants