Skip to content

Commit 232a50c

Browse files
committed
update
1 parent 699a156 commit 232a50c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pkg/session/bootstrap.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
"github.com/pingcap/tidb/pkg/util/intest"
5050
"github.com/pingcap/tidb/pkg/util/logutil"
5151
"github.com/pingcap/tidb/pkg/util/sqlescape"
52+
"github.com/pingcap/tidb/pkg/util/sqlexec"
5253
"go.uber.org/zap"
5354
)
5455

@@ -1042,13 +1043,9 @@ func upgrade(s sessiontypes.Session) {
10421043
// initGlobalVariableIfNotExists initialize a global variable with specific val if it does not exist.
10431044
func initGlobalVariableIfNotExists(s sessiontypes.Session, name string, val any) {
10441045
ctx := kv.WithInternalSourceType(context.Background(), kv.InternalTxnBootstrap)
1045-
rs, err := s.ExecuteInternal(ctx, "SELECT VARIABLE_VALUE FROM %n.%n WHERE VARIABLE_NAME=%?;",
1046-
mysql.SystemDB, mysql.GlobalVariablesTable, name)
1046+
rows, err := sqlexec.ExecSQL(ctx, s, "SELECT VARIABLE_VALUE FROM %n.%n WHERE VARIABLE_NAME=%?;", mysql.SystemDB, mysql.GlobalVariablesTable, name)
10471047
terror.MustNil(err)
1048-
req := rs.NewChunk(nil)
1049-
terror.MustNil(rs.Next(ctx, req))
1050-
terror.MustNil(rs.Close())
1051-
if req.NumRows() != 0 {
1048+
if len(rows) != 0 {
10521049
return
10531050
}
10541051

pkg/session/bootstrap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,7 +2332,7 @@ func TestIssue61890(t *testing.T) {
23322332
MustExec(t, s1, "create table mysql.global_variables(`VARIABLE_NAME` varchar(64) NOT NULL PRIMARY KEY clustered, `VARIABLE_VALUE` varchar(16383) DEFAULT NULL)")
23332333

23342334
s2 := CreateSessionAndSetID(t, store)
2335-
initGlobalVariableIfNotExists(s2, variable.TiDBEnableINLJoinInnerMultiPattern, variable.Off)
2335+
initGlobalVariableIfNotExists(s2, vardef.TiDBEnableINLJoinInnerMultiPattern, vardef.Off)
23362336

23372337
dom.Close()
23382338
}

0 commit comments

Comments
 (0)