@@ -25,6 +25,7 @@ import (
25
25
"github.com/pingcap/tidb/pkg/sessionctx"
26
26
"github.com/pingcap/tidb/pkg/types"
27
27
"github.com/pingcap/tidb/pkg/util"
28
+ "github.com/pingcap/tidb/pkg/util/intest"
28
29
"github.com/pingcap/tidb/pkg/util/sem"
29
30
)
30
31
@@ -77,11 +78,15 @@ var memTableToAllTiDBClusterTables = map[string]string{
77
78
TableTiDBPlanCache : ClusterTableTiDBPlanCache ,
78
79
}
79
80
81
+ var memTableToAllTiDBClusterTablesWithLowerCase = make (map [string ]string )
82
+
80
83
// memTableToDDLOwnerClusterTables means add memory table to cluster table that will send cop request to DDL owner node.
81
84
var memTableToDDLOwnerClusterTables = map [string ]string {
82
85
TableTiFlashReplica : TableTiFlashReplica ,
83
86
}
84
87
88
+ var memTableToDDLOwnerClusterTablesWithLowerCase = make (map [string ]string )
89
+
85
90
// ClusterTableCopDestination means the destination that cluster tables will send cop requests to.
86
91
type ClusterTableCopDestination int
87
92
@@ -103,6 +108,7 @@ func GetClusterTableCopDestination(tableName string) ClusterTableCopDestination
103
108
func init () {
104
109
var addrCol = columnInfo {name : util .ClusterTableInstanceColumnName , tp : mysql .TypeVarchar , size : 64 }
105
110
for memTableName , clusterMemTableName := range memTableToAllTiDBClusterTables {
111
+ memTableToAllTiDBClusterTablesWithLowerCase [strings .ToLower (memTableName )] = strings .ToLower (clusterMemTableName )
106
112
memTableCols := tableNameToColumns [memTableName ]
107
113
if len (memTableCols ) == 0 {
108
114
continue
@@ -112,23 +118,34 @@ func init() {
112
118
cols = append (cols , memTableCols ... )
113
119
tableNameToColumns [clusterMemTableName ] = cols
114
120
}
121
+ for memTableName , clusterMemTableName := range memTableToDDLOwnerClusterTables {
122
+ memTableToDDLOwnerClusterTablesWithLowerCase [strings .ToLower (memTableName )] = strings .ToLower (clusterMemTableName )
123
+ }
115
124
}
116
125
117
126
// IsClusterTableByName used to check whether the table is a cluster memory table.
118
127
// Export for PhysicalTableScan.ExplainID
119
128
func IsClusterTableByName (dbName , tableName string ) bool {
120
- dbName = strings .ToUpper (dbName )
129
+ intest .AssertFunc (func () bool {
130
+ return dbName == strings .ToLower (dbName )
131
+ })
121
132
switch dbName {
122
- case util .InformationSchemaName .O , util .PerformanceSchemaName .O :
123
- tableName = strings .ToUpper (tableName )
124
- for _ , name := range memTableToAllTiDBClusterTables {
125
- name = strings .ToUpper (name )
133
+ case util .InformationSchemaName .L , util .PerformanceSchemaName .L :
134
+ intest .AssertFunc (func () bool {
135
+ return tableName == strings .ToLower (tableName )
136
+ })
137
+ for _ , name := range memTableToAllTiDBClusterTablesWithLowerCase {
138
+ intest .AssertFunc (func () bool {
139
+ return name == strings .ToLower (name )
140
+ })
126
141
if name == tableName {
127
142
return true
128
143
}
129
144
}
130
- for _ , name := range memTableToDDLOwnerClusterTables {
131
- name = strings .ToUpper (name )
145
+ for _ , name := range memTableToDDLOwnerClusterTablesWithLowerCase {
146
+ intest .AssertFunc (func () bool {
147
+ return name == strings .ToLower (name )
148
+ })
132
149
if name == tableName {
133
150
return true
134
151
}
0 commit comments