-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Support choose the replicas by labels #21540
Comments
I suggest maintaining
|
I haven't decided yet. I think we can choose the leader directly as the fallback. |
We should consider user behavior about how to enable the
|
I tend to create a new session variable like
WDYT? @nolouch @djshow832 |
can we extend |
What about |
@Yisaer How to limit the scope on |
Another option: |
@djshow832 I think it's ok in the stale read scenario. In the other normal read scenario, I think maybe we also need to consider an option to switch to |
What are the normal read scenarios? Any examples? |
Development Task
In #21094, we are going to support the stale read for timestamp bounded read-only transactions. Thus, the tidb-server would be allowed to read data from
follower
orleanrer
peer though they may haven't the latest data If the target peer and the tidb-server located in the same dc.Here is one example:
Implementation
To achieve this target, we need to solve 2 problem:
dc
information for each region peer and tidb-server.For the first problem, we can match the value of
zone
label for the tidb-server and the target peer's located store. For example, if the tidb-server-A has the labelzone=dc-1
and store-A have the labelzone=dc-1
too, let's say they located in the same dc.For the second problem, there exist 2 ways to fetch data from kv storage, the
coprocessor
and thesnapshot
. Each of them will useRegionStore
to get the target store address by the region they wanted to read. TheRegionStore
maintain the stores of the region.In
RegionStore
,accessIndex
used to control whether send kvrequest toTiKV
orTiFlash
, similarly, we can maintain thedcIndex
to store the region's store information groups by the dc-location. And instore/tikv/RPCContext
, we will maintain the label selector for each tikvRequest.The text was updated successfully, but these errors were encountered: