From b2a9a56f04f50c0efe89aac1028ed481679e863e Mon Sep 17 00:00:00 2001 From: Hu# Date: Mon, 25 Mar 2024 12:09:46 +0800 Subject: [PATCH] tabls: fix resp is nil and change resp check (#52035) close pingcap/tidb#52034 --- pkg/infoschema/tables.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/infoschema/tables.go b/pkg/infoschema/tables.go index e94f4add54a50..67b14a05d3c82 100644 --- a/pkg/infoschema/tables.go +++ b/pkg/infoschema/tables.go @@ -1988,8 +1988,7 @@ func getMicroServiceServerInfo(ctx sessionctx.Context, serviceName string) ([]Se } req.Header.Add("PD-Allow-follower-handle", "true") resp, err := util.InternalHTTPClient().Do(req) - // PD is not in the microservice mode - if resp.StatusCode == http.StatusServiceUnavailable { + if resp == nil || resp.StatusCode != http.StatusOK { terror.Log(resp.Body.Close()) return servers, nil }