-
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
21abdcb
*: Provide staleReadProcessor to process stale read
lcwangchao 0134b55
update
lcwangchao 0c52cb1
build
lcwangchao 970b651
update
lcwangchao 76c2a42
fix
lcwangchao 4ff98bf
fix
lcwangchao c911be8
update
lcwangchao 7b52912
add tests
lcwangchao 5428abf
Merge branch 'master' into stalereadprocessor
lcwangchao 7fbd50c
update
lcwangchao 5a12637
Merge branch 'master' into stalereadprocessor
lcwangchao 7b44a26
comments
lcwangchao f9de325
Merge branch 'master' into stalereadprocessor
lcwangchao 8dbfa19
update
lcwangchao 327b1fd
Merge branch 'master' into stalereadprocessor
lcwangchao adfe268
address comments
lcwangchao 832e693
Merge branch 'master' into stalereadprocessor
lcwangchao 118b284
Merge branch 'master' into stalereadprocessor
lcwangchao 371a42b
Merge branch 'master' into stalereadprocessor
lcwangchao d6a3e03
update
lcwangchao c350f1e
update
lcwangchao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2022 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package staleread | ||
|
||
import ( | ||
mysql "github.com/pingcap/tidb/errno" | ||
"github.com/pingcap/tidb/util/dbterror" | ||
) | ||
|
||
var ( | ||
errAsOf = dbterror.ClassOptimizer.NewStd(mysql.ErrAsOf) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package staleread | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/pingcap/tidb/util/testbridge" | ||
"go.uber.org/goleak" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
opts := []goleak.Option{ | ||
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), | ||
} | ||
testbridge.SetupForCommonTest() | ||
goleak.VerifyTestMain(m, opts...) | ||
} | ||
lcwangchao marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
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