-
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
client: KV requests with source label #34833
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-unit-test |
1 similar comment
/run-unit-test |
/run-all-tests |
1 similar comment
/run-all-tests |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/706ec0e80b30957e21ce5bc2f8c56931377a689b |
@you06 |
executor/grant.go
Outdated
@@ -132,15 +134,15 @@ func (e *GrantExec) Next(ctx context.Context, req *chunk.Chunk) error { | |||
} | |||
defer func() { | |||
if !isCommit { | |||
_, err := internalSession.(sqlexec.SQLExecutor).ExecuteInternal(context.Background(), "rollback") | |||
_, err := internalSession.(sqlexec.SQLExecutor).ExecuteInternal(ctx, "rollback") |
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.
I'm not sure if it's ok to change these background ctx to the parent ctx... Could the original intention be just allowing it even if the parent ctx is done?
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.
Emmm, it seems many RunInNewTxn
and ExecuteInternal
use context in a messy way(if there is no context in the parameters, create a new one), creating a new context in many places is redundant. Anyway, all the modifies have been checked for compatibility.
@@ -117,6 +118,7 @@ func (e *inspectionResultRetriever) retrieve(ctx context.Context, sctx sessionct | |||
} | |||
e.retrieved = true | |||
|
|||
ctx = kv.WithInternalSourceType(ctx, kv.InternalTxnMeta) |
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.
I'm not sure whether memtable related things are always internal... If a user reads memory tables, will it come here?
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.
But they call ExecRestrictedSQL
which indicates internal usages... If they don't send requests the request source of it won't be used.
@@ -204,6 +205,7 @@ func (e *MetricsSummaryRetriever) retrieve(ctx context.Context, sctx sessionctx. | |||
} | |||
sort.Strings(tables) | |||
|
|||
ctx = kv.WithInternalSourceType(ctx, kv.InternalTxnOthers) |
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.
I have questions here similar to retrieving memory table...
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
Need to update the panel ids after #34845 got merged. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4eaae7a40226ce720ef93f633fece4905c8deac5
|
Signed-off-by: you06 <[email protected]> fix tests Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> update Signed-off-by: you06 <[email protected]> update bazel Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> update Signed-off-by: you06 <[email protected]> update client-go Signed-off-by: you06 <[email protected]> update client-go Signed-off-by: you06 <[email protected]> update grafana Signed-off-by: you06 <[email protected]> update bazel Signed-off-by: you06 <[email protected]> display by stack Signed-off-by: you06 <[email protected]> set request source for ctx of Signed-off-by: you06 <[email protected]> address comment Signed-off-by: you06 <[email protected]> address comment Signed-off-by: you06 <[email protected]> parser, ddl: support decoding binary literal in set/enum (pingcap#35822) close pingcap#31338 executor: fix a nil point when @@tidb_enable_collect_execution_info is off and cop cache is on (pingcap#35839) close pingcap#35829 ddl: support drop columns for multi-schema change (pingcap#35737) ref pingcap#14766 planner: don't push down predicates over table dual (pingcap#35669) close pingcap#35527 *: Remove some useless staleness code (pingcap#35849) close pingcap#35848 ddl: fix potential wrong column definition when setting default value (pingcap#35845) close pingcap#35846 *: add timeout for test cases (pingcap#35844) ddl: remove `onDropColumns` and `onAddColumns` (pingcap#35862) ref pingcap#14766 *: Fix Dockerfile (pingcap#35835) close pingcap#35828 server: refactor TestConnExecutionTimeout (pingcap#35865) close pingcap#35868 fix test Signed-off-by: you06 <[email protected]> fix lint Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 706ec0e
|
TiDB MergeCI notify✅ Well Done! New fixed [2] after this pr merged.
|
Signed-off-by: you06 [email protected]
What problem does this PR solve?
Issue Number: close #33963
Problem Summary:
What is changed and how it works?
Add request source when sending KV request, the source tag includes the scope and type of the statement.
Record metrics by request type and source.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.