-
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
*: Provide staleReadProcessor to process stale read #32699
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 |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/c350f1eee8aee91a0c86c1e549f574e96073138d |
/run-mysql-test |
/run-mysql-test |
/run-unit-test |
/run-unit-test |
@@ -184,6 +188,8 @@ type preprocessor struct { | |||
tableAliasInJoin []map[string]interface{} | |||
withName map[string]interface{} | |||
|
|||
staleReadProcessor staleread.Processor |
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.
Though I'm OK to make this change, does this mean that we may have more and more xxxProcessor
fields in the future? Do we have any idea on how to simplify this part?
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.
Having a staleReadProcessor
here is to decouple the stale read code from preprocessor and expect to reuse it. It is only a choice for stale read and I think for other scenes the design will not be limited to 'xxxProcessor'.
For stale read, in the future, there is still only one processor to process stale read. However, we can have multiple subclasses inherits staleread.Processor
and we can use one of them according to the exact scenario
/run-unit-test |
/run-unit-test |
/run-unit-test |
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 overall
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.
rest lgtm
// OnSelectTable will be called when process table in select statement | ||
func (p *staleReadProcessor) OnSelectTable(tn *ast.TableName) error { |
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.
Why the comment for explaining the code logic removed?
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'll complete it later
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.
done
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 371a42b
|
/run-mysql-test |
/run-mysql-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: c350f1e
|
What problem does this PR solve?
Issue Number: close #32697
What is changed and how it works?
This is one of the PRs to refactor stale read. The full draft is here: #32325
This modifications of the PR includes:
staleread
to provide stale read related functions.staleread.Processor
to provide methods processing and fetching stale read context.staleread.staleReadProcessor
which implementsstaleread.Processor
to simplifyPreprocessor
.For the PRs in the future, we'll do more things refactoring stale read, including:
StaleReadTxnContextProvider
and set it toTxnManager
in processorCheck List
Tests
Side effects
Documentation
Release note