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

executor, server: reduce connect/disconnect log spam (#19308) #20321

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #19308 to release-4.0


What problem does this PR solve?

Issue Number: Part of #19053 (does not close issue)

Problem Summary:

Currently there is a lot of spam in the server error log related to client activity. This makes it hard to debug issues.

What is changed and how it works?

What's Changed:

This moves three Info log messages to be Debug messages instead:

  • New sessions connecting to the server
  • Sessions disconnecting from the server
  • Setting session variables (global remains unchanged as Info)

This reduces the log spam in an oltp scenario (without a connection pool) quite considerably.

Related changes

  • None

Check List

Tests

  • Manual test (add detailed scripts or steps below)

I compiled the binary and ran while true; do mysql -e 'select 1'; sleep 1; done; in a loop. It looks much better.

Side effects

  • Someone somewhere may rely on these log messages, and need to change their log file to debug. I think this is unlikely though.

Release note

  • The TiDB error log now reports client connect/disconnect activity only under debug level verbosity.

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

/run-all-tests

@ghost
Copy link

ghost commented Sep 30, 2020

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 30, 2020
@gregwebs
Copy link
Contributor

From a security standpoint the information that there is a new connection could be very valuable and this might not be a minor change.

In a normal thread pool based usage it also wouldn't be that spammy.

@ghost
Copy link

ghost commented Sep 30, 2020

In a normal thread pool based usage it also wouldn't be that spammy.

There are a lot of MySQL connectors that don't commonly use thread pools (PHP, perl, etc.) The information is still available under debug level.

@gregwebs
Copy link
Contributor

The information is still available under debug level.

Yes, but imagine someone tries to audit a security problem based on their info logs after doing a minor version upgrade and discovers this information is no longer in the logs.

I 100% agree that the disconnect messages should be debug only. They would only be useful in an audit scenario if they showed something about the client identity as well.

@ti-srebot
Copy link
Contributor Author

@ngaut, Thanks for your review, however we are sorry that your vote won't be count.

@winkyao
Copy link
Contributor

winkyao commented Oct 1, 2020

/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 Oct 1, 2020
@winkyao
Copy link
Contributor

winkyao commented Oct 1, 2020

/merge

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

/run-all-tests

@ti-srebot ti-srebot merged commit c6d337e into pingcap:release-4.0 Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants