Skip to content

Commit

Permalink
ddl: tiny clean up (pingcap#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaut authored and zimulala committed Nov 15, 2016
1 parent bb70acd commit 01dde44
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package ddl

import (
"math"
"time"

"github.com/juju/errors"
Expand Down Expand Up @@ -486,15 +487,9 @@ func (d *ddl) backfillIndexInTxn(t table.Table, kvIdx table.Index, handles []int
}

func (d *ddl) backfillTableIndex(t table.Table, indexInfo *model.IndexInfo, handles []int64, reorgInfo *reorgInfo) error {
var endIdx int
kvIdx := tables.NewIndex(t.Meta(), indexInfo)
for len(handles) > 0 {
if len(handles) >= defaultSmallBatchCnt {
endIdx = defaultSmallBatchCnt
} else {
endIdx = len(handles)
}

endIdx := int(math.Min(float64(defaultSmallBatchCnt), float64(len(handles))))
err := kv.RunInNewTxn(d.store, true, func(txn kv.Transaction) error {
if err1 := d.isReorgRunnable(txn, ddlJobFlag); err1 != nil {
return errors.Trace(err1)
Expand Down

0 comments on commit 01dde44

Please sign in to comment.