15
15
package refresher
16
16
17
17
import (
18
- "strings"
19
18
"time"
20
19
21
20
"github.com/pingcap/tidb/pkg/infoschema"
@@ -169,19 +168,19 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
169
168
return err
170
169
}
171
170
172
- dbs := infoschema .AllSchemaNames (is )
171
+ dbs := is .AllSchemaNames ()
173
172
for _ , db := range dbs {
174
173
// Sometimes the tables are too many. Auto-analyze will take too much time on it.
175
174
// so we need to check the available time.
176
175
if ! r .autoAnalysisTimeWindow .isWithinTimeWindow (time .Now ()) {
177
176
return nil
178
177
}
179
178
// Ignore the memory and system database.
180
- if util .IsMemOrSysDB (strings . ToLower ( db ) ) {
179
+ if util .IsMemOrSysDB (db . L ) {
181
180
continue
182
181
}
183
182
184
- tbls := is .SchemaTables (model . NewCIStr ( db ) )
183
+ tbls := is .SchemaTables (db )
185
184
// We need to check every partition of every table to see if it needs to be analyzed.
186
185
for _ , tbl := range tbls {
187
186
// If table locked, skip analyze all partitions of the table.
@@ -217,7 +216,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
217
216
if pi == nil {
218
217
job := CreateTableAnalysisJob (
219
218
sctx ,
220
- db ,
219
+ db . O ,
221
220
tblInfo ,
222
221
r .statsHandle .GetTableStatsForAutoAnalyze (tblInfo ),
223
222
autoAnalyzeRatio ,
@@ -241,7 +240,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
241
240
for pIDAndName , stats := range partitionStats {
242
241
job := CreateStaticPartitionAnalysisJob (
243
242
sctx ,
244
- db ,
243
+ db . O ,
245
244
tblInfo ,
246
245
pIDAndName .ID ,
247
246
pIDAndName .Name ,
@@ -254,7 +253,7 @@ func (r *Refresher) RebuildTableAnalysisJobQueue() error {
254
253
} else {
255
254
job := createTableAnalysisJobForPartitions (
256
255
sctx ,
257
- db ,
256
+ db . O ,
258
257
tblInfo ,
259
258
r .statsHandle .GetPartitionStatsForAutoAnalyze (tblInfo , tblInfo .ID ),
260
259
partitionStats ,
0 commit comments