Skip to content

Commit 395edab

Browse files
authored
statistics: not convert the database names to lowercase duration the auto analyze (#53906)
close #53905
1 parent 2372cf8 commit 395edab

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pkg/statistics/handle/autoanalyze/refresher/refresher.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package refresher
1616

1717
import (
18-
"strings"
1918
"time"
2019

2120
"github.com/pingcap/tidb/pkg/infoschema"
@@ -169,19 +168,19 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
169168
return err
170169
}
171170

172-
dbs := infoschema.AllSchemaNames(is)
171+
dbs := is.AllSchemaNames()
173172
for _, db := range dbs {
174173
// Sometimes the tables are too many. Auto-analyze will take too much time on it.
175174
// so we need to check the available time.
176175
if !r.autoAnalysisTimeWindow.isWithinTimeWindow(time.Now()) {
177176
return nil
178177
}
179178
// Ignore the memory and system database.
180-
if util.IsMemOrSysDB(strings.ToLower(db)) {
179+
if util.IsMemOrSysDB(db.L) {
181180
continue
182181
}
183182

184-
tbls := is.SchemaTables(model.NewCIStr(db))
183+
tbls := is.SchemaTables(db)
185184
// We need to check every partition of every table to see if it needs to be analyzed.
186185
for _, tbl := range tbls {
187186
// If table locked, skip analyze all partitions of the table.
@@ -217,7 +216,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
217216
if pi == nil {
218217
job := CreateTableAnalysisJob(
219218
sctx,
220-
db,
219+
db.O,
221220
tblInfo,
222221
r.statsHandle.GetTableStatsForAutoAnalyze(tblInfo),
223222
autoAnalyzeRatio,
@@ -241,7 +240,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
241240
for pIDAndName, stats := range partitionStats {
242241
job := CreateStaticPartitionAnalysisJob(
243242
sctx,
244-
db,
243+
db.O,
245244
tblInfo,
246245
pIDAndName.ID,
247246
pIDAndName.Name,
@@ -254,7 +253,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
254253
} else {
255254
job := createTableAnalysisJobForPartitions(
256255
sctx,
257-
db,
256+
db.O,
258257
tblInfo,
259258
r.statsHandle.GetPartitionStatsForAutoAnalyze(tblInfo, tblInfo.ID),
260259
partitionStats,

0 commit comments

Comments
 (0)