pingcap / tiproxy

Apache License 2.0
56 stars 27 forks source link

Inconsistent version when using TiProxy with TiDB v7.5.0 or newer #438

Closed dveeden closed 10 months ago

dveeden commented 10 months ago

Bug Report

Use TiProxy with TiDB v7.5.0 or newer

1. Minimal reproduce step (Required)

image

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

Both status and SELECT VERSION() to report the same version.

3. What did you see instead (Required)

See screenshot

4. What is your TiDB version? (Required)

v7.5.0

Some ways to fix this:

djshow832 commented 10 months ago

We are currently using the version of a random server, refer to #281. Maybe it doesn't work well? I'll look into it.

djshow832 commented 10 months ago

I can't reproduce it with tiup playground v7.5.0 --tiproxy 1 --tiproxy.version nightly --tiflash 0.

$ mysql -h127.1 -uroot -P6000 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.11-TiDB-v7.5.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> status
--------------
mysql  Ver 8.1.0 for macos12.6 on x86_64 (Homebrew)

Connection id:          1
Current database:       test
Current user:           root@127.0.0.1
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.0.11-TiDB-v7.5.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible
Protocol version:       10
Connection:             127.1 via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
TCP port:               6000
Binary data as:         Hexadecimal
Uptime:                 21 sec

Threads: 0  Questions: 0  Slow queries: 0  Opens: 0  Flush tables: 0  Open tables: 0  Queries per second avg: 0.000
--------------

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 8.0.11-TiDB-v7.5.0 |
+--------------------+
1 row in set (0.00 sec)

My MySQL Client version (v8.1.0) is lower than yours (v8.2.0), but I don't think it matters.

I saw that the shown connection ID is 100, so TiProxy should be an old version. @dveeden

dveeden commented 10 months ago

Looks like this is what happened:

  1. I built tiproxy with make build
  2. I then used --tiproxy.binpath to specify the TiProxy binary.

The problem with this is that make build doesn't build bin/tiproxy, so I used an old version. Running make without options or like make cmd would have build the binary.

So this indeed works with the current version of TiProxy.