Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: hehechen <chentongli@pingcap.com>
  • Loading branch information
hehechen committed Nov 16, 2022
1 parent 3de37a9 commit 5787b34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ddl/ddl_tiflash_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ func (d *ddl) refreshTiFlashTicker(ctx sessionctx.Context, pollTiFlashContext *T
tb, _, _ := is.FindTableByPartitionID(phyTable.ID)
if tb == nil {
logutil.BgLogger().Info("[ddl] waitForAddPartition")
time.Sleep(time.Duration(val.(int)) * time.Second)
sleepSecond := val.(int)
time.Sleep(time.Duration(sleepSecond) * time.Second)
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ func (w *worker) onAddTablePartition(d *ddlCtx, t *meta.Meta, job *model.Job) (v
case model.StateReplicaOnly:
// replica only -> public
failpoint.Inject("sleepBeforeReplicaOnly", func(val failpoint.Value) {
time.Sleep(time.Duration(val.(int)) * time.Second)
sleepSecond := val.(int)
time.Sleep(time.Duration(sleepSecond) * time.Second)
})
// Here need do some tiflash replica complement check.
// TODO: If a table is with no TiFlashReplica or it is not available, the replica-only state can be eliminated.
Expand All @@ -196,7 +197,15 @@ func (w *worker) onAddTablePartition(d *ddlCtx, t *meta.Meta, job *model.Job) (v
if tblInfo.TiFlashReplica != nil && tblInfo.TiFlashReplica.Available {
for _, d := range partInfo.Definitions {
tblInfo.TiFlashReplica.AvailablePartitionIDs = append(tblInfo.TiFlashReplica.AvailablePartitionIDs, d.ID)
infosync.UpdateTiFlashProgressCache(d.ID, 1)
err = infosync.UpdateTiFlashProgressCache(d.ID, 1)
if err != nil {
// just print log, progress will be updated in `refreshTiFlashTicker`
logutil.BgLogger().Error("update tiflash sync progress cache failed",
zap.Error(err),
zap.Int64("tableID", tblInfo.ID),
zap.Int64("partitionID", d.ID),
)
}
}
}
// For normal and replica finished table, move the `addingDefinitions` into `Definitions`.
Expand Down

0 comments on commit 5787b34

Please sign in to comment.