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) #18581

Merged
merged 7 commits into from
Jul 15, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #18578 to release-4.0


What problem does this PR solve?

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.

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor

/run-all-tests

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

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

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 15, 2020
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 Author

@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).

@bb7133
Copy link
Member

bb7133 commented Jul 15, 2020

/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 Author

Your auto merge job has been accepted, waiting for:

  • 18545

@winoros
Copy link
Member

winoros commented Jul 15, 2020

/run-integration-copr-test

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@crazycs520
Copy link
Contributor

/run-unit-test

@winoros
Copy link
Member

winoros commented Jul 15, 2020

/run-all-tests

@winoros
Copy link
Member

winoros commented Jul 15, 2020

/run-integration-copr-test

@winoros
Copy link
Member

winoros commented Jul 15, 2020

/run-unit-test

@crazycs520
Copy link
Contributor

/run-integration-copr-test

@winoros winoros merged commit e2c95ee into pingcap:release-4.0 Jul 15, 2020
@winoros winoros deleted the release-4.0-297acf7e824d branch July 15, 2020 09:14
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. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants