Can PD followers provide metadata, such as the location information of region leaders?

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: pd follower 可以提供数据的元信息嘛,比如region leader的位置信息等

| username: TiDBer_2i1SqvUB

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5.5
[Encountered Problem: Problem Phenomenon and Impact]
The capabilities of the PD follower node have always been unclear. I am not sure if it can provide metadata or if there is relevant documentation available for learning.

| username: 小龙虾爱大龙虾 | Original post link

No, you can’t.

| username: 小毛毛虫 | Original post link

The main service provider is the PD leader.

| username: TiDBer_2i1SqvUB | Original post link

Oh, okay, so the role of the PD follower is to serve as a backup, right? It should also have metadata, which is stored in etcd. Therefore, the PD follower might have some data lag compared to the PD leader.

| username: TiDBer_2i1SqvUB | Original post link

Do you have any official documentation? I want to study it a bit. :joy:

| username: Jellybean | Original post link

The main function of the PD leader is to provide global TSO and region metadata externally, while the followers serve as high-availability backup nodes.

In later versions, to alleviate the pressure on the PD leader in extreme high-concurrency scenarios, the PD follower read feature is also supported.

| username: 小毛毛虫 | Original post link

Yes, there may be some lag.

| username: 我是人间不清醒 | Original post link

– Enable Follower Read
select @@tidb_replica_read

– Default
SET GLOBAL tidb_replica_read = ‘leader’;
SET GLOBAL tidb_replica_read = ‘follower’;

| username: 江湖故人 | Original post link

Follower Read is for TiKV, not PD.

| username: 江湖故人 | Original post link

The metadata reading by PD follower should be achievable. The allocation of TSO should be a challenge. How can we ensure the global uniqueness and temporal order of the allocated TSO across multiple nodes? :thinking:

| username: 有猫万事足 | Original post link

You can take a look at this. This introduction is relatively clear. The metadata of the region is stored in a btree cache of the PD leader.

In addition, in order to speed up the processing of the heartbeat, the corresponding Region information reported by the heartbeat will be updated to KV only when the epoch changes or a new Region is inserted. Otherwise, only the cache is updated.

The KV mentioned here appears in the “Using etcd to store metadata” section, so it should refer to etcd.

So the answer is no.

| username: TIDB-Learner | Original post link

The screenshot mentioned by the original poster about PD is actually referring to TiKV. You can learn more about etcd.

| username: dba远航 | Original post link

It has metadata, but it cannot be provided, only the LEADER can.