Skip to content

Commit

Permalink
address crazycs520's comments #2
Browse files Browse the repository at this point in the history
  • Loading branch information
bb7133 committed Dec 6, 2018
1 parent ade79af commit 5bf6773
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,22 +680,10 @@ func (b *executorBuilder) buildCreateTableInsert(v *plannercore.DDL, tableID int
}
selectExec := b.build(v.InsertPlan.SelectPlan)

dom := domain.GetDomain(b.ctx)
ver, err := dom.Store().CurrentVersion()
if err != nil {
b.err = errors.Trace(err)
return nil
}
snapshot, err := dom.Store().GetSnapshot(ver)
if err != nil {
b.err = errors.Trace(err)
return nil
}

m := meta.NewSnapshotMeta(snapshot)
dbInfo, ok := dom.InfoSchema().SchemaByName(stmt.Table.Schema)
m := meta.NewMeta(b.ctx.Txn(true))
dbInfo, ok := b.is.SchemaByName(stmt.Table.Schema)
if !ok {
b.err = errors.Trace(err)
b.err = infoschema.ErrDatabaseNotExists.GenWithStackByArgs(stmt.Table.Schema.L)
return nil
}
tbInfo, err := m.GetTable(dbInfo.ID, tableID)
Expand All @@ -705,7 +693,7 @@ func (b *executorBuilder) buildCreateTableInsert(v *plannercore.DDL, tableID int
}

// We have to create an allocator here, which is not the one created by InfoSchema, but it should be fine.
alloc := autoid.NewAllocator(dom.Store(), tbInfo.GetDBID(dbInfo.ID))
alloc := autoid.NewAllocator(b.ctx.GetStore(), tbInfo.GetDBID(dbInfo.ID))
tbl, err := tables.TableFromMeta(alloc, tbInfo)
if err != nil {
b.err = errors.Trace(err)
Expand Down

0 comments on commit 5bf6773

Please sign in to comment.