Skip to content

Commit

Permalink
[release-1.0]ddl: support the rolling upgrade. (#6301) (#6306)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and coocood committed Apr 17, 2018
1 parent 8ec4cf0 commit 223aa07
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ddl/ddl_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,16 @@ func (d *ddl) getModifiableColumnJob(ctx context.Context, ident ast.Ident, origi
}

newCol := table.ToColumn(&model.ColumnInfo{
ID: col.ID,
ID: col.ID,
// We use this PR(https://github.com/pingcap/tidb/pull/6274) as the dividing line to define whether it is a new version or an old version TiDB.
// The old version TiDB initializes the column's offset and state here.
// The new version TiDB doesn't initialize the column's offset and state, and it will do the initialization in run DDL function.
// When we do the rolling upgrade the following may happen:
// a new version TiDB builds the DDL job that doesn't be set the column's offset and state,
// and the old version TiDB is the DDL owner, it doesn't get offset and state from the store. Then it will encounter errors.
// So here we set offset and state to support the rolling upgrade.
Offset: col.Offset,
State: col.State,
OriginDefaultValue: col.OriginDefaultValue,
FieldType: *spec.NewColumn.Tp,
Name: spec.NewColumn.Name.Name,
Expand Down

0 comments on commit 223aa07

Please sign in to comment.