Why are there client-initiated SQL queries from PD?

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

Original topic: 为啥有客户端是由PD发起的查询sql

| username: TiDBer_Y2d2kiJh

【TiDB Usage Environment】Production Environment
【TiDB Version】V5.4.0 2tidb 3pd 2tikv
【Reproduction Path】It was found that some query statements were initiated by PD. What is the situation here, as shown in the figure.
【Encountered Problem: Problem Phenomenon and Impact】The first picture is the SQL query statement, and the second picture is the relevant information of the SQL execution.
【Resource Configuration】Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots/Logs/Monitoring】


| username: h5n1 | Original post link

Are you sure there’s only PD on this IP?

| username: TiDBer_Y2d2kiJh | Original post link

Absolutely sure. We generally don’t use the _tidb_rowid field when querying.

| username: caiyfc | Original post link

Is it possible that the SQL was initiated by the dashboard? You can try using the dashboard’s features to see if any SQL appears.

| username: Kongdom | Original post link

tiup cluster display to check the cluster

| username: TiDBer_Y2d2kiJh | Original post link

In the tiup cluster display + cluster, this IP corresponds to only one PD.

| username: h5n1 | Original post link

Is there any useful load balancing software?

| username: zhanggame1 | Original post link

PD should also have access to TiDB to check SQL situations, right?

| username: TiDBer_Y2d2kiJh | Original post link

Used haproxy+keepalived

| username: h5n1 | Original post link

Is it deployed on the same host as PD?

| username: TiDBer_Y2d2kiJh | Original post link

No, I used two other servers.

| username: TiDB_C罗 | Original post link

Check if there is haproxy on this pd.

| username: TiDBer_Y2d2kiJh | Original post link

I’m sure there isn’t. I deployed this environment.

| username: caiyfc | Original post link

Check if the PD in the screenshot is the leader.

| username: TiDB_C罗 | Original post link

That’s impossible, it was queried by the root user.

| username: TiDBer_Y2d2kiJh | Original post link

No, just one up.

| username: caiyfc | Original post link

Did you use dumpling to export when taking the screenshot?

| username: h5n1 | Original post link

If there is no TiDB/HAProxy on this machine, think about whether you have performed any operations on this machine to connect to the database. Check the history to see if there are any records.

| username: TiDBer_Y2d2kiJh | Original post link

Used the dumpling tool.

| username: caiyfc | Original post link

Was the dumpling tool executed on this PD IP? From the SQL, it looks very much like the query statement when dumpling exports data.