Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infoschema: fix query processlist and cluster_log ... (#19648) #19690

Merged
merged 8 commits into from
Sep 3, 2020
6 changes: 3 additions & 3 deletions infoschema/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ type columnInfo struct {
func buildColumnInfo(col columnInfo) *model.ColumnInfo {
mCharset := charset.CharsetBin
mCollation := charset.CharsetBin
if col.tp == mysql.TypeVarchar || col.tp == mysql.TypeBlob {
if col.tp == mysql.TypeVarchar || col.tp == mysql.TypeBlob || col.tp == mysql.TypeLongBlob {
mCharset = charset.CharsetUTF8MB4
mCollation = charset.CollationUTF8MB4
}
Expand Down Expand Up @@ -690,7 +690,7 @@ var tableProcesslistCols = []columnInfo{
{name: "COMMAND", tp: mysql.TypeVarchar, size: 16, flag: mysql.NotNullFlag, deflt: ""},
{name: "TIME", tp: mysql.TypeLong, size: 7, flag: mysql.NotNullFlag, deflt: 0},
{name: "STATE", tp: mysql.TypeVarchar, size: 7},
{name: "INFO", tp: mysql.TypeString, size: 512},
{name: "INFO", tp: mysql.TypeLongBlob, size: types.UnspecifiedLength},
{name: "MEM", tp: mysql.TypeLonglong, size: 21, flag: mysql.UnsignedFlag},
{name: "TxnStart", tp: mysql.TypeVarchar, size: 64, flag: mysql.NotNullFlag, deflt: ""},
}
Expand Down Expand Up @@ -861,7 +861,7 @@ var tableClusterLogCols = []columnInfo{
{name: "TYPE", tp: mysql.TypeVarchar, size: 64},
{name: "INSTANCE", tp: mysql.TypeVarchar, size: 64},
{name: "LEVEL", tp: mysql.TypeVarchar, size: 8},
{name: "MESSAGE", tp: mysql.TypeVarString, size: 1024},
{name: "MESSAGE", tp: mysql.TypeLongBlob, size: types.UnspecifiedLength},
}

var tableClusterLoadCols = []columnInfo{
Expand Down
11 changes: 10 additions & 1 deletion infoschema/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,19 @@ func (s *testTableSuite) TestInfoschemaFieldValue(c *C) {
" `COMMAND` varchar(16) NOT NULL DEFAULT '',\n" +
" `TIME` int(7) NOT NULL DEFAULT 0,\n" +
" `STATE` varchar(7) DEFAULT NULL,\n" +
" `INFO` binary(512) DEFAULT NULL,\n" +
" `INFO` longtext DEFAULT NULL,\n" +
" `MEM` bigint(21) unsigned DEFAULT NULL,\n" +
" `TxnStart` varchar(64) NOT NULL DEFAULT ''\n" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
tk.MustQuery("show create table information_schema.cluster_log").Check(
testkit.Rows("" +
"CLUSTER_LOG CREATE TABLE `CLUSTER_LOG` (\n" +
" `TIME` varchar(32) DEFAULT NULL,\n" +
" `TYPE` varchar(64) DEFAULT NULL,\n" +
" `INSTANCE` varchar(64) DEFAULT NULL,\n" +
" `LEVEL` varchar(8) DEFAULT NULL,\n" +
" `MESSAGE` longtext DEFAULT NULL\n" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
}

func (s *testTableSuite) TestCharacterSetCollations(c *C) {
Expand Down