Skip to content

Commit

Permalink
ddl: tiny clean up and typo (pingcap#19110)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored Aug 11, 2020
1 parent 8978773 commit eb29a65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ func (s *testStateChangeSuite) TestParallelDDLBeforeRunDDLJob(c *C) {
return info
}
d := s.dom.DDL()
d.(ddl.DDLForTest).SetInterceptoror(intercept)
d.(ddl.DDLForTest).SetInterceptor(intercept)

// Make sure the connection 1 executes a SQL before the connection 2.
// And the connection 2 executes a SQL with an outdated information schema.
Expand Down Expand Up @@ -1343,7 +1343,7 @@ func (s *testStateChangeSuite) TestParallelDDLBeforeRunDDLJob(c *C) {
wg.Wait()

intercept = &ddl.TestInterceptor{}
d.(ddl.DDLForTest).SetInterceptoror(intercept)
d.(ddl.DDLForTest).SetInterceptor(intercept)
}

func (s *testStateChangeSuite) TestParallelAlterSchemaCharsetAndCollate(c *C) {
Expand Down
8 changes: 4 additions & 4 deletions ddl/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (
type DDLForTest interface {
// SetHook sets the hook.
SetHook(h Callback)
// SetInterceptoror sets the interceptor.
SetInterceptoror(h Interceptor)
// SetInterceptor sets the interceptor.
SetInterceptor(h Interceptor)
}

// SetHook implements DDL.SetHook interface.
Expand All @@ -50,8 +50,8 @@ func (d *ddl) SetHook(h Callback) {
d.mu.hook = h
}

// SetInterceptoror implements DDL.SetInterceptoror interface.
func (d *ddl) SetInterceptoror(i Interceptor) {
// SetInterceptor implements DDL.SetInterceptor interface.
func (d *ddl) SetInterceptor(i Interceptor) {
d.mu.Lock()
defer d.mu.Unlock()

Expand Down
10 changes: 2 additions & 8 deletions ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,7 @@ func (w *addIndexWorker) run(d *ddlCtx) {
logutil.BgLogger().Info("[ddl] add index worker exit", zap.Int("workerID", w.id))
}

func makeupDecodeColMap(sessCtx sessionctx.Context, t table.Table, indexInfo *model.IndexInfo) (map[int64]decoder.Column, error) {
cols := t.Cols()
indexedCols := make([]*table.Column, len(indexInfo.Columns))
for i, v := range indexInfo.Columns {
indexedCols[i] = cols[v.Offset]
}

func makeupDecodeColMap(sessCtx sessionctx.Context, t table.Table) (map[int64]decoder.Column, error) {
dbName := model.NewCIStr(sessCtx.GetSessionVars().CurrentDB)
exprCols, _, err := expression.ColumnInfos2ColumnsAndNames(sessCtx, dbName, t.Meta().Name, t.Meta().Columns, t.Meta())
if err != nil {
Expand Down Expand Up @@ -1419,7 +1413,7 @@ func (w *worker) addPhysicalTableIndex(t table.PhysicalTable, indexInfo *model.I

startHandle, endHandle := reorgInfo.StartHandle, reorgInfo.EndHandle
sessCtx := newContext(reorgInfo.d.store)
decodeColMap, err := makeupDecodeColMap(sessCtx, t, indexInfo)
decodeColMap, err := makeupDecodeColMap(sessCtx, t)
if err != nil {
return errors.Trace(err)
}
Expand Down

0 comments on commit eb29a65

Please sign in to comment.