Skip to content

Commit

Permalink
ddl: minor clean up (pingcap#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaut authored Nov 15, 2016
2 parents 165b8b1 + de1b558 commit f4ae986
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ddl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ func (d *ddl) dropSchemaData(tIDs []int64, startKey kv.Key, job *model.Job, m *m
return true, nil
}

var isFinished bool
isFinished := false
var nextStartKey kv.Key
for i, id := range tIDs {
job.TableID = id
if startKey == nil {
startKey = tablecodec.EncodeTablePrefix(id)
}
limit := defaultBatchSize
delCount, err := d.dropTableData(startKey, job, limit)
delCount, err := d.dropTableData(startKey, job, defaultBatchSize)
if err != nil {
return false, errors.Trace(err)
}
if delCount == limit {

if delCount == defaultBatchSize {
isFinished = false
nextStartKey = job.Args[len(job.Args)-1].(kv.Key)
break
Expand All @@ -189,7 +189,6 @@ func (d *ddl) dropSchemaData(tIDs []int64, startKey kv.Key, job *model.Job, m *m
}
startKey = nil
isFinished = true
continue
}
job.TableID = 0
job.Args = []interface{}{tIDs, nextStartKey}
Expand Down

0 comments on commit f4ae986

Please sign in to comment.