ddl: tiny clean up and typo (#19110)

This commit is contained in:
Lynn
2020-08-11 11:01:02 +08:00
committed by GitHub
parent 8978773f5e
commit eb29a65ef2
3 changed files with 8 additions and 14 deletions

View File

@ -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.
@ -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) {

View File

@ -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.
@ -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()

View File

@ -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 {
@ -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)
}