diff --git a/store/helper/helper.go b/store/helper/helper.go index 471d3d179fbdb..995cf0b5fe675 100644 --- a/store/helper/helper.go +++ b/store/helper/helper.go @@ -1001,7 +1001,13 @@ func (h *Helper) GetPDRegionStats(tableID int64, stats *PDRegionStats, noIndexSt logutil.BgLogger().Error("err", zap.Error(err)) } }() - + if resp.StatusCode != http.StatusOK { + body, err := io.ReadAll(resp.Body) + if err != nil { + return errors.Errorf("GetPDRegionStats %d: %s", resp.StatusCode, err) + } + return errors.Errorf("GetPDRegionStats %d: %s", resp.StatusCode, string(body)) + } dec := json.NewDecoder(resp.Body) return dec.Decode(stats)