pingcap / pingcap/tidb

subqueries produce different result between different deploy topology (1)

Open
#52,776 4 comments 0 reactions 0 assignees View on GitHub
sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

### 1. Minimal reproduce step (Required)
First execute `init.sql` to create the table. Then executing `error.sql` yields unexpected results. Note that reproducing these results might not be entirely stable. Typically, it can be completed within three attempts. You can try executing multiple times or execute it again after rebuilding the table.
[init.sql.txt](https://github.com/pingcap/tidb/files/15046725/init.sql.txt)
[error.sql.txt](https://github.com/pingcap/tidb/files/15046724/error.sql.txt)

### 2. What did you expect to see? (Required)
The first column is a column c_este10ce0x in the table.
The second column is a subquery that compares all values of the same column in the same table to see if they match the values in the first column. Since there are NULL values in this column, after sorting the comparison results in ascending order, the first row should be NULL.

### 3. What did you see instead (Required)
In TiDB multi-node version, the results are normal.
In TiDB single-node version, there are incorrect '0's in the second column.
[output_re_main.log](https://github.com/pingcap/tidb/files/15046726/output_re_main.log)
[output_re_single.log](https://github.com/pingcap/tidb/files/15046727/output_re_single.log)

### 4. What is your TiDB version? (Required)
```
Release Version: v7.5.1
Edition: Community
Git Commit Hash: 7d16cc79e81bbf573124df3fd9351c26963f3e70
Git Branch: heads/refs/tags/v7.5.1
UTC Build Time: 2024-02-27 14:28:32
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```
topology:

distributed.yaml:
```
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/tidb-deploy"
data_dir: "/tidb-data"

pd_servers:
- host: 10.0.2.31

tidb_servers:
- host: 10.0.2.21
- host: 10.0.2.22

tikv_servers:
- host: 10.0.2.11
- host: 10.0.2.12
- host: 10.0.2.13

monitoring_servers:
- host: 10.0.2.8

grafana_servers:
- host: 10.0.2.8

alertmanager_servers:
- host: 10.0.2.8
```

single.yaml
```
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/tidb-deploy"
data_dir: "/tidb-data"

pd_servers:
- host: 10.0.2.73

tidb_servers:
- host: 10.0.2.72

tikv_servers:
- host: 10.0.2.71

```

### about us
We are the BASS team from the School of Cyber Science and Technology at Beihang University. Our main focus is on system software security, operating systems, and program analysis research, as well as the development of automated program testing frameworks for detecting software defects. Using our self-developed database vulnerability testing tool, we have identified the above-mentioned vulnerabilities in TiDB that may lead to database logic error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.