*: add context for hook of getting/setting variables#38379
*: add context for hook of getting/setting variables#38379ti-chi-bot merged 1 commit intopingcap:masterfrom
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. DetailsReviewer can indicate their review by submitting an approval review. |
|
Most of this refractor is generated by Goland. Thanks Goland 😢 ❤️ |
56ddc51 to
0e52f50
Compare
|
/tests |
0e52f50 to
498c7ae
Compare
498c7ae to
30c7ff8
Compare
I don't have any better idea - - |
30c7ff8 to
7a0a8f9
Compare
|
/test |
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
7a0a8f9 to
2c432ea
Compare
|
/test |
|
/run-all-tests |
|
@lcwangchao @bb7133 Could you help me to merge this PR? It will block other PR from getting merged, (as I've modified the source code of enterprise-plugin) |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 2c432ea |
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
Signed-off-by: YangKeao yangkeao@chunibyo.icu
What problem does this PR solve?
Issue Number: close #38378
Problem Summary:
The set/get hook of variables should be able to call asynchronous functions, which should be protected by a
context.Contextto be able to kill/timeout...What is changed and how it works?
ctx context.ContextforSetGlobal/GetGlobaldefinition.SetGlobal/GetGlobal, and do this step recursively...context.Background()directly.context.TODO()in the middle way are modified to the correct context.I have considered several different approches to not bring in such a big change:
context.Background(). It will not solve any problem, but leave somecontext.Background()in some hidden paths.SetGlobalFromHookandSetGlobalFromHookWithoutContext, and implement the second withSetGlobalFromHook(context.Background(), ...). But I realized thatSetGlobalFromHookWithoutContext(has no difference withSetGlobalFromHook(context.Background(), then I prefer to use the argument directly.If you have better idea to pass in the context, without so many changes, please leave comments 😃 . Or you think it's not necessary, and use a newly created context with deadline is good enough, please also tells your opinion under this PR.