Skip to content

Commit

Permalink
tidb-server: return 1 while failing to set cpu affinity (#30197)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyangyu committed Dec 2, 2021
1 parent 450d72f commit 04a387c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ func main() {
syncLog()
}

func exit() {
syncLog()
os.Exit(0)
}

func syncLog() {
if err := log.Sync(); err != nil {
// Don't complain about /dev/stdout as Fsync will return EINVAL.
Expand Down Expand Up @@ -259,15 +254,15 @@ func setCPUAffinity() {
c, err := strconv.Atoi(af)
if err != nil {
fmt.Fprintf(os.Stderr, "wrong affinity cpu config: %s", *affinityCPU)
exit()
os.Exit(1)
}
cpu = append(cpu, c)
}
}
err := linux.SetAffinity(cpu)
if err != nil {
fmt.Fprintf(os.Stderr, "set cpu affinity failure: %v", err)
exit()
os.Exit(1)
}
runtime.GOMAXPROCS(len(cpu))
metrics.MaxProcs.Set(float64(runtime.GOMAXPROCS(0)))
Expand Down

0 comments on commit 04a387c

Please sign in to comment.