pingcap / pingcap/tidb

TiDB reported different sequences on large compression file

Open
#49,706 4 comments 0 reactions 1 assignee Claimed by @dveeden View on GitHub
severity/moderate sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

Check https://github.com/PingCAP-QE/tidb-test/pull/2237, and https://github.com/pingcap/tiproxy/issues/409

Running latest tidb with jdbc_test8, the test `ConnectionRegressionTest#testBug11237` will pass. With TiProxy, it will fail.

The root cause is that TiDB actually reported a different sequence in some packets: mysql reported `61 0 0 (4)` and tidb reported `61 0 0 (34)`. `4 != 34`, and tiproxy checks for the mysql behavior, i.e. `4`.

This is because that mysql will reset normal sequence to compress sequence when switching read/write, to pass their internal sequence checks.

```
mysql
crw read2 65 4 0 [61 0 0 4 0 252 0 60 0 2 0 0 0 51 82 101 99 111 114 100 115 58 32 49 53 51 54 48 32 32 68 101 108 101 116 101 100 58 32 48 32 32 83 107 105 112 112 101 100 58 32 48 32 32 87 97 114 110 105 110 103 115 58 32 48]

tidb
crw read2 72 4 65 [61 0 0 34 0 252 0 60 0 2 0 0 0 51 82 101 99 111 114 100 115 58 32 49 53 51 54 48 32 32 68 101 108 101 116 101 100 58 32 48 32 32 83 107 105 112 112 101 100 58 32 48 32 32 87 97 114 110 105 110 103 115 58 32 48]
```

In the above case, compress sequence is 4, since data are trasfered by one single compress packet. And normal sequence increased to 34, because there are lots of packets. However, mysql resets `34` to `4`.

### 1. Minimal reproduce step (Required)

mvn '-Dtest=ConnectionRegressionTest#testBug11237' test

### 2. What did you expect to see? (Required)

They reported same sequences.

### 3. What did you see instead (Required)

They reported different sequences.

### 4. What is your TiDB version? (Required)

[(https://github.com/pingcap/tidb/pull/47495)](https://github.com/pingcap/tidb/pull/47495)

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.