-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
plugin: setup connection info in session when audit plugin be enabled #10923
Conversation
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #10923 +/- ##
===========================================
Coverage 80.9115% 80.9115%
===========================================
Files 418 418
Lines 89384 89384
===========================================
Hits 72322 72322
Misses 11827 11827
Partials 5235 5235 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -385,6 +385,9 @@ type SessionVars struct { | |||
|
|||
// Killed is a flag to indicate that this query is killed. | |||
Killed uint32 | |||
|
|||
// ConnectionInfo indicates current connection info used by current session, only be lazy assigned by plugin. | |||
ConnectionInfo *ConnectionInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about saving it to clientConn
?
It's not used in sessionVars
anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tiancaiamao clientConn is not easy to obtain in the later process phase(e.g. write audit log after a query finished - - ), it will be used in audit plugin's OnGeneralEvent
LGTM |
What problem does this PR solve?
audit plugin need using extra connection info for every log record, connInfo is static data for every session, but tidb instance without plugin doesn't need it.
What is changed and how it works?
IsEnable
method to pluginCheck List
Tests
Code changes
Side effects
Related changes
This change is