Skip to content

Commit

Permalink
Merge branch 'master' into add_field_stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Dec 13, 2022
2 parents edfebae + 33e5baa commit b9108c2
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 22 deletions.
5 changes: 2 additions & 3 deletions br/pkg/storage/memstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"bytes"
"context"
"io"
"io/ioutil"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestMemStoreBasic(t *testing.T) {
require.Nil(t, err)
r2, err := store.Open(ctx, "/hello.txt")
require.Nil(t, err)
fileContent, err = ioutil.ReadAll(r)
fileContent, err = io.ReadAll(r)
require.Nil(t, err)
require.True(t, bytes.Equal([]byte("hello world 3"), fileContent))
require.Nil(t, r.Close())
Expand All @@ -83,7 +82,7 @@ func TestMemStoreBasic(t *testing.T) {

_, err = r2.Seek(5, io.SeekStart)
require.Nil(t, err)
fileContent, err = ioutil.ReadAll(r2)
fileContent, err = io.ReadAll(r2)
require.Nil(t, err)
require.True(t, bytes.Equal([]byte(" world 3"), fileContent))

Expand Down
3 changes: 1 addition & 2 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"strconv"
"testing"
Expand Down Expand Up @@ -1802,7 +1801,7 @@ func TestSetClusterConfig(t *testing.T) {
httpCnt = 0
tk.Session().SetValue(executor.TestSetConfigHTTPHandlerKey, func(req *http.Request) (*http.Response, error) {
httpCnt++
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
require.NoError(t, err)
// The `raftstore.` prefix is stripped.
require.JSONEq(t, `{"server.snap-max-write-bytes-per-sec":"500MB"}`, string(body))
Expand Down
4 changes: 2 additions & 2 deletions parser/consistent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package parser

import (
"io/ioutil"
gio "io"
"os"
"sort"
"strings"
Expand All @@ -27,7 +27,7 @@ func TestKeywordConsistent(t *testing.T) {
parserFilename := "parser.y"
parserFile, err := os.Open(parserFilename)
requires.NoError(t, err)
data, err := ioutil.ReadAll(parserFile)
data, err := gio.ReadAll(parserFile)
requires.NoError(t, err)
content := string(data)

Expand Down
4 changes: 2 additions & 2 deletions parser/format/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package format

import (
"bytes"
"io/ioutil"
"io"
"strings"
"testing"

Expand All @@ -26,7 +26,7 @@ import (
func checkFormat(t *testing.T, f Formatter, buf *bytes.Buffer, str, expect string) {
_, err := f.Format(str, 3)
require.NoError(t, err)
b, err := ioutil.ReadAll(buf)
b, err := io.ReadAll(buf)
require.NoError(t, err)
require.Equal(t, expect, string(b))
}
Expand Down
4 changes: 2 additions & 2 deletions parser/reserved_words_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
// needed to connect to MySQL

dbsql "database/sql"
"io/ioutil"
gio "io"
"os"
"testing"

Expand All @@ -41,7 +41,7 @@ func TestCompareReservedWordsWithMySQL(t *testing.T) {
parserFilename := "parser.y"
parserFile, err := os.Open(parserFilename)
requires.NoError(t, err)
data, err := ioutil.ReadAll(parserFile)
data, err := gio.ReadAll(parserFile)
requires.NoError(t, err)
content := string(data)

Expand Down
4 changes: 2 additions & 2 deletions planner/core/binary_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package core_test
import (
"encoding/base64"
"fmt"
"io/ioutil"
"io"
"os"
"regexp"
"strings"
Expand Down Expand Up @@ -521,7 +521,7 @@ func TestUnnecessaryBinaryPlanInSlowLog(t *testing.T) {
tk.MustExec("drop table if exists th")
tk.MustExec("set global tidb_slow_log_threshold = 1;")
tk.MustExec("create table th (i int, a int,b int, c int, index (a)) partition by hash (a) partitions 100;")
slowLogBytes, err := ioutil.ReadAll(f)
slowLogBytes, err := io.ReadAll(f)
require.NoError(t, err)
require.NotContains(t, string(slowLogBytes), `tidb_decode_binary_plan('')`)
}
6 changes: 3 additions & 3 deletions server/plan_replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package server

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -83,7 +83,7 @@ func handleDownloadFile(handler downloadFileHandler, w http.ResponseWriter, req
writeError(w, err)
return
}
content, err := ioutil.ReadAll(file)
content, err := io.ReadAll(file)
if err != nil {
writeError(w, err)
return
Expand Down Expand Up @@ -137,7 +137,7 @@ func handleDownloadFile(handler downloadFileHandler, w http.ResponseWriter, req
zap.String("remote-addr", remoteAddr), zap.Int("status-code", resp.StatusCode))
continue
}
content, err := ioutil.ReadAll(resp.Body)
content, err := io.ReadAll(resp.Body)
if err != nil {
writeError(w, err)
return
Expand Down
3 changes: 1 addition & 2 deletions server/plan_replayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"bytes"
"database/sql"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -69,7 +68,7 @@ func TestDumpPlanReplayerAPI(t *testing.T) {
require.NoError(t, resp0.Body.Close())
}()

body, err := ioutil.ReadAll(resp0.Body)
body, err := io.ReadAll(resp0.Body)
require.NoError(t, err)

path := "/tmp/plan_replayer.zip"
Expand Down
4 changes: 2 additions & 2 deletions statistics/handle/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"compress/gzip"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"time"

"github.com/pingcap/errors"
Expand Down Expand Up @@ -501,7 +501,7 @@ func BlocksToJSONTable(blocks [][]byte) (*JSONTable, error) {
if err := gzipReader.Close(); err != nil {
return nil, err
}
jsonStr, err := ioutil.ReadAll(gzipReader)
jsonStr, err := io.ReadAll(gzipReader)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down
3 changes: 1 addition & 2 deletions util/cpuprofile/cpuprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"bytes"
"context"
"io"
"io/ioutil"
"net"
"net/http"
"runtime/pprof"
Expand Down Expand Up @@ -237,7 +236,7 @@ func TestProfileHTTPHandler(t *testing.T) {
resp, err = http.Get("http://" + address + "/debug/pprof/profile?seconds=100000")
require.NoError(t, err)
require.Equal(t, 400, resp.StatusCode)
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "profile duration exceeds server's WriteTimeout\n", string(body))
require.NoError(t, resp.Body.Close())
Expand Down

0 comments on commit b9108c2

Please sign in to comment.