Skip to content
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

Local reads via Stale Reads do not work #4627

Open
Tema opened this issue Jul 14, 2022 · 6 comments
Open

Local reads via Stale Reads do not work #4627

Tema opened this issue Jul 14, 2022 · 6 comments

Comments

@Tema
Copy link
Contributor

Tema commented Jul 14, 2022

Bug Report

What version of TiDB Operator are you using?
v1.3.5
TidbCluster kind v6.1.0

What did you do?
I try to perform local reads using Stale Reads described in https://docs.pingcap.com/tidb/stable/three-dc-local-read#perform-local-read-using-stale-read, but TIDB sends commands to all tikv across all zones.

What did you expect to see?
Per documentation it should send requests to TiKV in the same zone

I use the following PD config:

      [replication]
        max-replicas = 3
        location-labels = ["topology.kubernetes.io/zone", "kubernetes.io/hostname"]

I also see that corresponding labels are assigned to TiKV nodes:

[2022/07/14 00:45:20.651 +00:00] [INFO] [replication_mode.rs:55] ["associated store labels"] [labels="[key: \"kubernetes.io/hostname\" value: \"gke-non-mesh-tidb-pe-basic-tikv-n2d-8-ab73507c-7tqz\", key: \"topology.kubernetes.io/zone\" value: \"us-east4-b\"]"] [store_id=1]
[2022/07/14 00:45:20.651 +00:00] [INFO] [replication_mode.rs:55] ["associated store labels"] [labels="[key: \"kubernetes.io/hostname\" value: \"gke-non-mesh-tidb-pe-basic-tikv-n2d-8-ac1d383d-09th\", key: \"topology.kubernetes.io/zone\" value: \"us-east4-c\"]"] [store_id=4]
[2022/07/14 00:45:20.651 +00:00] [INFO] [replication_mode.rs:55] ["associated store labels"] [labels="[key: \"kubernetes.io/hostname\" value: \"gke-non-mesh-tidb-pe-basic-tikv-n2d-8-753c179c-tm45\", key: \"topology.kubernetes.io/zone\" value: \"us-east4-a\"]"] [store_id=5]

However, I don't see same labels assigned to TiDB nodes, hence the feature does not work.

@Tema Tema changed the title Local reads using via Stale Reads do not work Local reads via Stale Reads do not work Jul 14, 2022
@Ishiihara
Copy link

@DanielZhangQD Can you help take a look?

@Ishiihara
Copy link

@Tema What are the labels for TiDB nodes?

@Tema
Copy link
Contributor Author

Tema commented Aug 1, 2022

@Tema What are the labels for TiDB nodes?

I don't see any. This is a problem. I expect operator to assign the same labels to TiDB as it does for TiKV nodes based on k8s "topology.kubernetes.io/zone" label (see log captured in the issue description) , so that we can leverage stale reads.

@zimulala
Copy link

zimulala commented Aug 2, 2022

@Tema What are the labels for TiDB nodes?

There is no documentation at present, please refer to the example in the test: https://github.com/pingcap/tidb/pull/19212/files#diff-373f5578b8f362a364b50b0d01919a57da64c128547ca10d49df8ae422237c82R215

In addition, how to configure the TiKV labels, refer to: https://docs.pingcap.com/tidb/stable/schedule-replicas-by-topology-labels#configure-labels-based-on-the-cluster-topology

@DanielZhangQD
Copy link
Contributor

Adding label for TiDB Pods is not supported yet.

@zhangjinpeng87
Copy link

After the following PR landed and released, this issue can be fixed.
pingcap/tidb#36845
#4663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants