Skip to content

Commit

Permalink
prevent assigning nil to startKey & endKey
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed May 30, 2023
1 parent d34a1a8 commit 42d9729
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ddl/job_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func getDDLReorgHandle(se *sess.Session, job *model.Job) (element *meta.Element,
}

func getCheckpointReorgHandle(se *sess.Session, job *model.Job) (startKey, endKey kv.Key, physicalTableID int64, err error) {
startKey, endKey = kv.Key{}, kv.Key{}
sql := fmt.Sprintf("select reorg_meta from mysql.tidb_ddl_reorg where job_id = %d", job.ID)
ctx := kv.WithInternalSourceType(context.Background(), getDDLRequestSource(job.Type))
rows, err := se.Execute(ctx, sql, "get_handle")
Expand All @@ -629,8 +630,12 @@ func getCheckpointReorgHandle(se *sess.Session, job *model.Job) (startKey, endKe
zap.String("end", hex.EncodeToString(cp.EndKey)),
zap.Int64("checkpoint physical ID", cp.PhysicalID))
physicalTableID = cp.PhysicalID
startKey = cp.StartKey
endKey = cp.EndKey
if len(cp.StartKey) > 0 {
startKey = cp.StartKey
}
if len(cp.EndKey) > 0 {
endKey = cp.EndKey
}
}
}
return
Expand Down

0 comments on commit 42d9729

Please sign in to comment.