-
Notifications
You must be signed in to change notification settings - Fork 228
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
txnkv: add callback for setting ResourceGroupTag #368
Conversation
Signed-off-by: mornyx <mornyx.z@gmail.com>
PTAL, Thanks~ Upstream PR: pingcap/tidb#29044. |
Signed-off-by: mornyx <mornyx.z@gmail.com>
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
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 something like this (feel free to discuss):
type ResourceGroupTagger interface {
tagCleanup(c *twoPhaseCommitter, bo *retry.Backoffer, batch batchMutations) []byte
tagCommit(...)
tagPrewrite(...)
tagScan(...)
tagGet(...)
....
}
or this:
type ResourceGroupTagger func(r *Request)
or even this:
type RequestPostBuildFn func(r *Request)
or:
type RequestPreSendFn func(r *Request)
@disksing What do you think?
|
Signed-off-by: mornyx <mornyx.z@gmail.com>
Generally LGTM. However I believe there should be at least some unit tests to ensure that:
|
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
Signed-off-by: mornyx <mornyx.z@gmail.com>
The problem did appear in my own integration test. Because of the incorrect use of other component, the error message did not occur in my code. Now I have fixed it (at least it works on my local machine, Github actions need to wait too long...), and next I need to find a way to fix |
I've checked with a last merged PR 8a4ce38 the compatibility test also failed and it is merged anyway. I think we can ignore it and focus on other tests. |
@disksing Please take a look~ Thanks! All tests (except for the compatibility test) are now passing. |
* Replace resourceGroupTag with resourceGroupTagFactory(firstKey) Signed-off-by: mornyx <mornyx.z@gmail.com> * Fix npe Signed-off-by: mornyx <mornyx.z@gmail.com> * Abstract ResourceGroupFactory Signed-off-by: mornyx <mornyx.z@gmail.com> * Optimized as ResourceGroupTagger Signed-off-by: mornyx <mornyx.z@gmail.com> * Add test for resource group tagger Signed-off-by: mornyx <mornyx.z@gmail.com> * Fix unexpected request failed in mock store Signed-off-by: mornyx <mornyx.z@gmail.com> * Fix integration tests Signed-off-by: mornyx <mornyx.z@gmail.com> Co-authored-by: Wenxuan <breezewish@pingcap.com> Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
What problem does this PR solve?
Use callback function to generate
ResourceGroupTag
instead of passing it directly. In this way, we can expandResourceGroupTag
more flexibly on demand in TiDB, and be transparent toclient-go
.What is changed and how it works?
ResourceGroupTagger
, which is called to generate tag whenResourceGroupTag
isnil
.