diff --git a/ddl/column.go b/ddl/column.go index 3d14cbd25c..c1365a6989 100644 --- a/ddl/column.go +++ b/ddl/column.go @@ -329,6 +329,12 @@ func (d *ddl) onDropColumn(t *meta.Meta, job *model.Job) error { } } +// How to backfill column data in reorganization state? +// 1, Generate a snapshot with special version. +// 2, Traverse the snapshot, get every row in the table. +// 3, For one row, if the row has been already deleted, skip to next row. +// 4, If not deleted, check whether column data has existed, if existed, skip to next row. +// 5, If column data doesn't exist, backfill the column with default value and then continue to handle next row. func (d *ddl) backfillColumn(t table.Table, columnInfo *model.ColumnInfo, version uint64, seekHandle int64) error { for { handles, err := d.getSnapshotRows(t, version, seekHandle)