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: add sql to com_exec/com_fetch dispatch error log (#12174) #12191

Merged
merged 5 commits into from Sep 17, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Sep 16, 2019

cherry-pick #12174 to release-3.0


What problem does this PR solve?

More and more user use prepare stmt, but current dispatch error log we only can see packet binary info, we don't know which sql meet error.

What is changed and how it works?

add sql to error thrown in handleStmtExec and handleStmtFetch

after this PR, we can got

[2019/09/12 15:38:43.715 +08:00] [WARN] [conn.go:669] ["command dispatched failed"] [conn=1] [connInfo="id:1, addr:127.0.0.1:43540 status:2, collation:utf8_general_ci, user:root"] [command=Fetch] [sql="\u0001\u0000\u0000\u0000\u0001\u0000\u0000\u0000"] [err="12121\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmtFetch\n\t/home/robi/code/go/src/github.com/pingcap/tidb/server/conn_stmt.go:239\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/robi/code/go/src/github.com/pingcap/tidb/server/conn.go:914\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/robi/code/go/src/github.com/pingcap/tidb/server/conn.go:653\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/robi/code/go/src/github.com/pingcap/tidb/server/server.go:438\nruntime.goexit\n\t/home/robi/runtime/go/src/runtime/asm_amd64.s:1337\nselect 1"]

("select 1" now is in last, we can modify pingcap/errors to let be in front, but we need add msg first)

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • wrap error message with sql

Side effects

  • N/A

Related changes

  • Need to cherry-pick to the release branch

Release note

  • server: add sql to com_exec/com_fetch dispatch error log

This change is Reviewable

@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 16, 2019

/run-all-tests

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 17, 2019
@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Sep 17, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 17, 2019

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 17, 2019

@sre-bot merge failed.

@zz-jason
Copy link
Member

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 17, 2019

Your auto merge job has been accepted, waiting for 12227

@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 17, 2019

/run-all-tests

@sre-bot sre-bot merged commit 45d7da0 into pingcap:release-3.0 Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants