Skip to content

Commit fa76550

Browse files
authored
infoschema: fix schema and data mismatch for TIDB_SERVERS_INFO (pingcap#59246)
close pingcap#59245
1 parent 1c97bf6 commit fa76550

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

pkg/executor/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ go_test(
481481
"//pkg/util/sqlexec",
482482
"//pkg/util/sqlkiller",
483483
"//pkg/util/stmtsummary/v2:stmtsummary",
484-
"//pkg/util/stringutil",
485484
"//pkg/util/syncutil",
486485
"//pkg/util/tableutil",
487486
"//pkg/util/topsql/state",

pkg/executor/infoschema_reader_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/pingcap/failpoint"
2828
"github.com/pingcap/kvproto/pkg/kvrpcpb"
29+
"github.com/pingcap/tidb/pkg/config"
2930
"github.com/pingcap/tidb/pkg/domain/infosync"
3031
"github.com/pingcap/tidb/pkg/meta/model"
3132
"github.com/pingcap/tidb/pkg/parser/auth"
@@ -36,7 +37,6 @@ import (
3637
"github.com/pingcap/tidb/pkg/testkit"
3738
"github.com/pingcap/tidb/pkg/testkit/testfailpoint"
3839
"github.com/pingcap/tidb/pkg/util/logutil"
39-
"github.com/pingcap/tidb/pkg/util/stringutil"
4040
"github.com/stretchr/testify/require"
4141
"github.com/tikv/client-go/v2/tikv"
4242
"github.com/tikv/client-go/v2/tikvrpc"
@@ -370,10 +370,19 @@ func TestForAnalyzeStatus(t *testing.T) {
370370
}
371371

372372
func TestForServersInfo(t *testing.T) {
373+
globalCfg := config.GetGlobalConfig()
374+
t.Cleanup(func() {
375+
config.StoreGlobalConfig(globalCfg)
376+
})
377+
newCfg := *globalCfg
378+
newCfg.Labels = map[string]string{"dc": "dc1"}
379+
config.StoreGlobalConfig(&newCfg)
380+
373381
store := testkit.CreateMockStore(t)
374382
tk := testkit.NewTestKit(t, store)
375383
rows := tk.MustQuery("select * from information_schema.TIDB_SERVERS_INFO").Rows()
376384
require.Len(t, rows, 1)
385+
require.Len(t, rows[0], 8)
377386

378387
info, err := infosync.GetServerInfo()
379388
require.NoError(t, err)
@@ -385,7 +394,7 @@ func TestForServersInfo(t *testing.T) {
385394
require.Equal(t, info.Lease, rows[0][4])
386395
require.Equal(t, info.Version, rows[0][5])
387396
require.Equal(t, info.GitHash, rows[0][6])
388-
require.Equal(t, stringutil.BuildStringFromLabels(info.Labels), rows[0][8])
397+
require.Equal(t, "dc=dc1", rows[0][7])
389398
}
390399

391400
func TestTiFlashSystemTableWithTiFlashV620(t *testing.T) {

pkg/infoschema/tables.go

-1
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,6 @@ var tableTiDBServersInfoCols = []columnInfo{
10961096
{name: "LEASE", tp: mysql.TypeVarchar, size: 64},
10971097
{name: "VERSION", tp: mysql.TypeVarchar, size: 64},
10981098
{name: "GIT_HASH", tp: mysql.TypeVarchar, size: 64},
1099-
{name: "BINLOG_STATUS", tp: mysql.TypeVarchar, size: 64},
11001099
{name: "LABELS", tp: mysql.TypeVarchar, size: 128},
11011100
}
11021101

0 commit comments

Comments
 (0)