Skip to content

Commit

Permalink
cherry pick pingcap#17969 to release-4.0
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
crazycs520 authored and ti-srebot committed Jun 23, 2020
1 parent d0b3404 commit d4ef6a9
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions executor/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,21 +471,28 @@ func GetDropOrTruncateTableInfoFromJobs(jobs []*model.Job, gcSafePoint uint64, d
if err != nil {
return false, err
}
// Get the snapshot infoSchema before drop table.
// TODO: only get the related database info and table info.
snapInfo, err := dom.GetSnapshotInfoSchema(job.StartTS)

snapMeta, err := dom.GetSnapshotMeta(job.StartTS)
if err != nil {
return false, err
}
// Get table meta from snapshot infoSchema.
table, ok := snapInfo.TableByID(job.TableID)
if !ok {
tbl, err := snapMeta.GetTable(job.SchemaID, job.TableID)
if err != nil {
if meta.ErrDBNotExists.Equal(err) {
// The dropped/truncated DDL maybe execute failed that caused by the parallel DDL execution,
// then can't find the table from the snapshot info-schema. Should just ignore error here,
// see more in TestParallelDropSchemaAndDropTable.
continue
}
return false, err
}
if tbl == nil {
// The dropped/truncated DDL maybe execute failed that caused by the parallel DDL execution,
// then can't find the table from the snapshot info-schema. Should just ignore error here,
// see more in TestParallelDropSchemaAndDropTable.
continue
}
finish, err := fn(job, table.Meta())
finish, err := fn(job, tbl)
if err != nil || finish {
return finish, err
}
Expand Down

0 comments on commit d4ef6a9

Please sign in to comment.