Skip to content

Commit

Permalink
fix read failure from system tables `tiflash_segme ... (#19714) (#19748)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 4, 2020
1 parent 8ba084a commit a5922c2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,16 @@ func (e *TiFlashSystemTableRetriever) initialize(sctx sessionctx.Context, tiflas
if len(tiflashInstances) > 0 && !tiflashInstances.Exist(id) {
continue
}
// TODO: Support https in tiflash
url := fmt.Sprintf("http://%s", ev.Value)
url := fmt.Sprintf("%s://%s", util.InternalHTTPSchema(), ev.Value)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return errors.Trace(err)
}
_, err = util.InternalHTTPClient().Do(req)
if err != nil {
sctx.GetSessionVars().StmtCtx.AppendWarning(err)
continue
}
e.instanceInfos = append(e.instanceInfos, tiflashInstanceInfo{
id: id,
url: url,
Expand Down Expand Up @@ -1622,7 +1630,6 @@ func (e *TiFlashSystemTableRetriever) dataForTiFlashSystemTables(ctx sessionctx.
}
sql = fmt.Sprintf("%s LIMIT %d, %d", sql, e.rowIdx, maxCount)
notNumber := "nan"
httpClient := http.DefaultClient
instanceInfo := e.instanceInfos[e.instanceIdx]
url := instanceInfo.url
req, err := http.NewRequest(http.MethodGet, url, nil)
Expand All @@ -1632,7 +1639,7 @@ func (e *TiFlashSystemTableRetriever) dataForTiFlashSystemTables(ctx sessionctx.
q := req.URL.Query()
q.Add("query", sql)
req.URL.RawQuery = q.Encode()
resp, err := httpClient.Do(req)
resp, err := util.InternalHTTPClient().Do(req)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down

0 comments on commit a5922c2

Please sign in to comment.