Skip to content

log: add tidb_log_desensitization global variable to control whether do desensitization when log query (#18578) - #18581

Merged
winoros merged 7 commits into
pingcap:release-4.0from
ti-srebot:release-4.0-297acf7e824d
Jul 15, 2020
Merged

winoros merged 7 commits into
pingcap:release-4.0from
ti-srebot:release-4.0-297acf7e824d

Conversation

@ti-srebot

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added sig/execution SIG execution priority/release-blocker This issue blocks a release. Please solve it ASAP. type/4.0-cherry-pick type/enhancement The issue or PR belongs to an enhancement. labels Jul 15, 2020
@ti-srebot
ti-srebot requested review from bb7133, winoros and wshwsh12 July 15, 2020 07:46
@ti-srebot ti-srebot added this to the v4.0.3 milestone Jul 15, 2020
@crazycs520

Copy link
Copy Markdown
Contributor

/run-all-tests

@winoros winoros left a comment

Copy link
Copy Markdown
Member

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

@bb7133 bb7133 left a comment

Copy link
Copy Markdown
Member

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

bb7133 commented Jul 15, 2020

Copy link
Copy Markdown
Member

/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
Copy Markdown
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 18545

@winoros

winoros commented Jul 15, 2020

Copy link
Copy Markdown
Member

/run-integration-copr-test

@ti-srebot

Copy link
Copy Markdown
Contributor Author

/run-all-tests

@ti-srebot

Copy link
Copy Markdown
Contributor Author

@ti-srebot merge failed.

@crazycs520

Copy link
Copy Markdown
Contributor

/run-unit-test

@winoros

winoros commented Jul 15, 2020

Copy link
Copy Markdown
Member

/run-all-tests

@winoros

winoros commented Jul 15, 2020

Copy link
Copy Markdown
Member

/run-integration-copr-test

@winoros

winoros commented Jul 15, 2020

Copy link
Copy Markdown
Member

/run-unit-test

@crazycs520

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