Close connections to a TiDB that the health check has marked down, instead of waiting for TCP to time out
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- go
- 领域
- backend, networking
调研方向
Start by reading TiProxy's health-check handling and backend/client connection lifecycle, especially where a backend is marked down and where processLock governs socket handling. The issue does not name specific files or tests, so locate those entry points and existing failure tests first. Done means an opt-in behavior closes idle connections when a backend goes down and applies the requested failover-timeout behavior to in-flight connections.
由索引模型根据 Issue 内容生成。
描述
Feature Request
Describe your feature request related problem
When a TiDB instance fails without closing its sockets (node/instance failure, network partition, or a pod killed before TiDB can drain), TiProxy detects it (health check marks the backend down) but does nothing to the client connections that are already on that backend.
Measured on TiProxy v1.3.2 + TiDB v8.5.8 on Kubernetes (2 TiDB, 2 TiProxy), client with pool_pre_ping. Test: the EC2 instance hosting tidb-0 was terminated.
| Time (from failure) | Event |
|---|---|
| 0 s | Node hosting tidb-0 terminated; TiDB logs nothing further (no shutdown, no FIN to TiProxy) |
| +14 s | `update backend ... cur="down, err: connect status port failed: ... context deadline exceeded"` |
| +16.3–16.5 s | Short statements sent right after the failure: `backend disconnects ... execute_time=15.45–15.51s cmd=Query`, client gets EOF |
| +46 s | Long query started 17 s before the failure: `backend disconnects ... execute_time=1m3.2s cmd=Query query="select sleep(?)"`, client gets EOF |
Describe the feature you'd like
When the health check marks a TiDB down, we'd like TiProxy to:
- Close idle client connections on that TiDB right away, so the application's next ping fails instantly and its pool reconnects to a healthy TiDB.
- After failover-timeout, also close connections that still have a command in flight. This should break the wait on the TiDB side too (close the backend socket or put a deadline on it), so the client gets an error in seconds rather than a minute.
- Apply the unhealthy keepalive to the backend socket immediately when the TiDB is marked down, without waiting for processLock, so even connections with a stuck command get the shorter timeouts.
Teachability, Documentation, Adoption, Migration Strategy
Keep it off by default so current behaviour doesn't change. It's most useful for OLTP applications behind connection pools, where each pooled connection to a dead TiDB costs one full TCP timeout.
- 主要语言
- Go
- 星标
- 73
- 派生
- 41
- 平均合并
- 2 小时 21 分钟
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pingcap/tiproxy 的其他 Issue
-
type/enhancement
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
severity/minor type/bug
难度 3/5 1-2 天 新手友好度 55/100
维护者通常 1 天内回复
-
type/bug
难度 3/5 1-2 天 新手友好度 64/100
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 38/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
Say in the changelog that the text-index update cannot be rolled back可能已有人在做 @praetorianer777 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
praetorianer777/GoTome#275 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
SAP/crossplane-provider-btp#1118 ·
维护者通常 1 天内回复
-
benchmark: `make setup` fails because audit-exporter builds with Go 1.25.0 while go.mod requires 1.26.0可能已有人在做 @xsvm 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 84/100
volcano-sh/volcano#6097 · 1 条评论 ·
维护者通常 1 天内回复
-
area/infra backlog bug
难度 2/5 1-3 小时 新手友好度 72/100
praetorianer777/Stator#417 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复