Bug #115253 Consisty question in NDB cluster
Submitted: 7 Jun 15:45 Modified: 7 Jun 20:57
Reporter: CunDi Fang Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:8.0.35-cluster MySQL Cluster Community S OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[7 Jun 15:45] CunDi Fang
Description:
The detail is as follow.

OS version and name:
Ubuntu 22.04.3 LTS (Jammy Jellyfish)
Linux eb1f47b08982 6.5.11-8-pve #1 SMP PREEMPT_DYNAMIC PMX 6.5.11-8 (2024-01-30T12:27Z) x86_64 x86_64 x86_64 GNU/Linux

After executing some sql statements on multiple nodes, I found that executing the same SQL statement for querying metadata on a different node, which should give the same results, yielded very different results:

Poc:
```
SHOW TABLE STATUS in mytest100;
```

The results on node 1 are as follows:
```
mysql> SHOW TABLE STATUS in mytest100;
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| Name  | Engine     | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time | Check_time | Collation          | Checksum | Create_options | Comment |
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| test0 | ndbcluster |      10 | Dynamic    |   20 |             52 |      262144 |               0 |            0 |         0 |            995 | 2024-06-07 15:15:21 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test1 | ndbcluster |      10 | Dynamic    |   20 |             44 |      262144 |               0 |            0 |         0 |            968 | 2024-06-07 15:15:25 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test2 | ndbcluster |      10 | Dynamic    |   14 |             44 |      262144 |               0 |            0 |         0 |            995 | 2024-06-07 15:16:30 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test3 | ndbcluster |      10 | Dynamic    |   19 |             68 |      262144 |               0 |            0 |         0 |            992 | 2024-06-07 15:22:08 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test4 | ndbcluster |      10 | Dynamic    |   11 |             40 |      262144 |               0 |            0 |         0 |            802 | 2024-06-07 15:20:33 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test5 | ndbcluster |      10 | Dynamic    |   12 |             64 |      262144 |               0 |            0 |         0 |            995 | 2024-06-07 15:15:41 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test6 | ndbcluster |      10 | Dynamic    |    8 |             40 |      262144 |               0 |            0 |         0 |            995 | 2024-06-07 15:15:44 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test7 | ndbcluster |      10 | Dynamic    |   19 |             72 |      262144 |               0 |            0 |         0 |            882 | 2024-06-07 15:19:13 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test8 | ndbcluster |      10 | Dynamic    |   20 |             44 |      262144 |               0 |            0 |         0 |            996 | 2024-06-07 15:20:36 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test9 | ndbcluster |      10 | Dynamic    |   17 |             72 |      131072 |               0 |            0 |         0 |            948 | 2024-06-07 15:15:52 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
```
The results on node 2 are as follows:
```
mysql> SHOW TABLE STATUS in mytest100;
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| Name  | Engine     | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time | Check_time | Collation          | Checksum | Create_options | Comment |
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| test0 | ndbcluster |      10 | Dynamic    |   20 |             64 |      262144 |               0 |            0 |         0 |            977 | 2024-06-07 15:15:21 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test1 | ndbcluster |      10 | Dynamic    |   19 |             56 |      262144 |               0 |            0 |         0 |            977 | 2024-06-07 15:15:25 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test2 | ndbcluster |      10 | Dynamic    |   19 |             72 |      262144 |               0 |            0 |         0 |            996 | 2024-06-07 15:16:30 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test3 | ndbcluster |      10 | Dynamic    |   20 |             56 |      131072 |               0 |            0 |         0 |            903 | 2024-06-07 15:22:08 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test4 | ndbcluster |      10 | Dynamic    |   15 |             52 |      262144 |               0 |            0 |         0 |            977 | 2024-06-07 15:20:33 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test5 | ndbcluster |      10 | Dynamic    |   11 |             44 |      262144 |               0 |            0 |         0 |            903 | 2024-06-07 15:15:41 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test6 | ndbcluster |      10 | Dynamic    |   20 |             48 |      131072 |               0 |            0 |         0 |            992 | 2024-06-07 15:15:44 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test7 | ndbcluster |      10 | Dynamic    |   12 |             40 |      262144 |               0 |            0 |         0 |            977 | 2024-06-07 15:19:13 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test8 | ndbcluster |      10 | Dynamic    |   19 |             48 |      262144 |               0 |            0 |         0 |            972 | 2024-06-07 15:20:36 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
| test9 | ndbcluster |      10 | Dynamic    |   14 |             48 |      131072 |               0 |            0 |         0 |            897 | 2024-06-07 15:15:52 | NULL        | NULL       | utf8mb4_0900_ai_ci |     NULL |                |         |
+-------+------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
```

I don't understand why there are different query results for metadata that should logically be perfectly consistent across nodes.

How to repeat:
Architecture Information:
'''
[NDBD DEFAULT]
NoOfReplicas =2
DataMemory = 512M
IndexMemory = 64M

[NDB_MGMD]
NodeId=1
hostname =192.172.10.8
datadir =/var/lib/mysql-cluster

[NDBD]
NodeId =2
hostname =192.172.10.9
datadir =/usr/local/mysql-cluster/data
NodeGroup=0
[NDBD]
NodeId =3
hostname =192.172.10.10
datadir =/usr/local/mysql-cluster/data
NodeGroup=1
[NDBD]
NodeId =4
hostname =192.172.10.11
datadir =/usr/local/mysql-cluster/data
NodeGroup=0
[NDBD]
NodeId =5
hostname =192.172.10.12
datadir =/usr/local/mysql-cluster/data
NodeGroup=1

[mysqld]
NodeId =6
hostname =192.172.10.9
[mysqld]
NodeId =7
hostname =192.172.10.10
[mysqld]
NodeId =8
hostname =192.172.10.11
[mysqld]
NodeId =9
hostname =192.172.10.12
'''

Suggested fix:
Not sure if it's a bug, I have a feeling it might be a flawed feature? It doesn't seem to affect the functionality so far.
[7 Jun 20:57] MySQL Verification Team
Hi,

Duplicate of Bug #115254 

Like I explained in Bug #115254 - this is statistics data, it is expected to have different statistics on different SQL nodes.