pingcap / pingcap/tidb

Server can report standby activation before MySQL listener is ready

Open
#68,353 1 comment 0 reactions 0 assignees View on GitHub
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!

### 1. Minimal reproduce step (Required)

1. Start TiDB in standby mode, or start TiDB with forced stats initialization enabled.
2. Activate the standby TiDB instance.
3. Connect to the MySQL port immediately after the activation request returns success.

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

After the activation request returns success, the TiDB MySQL listener should already be bound and ready to accept TCP connections.

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

The activation request can return before the MySQL listener is initialized. During that window, clients can receive `connection refused` when connecting to the TiDB MySQL port.

In the current code, `Server.Run` waits for forced stats initialization before calling `initTiDBListener`. In standby startup, `EndStandby(nil)` can notify activation completion before the standby controller is attached to the created server.

Suggested labels: type/bug, component/server, component/mysql-protocol, severity/minor

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

Current master branch.

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.