pingcap / pingcap/tidb

tidb should handle some fatal error before exit for upgrade

Open
#45,917 2 comments 0 reactions 0 assignees View on GitHub
sig/sql-infra type/enhancement
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)
```bash
1. # deploy a cluster with 5 tidb nodes
tiup cluster deploy min v6.5.3 mutli-tidb.yaml --user tidb -p -y
tiup cluster start min -y
mycli -u root -h 127.0.0.1 -P 4000 -e "create database cdctest;"
2. # upgrade using --offline
tiup cluster stop min -y
tiup cluster upgrade min v7.1.1 -y --offline
3. # start the cluster
tiup cluster start min
```

### 2. What did you expect to see? (Required)
tidb can be started in a short period of time
### 3. What did you see instead (Required)
1. tidb will start concurrently and get some fatal error
1. you can see the tidb exit with fatal and not clean some data
```log
[2023/08/08 18:05:20.588 +08:00] [WARN] [session.go:2263] ["run statement failed"] [schemaVersion=46] [error="[meta:1146]table doesn't exist"] [session="{\n \"currDBName\": \"\",\n \"id\": 0,\n \"status\": 2,\n \"strictMode\": true,\n \"user\": null\n}"]
[2023/08/08 18:05:20.588 +08:00] [FATAL] [bootstrap.go:1340] ["doReentrantDDL error"] [error="[meta:1146]table doesn't exist"] [stack="github.com/pingcap/tidb/session.doReentrantDDL\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/boots
trap.go:1340\ngithub.com/pingcap/tidb/session.upgradeToVer132\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/bootstrap.go:2474\ngithub.com/pingcap/tidb/session.upgrade\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pi
ngcap/tidb/session/bootstrap.go:1115\ngithub.com/pingcap/tidb/session.runInBootstrapSession\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:3519\ngithub.com/pingcap/tidb/session.BootstrapSession\n\t/home/jenkins/agent/worksp
ace/build-common/go/src/github.com/pingcap/tidb/session/session.go:3296\nmain.createStoreAndDomain\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:347\nmain.main\n\t/home/jenkins/agent/workspace/build-common/go/src/github.c
om/pingcap/tidb/tidb-server/main.go:241\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"]
[2023/08/08 18:05:35.734 +08:00] [INFO] [cpuprofile.go:113] ["parallel cpu profiler started"]
[2023/08/08 18:05:35.735 +08:00] [INFO] [printer.go:48] ["Welcome to TiDB."] ["Release Version"=v7.1.1] [Edition=Community] ["Git Commit Hash"=cf441574864be63938524e7dfcf7cc659edc3dd8] ["Git Branch"=heads/refs/tags/v7.1.1] ["UTC Build Time"="2023-07-19 10:20:53"] [GoVersi
on=go1.20.6] ["Race Enabled"=false] ["Check Table Before Drop"=false] ["TiKV Min Version"=6.2.0-alpha]
```
2. for this, the ddl owner need to wait a lease(45s) to execute the next ddl, Which causes the tidb start up too slowly
### 4. What is your TiDB version? (Required)
6ad49e79b171969e1f

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.