Skip to content

Commit a65619a

Browse files
committed
Fix port calculation for TiDB versions to avoid invalid ports
The old calculation '34$(tr -d .)' produced 346512 for version 6.5.12, which exceeds the maximum port number (65535). New calculation: 34000 + (minor * 100) + patch - 6.1.7 -> 34107 - 6.5.12 -> 34512 - 7.1.6 -> 34106 - 7.5.7 -> 34507 - 8.1.2 -> 34102 - 8.5.3 -> 34503 All ports are now valid (< 65535) and unique per version.
1 parent 095c87e commit a65619a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ testrdsdb:
8484
$(MAKE) testacc
8585

8686
testtidb%:
87-
$(MAKE) MYSQL_VERSION=$* MYSQL_PORT=34$(shell echo "$*" | tr -d '.') testtidb
87+
$(MAKE) MYSQL_VERSION=$* MYSQL_PORT=$(shell echo "$*" | awk -F. '{port=34000+($$2*100)+$$3; if(port>65535) port=34000+($$2*10)+$$3; printf "%d", port}') testtidb
8888

8989
# WARNING: this does not work as a bare task run, it only instantiates correctly inside the versioned TiDB task run
9090
# otherwise MYSQL_PORT and version are unset.

0 commit comments

Comments
 (0)