@@ -340,15 +340,15 @@ func (do *Domain) sysFacHack() (pools.Resource, error) {
340
340
return do .sysExecutorFactory (do )
341
341
}
342
342
343
- func (do * Domain ) fetchPolicies (m * meta.Meta ) ([]* model.PolicyInfo , error ) {
343
+ func (* Domain ) fetchPolicies (m * meta.Meta ) ([]* model.PolicyInfo , error ) {
344
344
allPolicies , err := m .ListPolicies ()
345
345
if err != nil {
346
346
return nil , err
347
347
}
348
348
return allPolicies , nil
349
349
}
350
350
351
- func (do * Domain ) fetchResourceGroups (m * meta.Meta ) ([]* model.ResourceGroupInfo , error ) {
351
+ func (* Domain ) fetchResourceGroups (m * meta.Meta ) ([]* model.ResourceGroupInfo , error ) {
352
352
allResourceGroups , err := m .ListResourceGroups ()
353
353
if err != nil {
354
354
return nil , err
@@ -380,7 +380,7 @@ func (do *Domain) fetchAllSchemasWithTables(m *meta.Meta) ([]*model.DBInfo, erro
380
380
// so we decrease the concurrency.
381
381
const fetchSchemaConcurrency = 1
382
382
383
- func (do * Domain ) splitForConcurrentFetch (schemas []* model.DBInfo ) [][]* model.DBInfo {
383
+ func (* Domain ) splitForConcurrentFetch (schemas []* model.DBInfo ) [][]* model.DBInfo {
384
384
groupSize := (len (schemas ) + fetchSchemaConcurrency - 1 ) / fetchSchemaConcurrency
385
385
splitted := make ([][]* model.DBInfo , 0 , fetchSchemaConcurrency )
386
386
schemaCnt := len (schemas )
@@ -394,7 +394,7 @@ func (do *Domain) splitForConcurrentFetch(schemas []*model.DBInfo) [][]*model.DB
394
394
return splitted
395
395
}
396
396
397
- func (do * Domain ) fetchSchemasWithTables (schemas []* model.DBInfo , m * meta.Meta , done chan error ) {
397
+ func (* Domain ) fetchSchemasWithTables (schemas []* model.DBInfo , m * meta.Meta , done chan error ) {
398
398
for _ , di := range schemas {
399
399
if di .State != model .StatePublic {
400
400
// schema is not public, can't be used outside.
@@ -456,16 +456,16 @@ func (do *Domain) tryLoadSchemaDiffs(m *meta.Meta, usedVersion, newVersion int64
456
456
if diff .RegenerateSchemaMap {
457
457
return nil , nil , nil , errors .Errorf ("Meets a schema diff with RegenerateSchemaMap flag" )
458
458
}
459
- IDs , err := builder .ApplyDiff (m , diff )
459
+ ids , err := builder .ApplyDiff (m , diff )
460
460
if err != nil {
461
461
return nil , nil , nil , err
462
462
}
463
463
if canSkipSchemaCheckerDDL (diff .Type ) {
464
464
continue
465
465
}
466
466
diffTypes = append (diffTypes , diff .Type .String ())
467
- phyTblIDs = append (phyTblIDs , IDs ... )
468
- for i := 0 ; i < len (IDs ); i ++ {
467
+ phyTblIDs = append (phyTblIDs , ids ... )
468
+ for i := 0 ; i < len (ids ); i ++ {
469
469
actions = append (actions , uint64 (diff .Type ))
470
470
}
471
471
}
@@ -554,7 +554,7 @@ func (do *Domain) Store() kv.Storage {
554
554
}
555
555
556
556
// GetScope gets the status variables scope.
557
- func (do * Domain ) GetScope (status string ) variable.ScopeFlag {
557
+ func (* Domain ) GetScope (string ) variable.ScopeFlag {
558
558
// Now domain status variables scope are all default scope.
559
559
return variable .DefaultStatusVarScopeFlag
560
560
}
@@ -595,7 +595,7 @@ func (do *Domain) Reload() error {
595
595
if err != nil {
596
596
if version = getFlashbackStartTSFromErrorMsg (err ); version != 0 {
597
597
// use the lastest available version to create domain
598
- version -= 1
598
+ version --
599
599
is , hitCache , oldSchemaVersion , changes , err = do .loadInfoSchema (version )
600
600
}
601
601
}
@@ -1422,7 +1422,7 @@ func (do *Domain) checkReplicaRead(ctx context.Context, pdClient pd.Client) erro
1422
1422
for _ , s := range servers {
1423
1423
if v , ok := s .Labels [placement .DCLabelKey ]; ok && v != "" {
1424
1424
if _ , ok := storeZones [v ]; ok {
1425
- storeZones [v ] += 1
1425
+ storeZones [v ]++
1426
1426
if v == zone {
1427
1427
svrIdsInThisZone = append (svrIdsInThisZone , s .ID )
1428
1428
}
@@ -2385,7 +2385,7 @@ func (do *Domain) syncIndexUsageWorker(owner owner.Manager) {
2385
2385
}
2386
2386
}
2387
2387
2388
- func (do * Domain ) updateStatsWorkerExitPreprocessing (statsHandle * handle.Handle , owner owner.Manager ) {
2388
+ func (* Domain ) updateStatsWorkerExitPreprocessing (statsHandle * handle.Handle , owner owner.Manager ) {
2389
2389
ch := make (chan struct {}, 1 )
2390
2390
timeout , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
2391
2391
defer cancel ()
@@ -2406,7 +2406,7 @@ func (do *Domain) updateStatsWorkerExitPreprocessing(statsHandle *handle.Handle,
2406
2406
}
2407
2407
}
2408
2408
2409
- func (do * Domain ) updateStatsWorker (ctx sessionctx.Context , owner owner.Manager ) {
2409
+ func (do * Domain ) updateStatsWorker (_ sessionctx.Context , owner owner.Manager ) {
2410
2410
defer util .Recover (metrics .LabelDomain , "updateStatsWorker" , nil , false )
2411
2411
logutil .BgLogger ().Info ("updateStatsWorker started." )
2412
2412
lease := do .statsLease
@@ -2500,7 +2500,7 @@ func (do *Domain) analyzeJobsCleanupWorker(owner owner.Manager) {
2500
2500
defer util .Recover (metrics .LabelDomain , "analyzeJobsCleanupWorker" , nil , false )
2501
2501
// For GC.
2502
2502
const gcInterval = time .Hour
2503
- const DaysToKeep = 7
2503
+ const daysToKeep = 7
2504
2504
gcTicker := time .NewTicker (gcInterval )
2505
2505
// For clean up.
2506
2506
// Default stats lease is 3 * time.Second.
@@ -2518,7 +2518,7 @@ func (do *Domain) analyzeJobsCleanupWorker(owner owner.Manager) {
2518
2518
case <- gcTicker .C :
2519
2519
// Only the owner should perform this operation.
2520
2520
if owner .IsOwner () {
2521
- updateTime := time .Now ().AddDate (0 , 0 , - DaysToKeep )
2521
+ updateTime := time .Now ().AddDate (0 , 0 , - daysToKeep )
2522
2522
err := statsHandle .DeleteAnalyzeJobs (updateTime )
2523
2523
if err != nil {
2524
2524
logutil .BgLogger ().Warn ("gc analyze history failed" , zap .Error (err ))
@@ -2820,7 +2820,7 @@ func (do *Domain) acquireServerID(ctx context.Context) error {
2820
2820
}
2821
2821
}
2822
2822
2823
- func (do * Domain ) releaseServerID (ctx context.Context ) {
2823
+ func (do * Domain ) releaseServerID (context.Context ) {
2824
2824
serverID := do .ServerID ()
2825
2825
if serverID == 0 {
2826
2826
return
@@ -2840,7 +2840,7 @@ func (do *Domain) releaseServerID(ctx context.Context) {
2840
2840
}
2841
2841
2842
2842
// propose server ID by random.
2843
- func (do * Domain ) proposeServerID (ctx context.Context , conflictCnt int ) (uint64 , error ) {
2843
+ func (* Domain ) proposeServerID (ctx context.Context , conflictCnt int ) (uint64 , error ) {
2844
2844
// get a random server ID in range [min, max]
2845
2845
randomServerID := func (min uint64 , max uint64 ) uint64 {
2846
2846
return uint64 (rand .Int63n (int64 (max - min + 1 )) + int64 (min )) // #nosec G404
0 commit comments