*: pass sql, plan digest down to KV request#24854
*: pass sql, plan digest down to KV request#24854ti-chi-bot merged 22 commits intopingcap:masterfrom
Conversation
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
Signed-off-by: crazycs <crazycs520@gmail.com>
MyonKeminta
left a comment
There was a problem hiding this comment.
I think it doesn't look so good that the pessimistic lock requests use a different way to set the resource group tag. I think there should be a better way, but it's ok for now since we don't have too much time.
Signed-off-by: crazycs <crazycs520@gmail.com>
| memMax := sessVars.StmtCtx.MemTracker.MaxConsumed() | ||
| diskMax := sessVars.StmtCtx.DiskTracker.MaxConsumed() | ||
| _, planDigest := getPlanDigest(a.Ctx, a.Plan) | ||
| planDigest := getPlanDigest(a.Ctx, a.Plan) |
There was a problem hiding this comment.
Duplicated with line 336?
There was a problem hiding this comment.
+1 maybe make getPlanDigest be memoized, just calculate plan once in 336 and directly reuse result in here
There was a problem hiding this comment.
Line 336 uses to initialize the plan digest, and it is already cache in StatementContext
| memMax := sessVars.StmtCtx.MemTracker.MaxConsumed() | ||
| diskMax := sessVars.StmtCtx.DiskTracker.MaxConsumed() | ||
| _, planDigest := getPlanDigest(a.Ctx, a.Plan) | ||
| planDigest := getPlanDigest(a.Ctx, a.Plan) |
There was a problem hiding this comment.
+1 maybe make getPlanDigest be memoized, just calculate plan once in 336 and directly reuse result in here
|
tidb/store/driver/txn/txn_driver.go Line 96 in 3f0c2a3 will be used in insert/replace code path ( |
Signed-off-by: crazycs <crazycs520@gmail.com>
@lysu , Already call |
|
/lgtm |
|
/LGTM |
Signed-off-by: crazycs <crazycs520@gmail.com>
|
/run-all-tests |
Signed-off-by: crazycs <crazycs520@gmail.com>
|
/run-all-tests |
|
/run-all-tests |
|
/run-e2e-test |
…o resource-tag
|
/run-all-tests |
|
/run-unit-test |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 0b35aba |
|
@crazycs520: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
/run-sqllogic-test-1 |
| normalized, sqlDigest := sc.SQLDigest() | ||
| if len(normalized) == 0 { | ||
| return nil | ||
| } | ||
| tag = resourcegrouptag.EncodeResourceGroupTag(sqlDigest, sc.planDigest) | ||
| sc.resourceGroupTag.Store(tag) |
There was a problem hiding this comment.
What about concurrently calling this function?
There was a problem hiding this comment.
Concurrently calling doesn't affect correctness.
| waitChain = append(waitChain, WaitChainItem{ | ||
| TryLockTxn: rawItem.Txn, | ||
| SQLDigest: sqlDigest, | ||
| SQLDigest: hex.EncodeToString(sqlDigest), |
There was a problem hiding this comment.
Is it better to be NewDigest(sqlDigest).String()?
There was a problem hiding this comment.
Yes, use NewDigest(sqlDigest).String() is better.
Track issue: #24875
Related PR: #24380
What problem does this PR solve?
This PR use to implement the part of TopSQL feature.
For TiKV to collection resource by SQL statements, TiDB need pass the
sql digestandplan digestdown to TiKV.What is changed and how it works?
sql digestandplan digestto[]byteand the set onkv.Context.ResourceGroupTag.Related PR
Check List
Tests
Side effects
Release note