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

server: Improve connection info #43721

Merged
merged 5 commits into from
May 12, 2023
Merged

server: Improve connection info #43721

merged 5 commits into from
May 12, 2023

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented May 11, 2023

What problem does this PR solve?

Issue Number: close #43720

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@dveeden dveeden requested a review from a team as a code owner May 11, 2023 08:26
@ti-chi-bot
Copy link

ti-chi-bot bot commented May 11, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CbcWestwolf
  • lance6716

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 11, 2023
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 11, 2023
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 11, 2023
@dveeden
Copy link
Contributor Author

dveeden commented May 11, 2023

dlv debug ./tidb-server -- -config <(echo -en "[security]\nauto-tls=true\n")
Type 'help' for list of commands.
(dlv) b tidb/server/server.go:733
Breakpoint 1 set at 0x6027797 for github.com/pingcap/tidb/server.(*clientConn).connectInfo() ./server/server.go:733
(dlv) c
...
mysql -h 127.0.0.1 -u root -P 4000 --ssl-mode=REQUIRED --tls-version=TLSv1.3
...
...
> github.com/pingcap/tidb/server.(*clientConn).connectInfo() ./server/server.go:733 (hits goroutine(2385):1 total:1) (PC: 0x6027797)
   728:			ServerVersion:     mysql.TiDBReleaseVersion,
   729:			SSLVersion:        sslVersion,
   730:			PID:               serverPID,
   731:			DB:                cc.dbname,
   732:		}
=> 733:		return connInfo
   734:	}
   735:	
   736:	func (s *Server) checkConnectionCount() error {
   737:		// When the value of Instance.MaxConnections is 0, the number of connections is unlimited.
   738:		if int(s.cfg.Instance.MaxConnections) == 0 {
(dlv) p connInfo
*github.com/pingcap/tidb/sessionctx/variable.ConnectionInfo {
	ConnectionID: 2199023255955,
	ConnectionType: "SSL/TLS",          
	Host: "127.0.0.1",
	ClientIP: "127.0.0.1",
	ClientPort: "55322",
	ServerID: 1,
	ServerIP: "127.0.0.1",
	ServerPort: 4000,
	Duration: 0,
	User: "root",
	ServerOSLoginUser: "Daniël van Eeden",
	OSVersion: "Linux 6.2.14-300.fc38.x86_64.x86_64",
	ClientVersion: "",
	ServerVersion: "None",
	SSLVersion: "TLSv1.3",              <----------
	PID: 576818,
	DB: "",}
(dlv) c
mysql -h 127.0.0.1 -u root -P 4000 --ssl-mode=DISABLED
> github.com/pingcap/tidb/server.(*clientConn).connectInfo() ./server/server.go:733 (hits goroutine(4918):1 total:2) (PC: 0x6027797)
   728:			ServerVersion:     mysql.TiDBReleaseVersion,
   729:			SSLVersion:        sslVersion,
   730:			PID:               serverPID,
   731:			DB:                cc.dbname,
   732:		}
=> 733:		return connInfo
   734:	}
   735:	
   736:	func (s *Server) checkConnectionCount() error {
   737:		// When the value of Instance.MaxConnections is 0, the number of connections is unlimited.
   738:		if int(s.cfg.Instance.MaxConnections) == 0 {
(dlv) p connInfo
*github.com/pingcap/tidb/sessionctx/variable.ConnectionInfo {
	ConnectionID: 2199023255957,
	ConnectionType: "TCP",                     <-----------------------------
	Host: "127.0.0.1",
	ClientIP: "127.0.0.1",
	ClientPort: "52552",
	ServerID: 1,
	ServerIP: "127.0.0.1",
	ServerPort: 4000,
	Duration: 0,
	User: "root",
	ServerOSLoginUser: "Daniël van Eeden",
	OSVersion: "Linux 6.2.14-300.fc38.x86_64.x86_64",
	ClientVersion: "",
	ServerVersion: "None",
	SSLVersion: "",
	PID: 576818,
	DB: "",}

@dveeden
Copy link
Contributor Author

dveeden commented May 11, 2023

/test mysql-test

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

@bb7133
Copy link
Member

bb7133 commented May 12, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented May 12, 2023

This pull request has been accepted and is ready to merge.

Commit hash: e459ae5

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 12, 2023
@dveeden
Copy link
Contributor Author

dveeden commented May 12, 2023

/test build

@hawkingrei
Copy link
Member

ERROR: /home/jenkins/agent/workspace/pingcap/tidb/ghpr_build/tidb/extension/enterprise/audit/BUILD.bazel:44:8: GoCompilePkg extension/enterprise/audit/audit_test.internal.a failed: (Exit 1): builder failed: error executing command (from target //extension/enterprise/audit:audit_test) bazel-out/k8-opt-exec-2B5CBBC6/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src extension/enterprise/audit/entry.go -src ... (remaining 101 arguments skipped)


Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging

extension/enterprise/audit/function_test.go:69:85: not enough arguments in call to tk.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/function_test.go:116:85: not enough arguments in call to tk.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/function_test.go:121:89: not enough arguments in call to tk2.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/function_test.go:152:90: not enough arguments in call to tk2.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/sysvar_test.go:105:84: not enough arguments in call to tk.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/sysvar_test.go:193:85: not enough arguments in call to tk.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

extension/enterprise/audit/sysvar_test.go:374:85: not enough arguments in call to tk.Session().Auth

	have (*"github.com/pingcap/tidb/parser/auth".UserIdentity, nil, nil)

	want (*"github.com/pingcap/tidb/parser/auth".UserIdentity, []byte, []byte, "github.com/pingcap/tidb/privilege/conn".AuthConn)

compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2

INFO: Elapsed time: 960.840s, Critical Path: 427.67s

We need to update the plugin.

@CbcWestwolf
Copy link
Member

/retest

@hawkingrei
Copy link
Member

/test all

@ti-chi-bot ti-chi-bot bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed status/can-merge Indicates a PR has been approved by a committer. labels May 12, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 12, 2023
@dveeden
Copy link
Contributor Author

dveeden commented May 12, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented May 12, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 439648f

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 12, 2023
@ti-chi-bot ti-chi-bot bot merged commit 4d011d4 into pingcap:master May 12, 2023
CbcWestwolf added a commit to CbcWestwolf/tidb that referenced this pull request May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection info is unclear
5 participants