kv: unify the BeginWith... function into one#23130
kv: unify the BeginWith... function into one#23130ti-chi-bot merged 6 commits intopingcap:masterfrom
Conversation
Signed-off-by: Song Gao <disxiaofei@163.com>
|
/sig sql-infra |
|
/cc @xhebox |
Signed-off-by: Song Gao <disxiaofei@163.com>
This comment has been minimized.
This comment has been minimized.
|
/sig transaction |
|
/cc @longfangsong |
|
@Yisaer: GitHub didn't allow me to request PR reviews from the following users: longfangsong. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions 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 kubernetes/test-infra repository. |
|
IMO Scope should be part of the type TransactionOption struct {
StartTS *uint64
PrevSec *uint64
Scope *string
}Then we could do something like (is it possible to have all these options set in the future?) BeginWithOption(TransactionOption{}.SetStartTs(xxx).SetScope(yyy).SetPrevSec(zzz))and implement |
For now, it is exclusive. That is why there is an But I agree that only left one |
xhebox
left a comment
There was a problem hiding this comment.
LGTM. If you don't want to address the comment of @longfangsong , i.e. unify the api more aggressively. or want to address it in the next PR, I will give a lgtm.
|
@xhebox: Please use If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1. 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. |
longfangsong
left a comment
There was a problem hiding this comment.
/lgtm
We may discuss about more agressive refactoring later.
Signed-off-by: Song Gao <disxiaofei@163.com>
This advice LGTM. updated. |
Signed-off-by: Song Gao <disxiaofei@163.com>
| TxnScope string | ||
| StartTS *uint64 | ||
| PrevSec *uint64 |
There was a problem hiding this comment.
I don't think it is a good idea to use pointers for integers in go. It may bring another two escaped memory. Copying a slice of string or integers is free.
|
|
||
| // no need to get txn from txnFutureCh since txn should init with startTs | ||
| txn, err := s.store.BeginWithOption(s.GetSessionVars().CheckAndGetTxnScope(), kv.WithStartTSOption(startTS)) | ||
| txn, err := s.store.BeginWithOption(kv.TransactionOption{}.SetTxnScope(s.GetSessionVars().CheckAndGetTxnScope()).SetStartTs(startTS)) |
There was a problem hiding this comment.
Maybe give a NewTransactionOptionBuilder or just NewTransactionOption instead of constructing a struct by hand.
|
/run-all-tests |
|
/lgtm |
|
[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 writing |
|
/merge |
|
@Yisaer: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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. |
|
@Yisaer: DetailsIn response to this:
Instructions 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. |
This comment has been minimized.
This comment has been minimized.
|
/merge |
|
@xhebox: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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. |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: e81b357 |
|
@Yisaer: 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 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-unit-test |
Signed-off-by: Song Gao disxiaofei@163.com
What problem does this PR solve?
Currently, we have serval
BeginWithXXXfunctions inkv.Storage. In future, we are going to support time-bounded staleness transaction which may continue to add moreBeginWithXXXfunctions.What is changed and how it works?
This request unify all the
BeginWithXXXfunctions into one and only leave 2 function like following:Release note