Skip to content

Commit

Permalink
importccl: fix bug when mixing old and new tables during import
Browse files Browse the repository at this point in the history
There was an indexing bug which would have been triggered if the
resolution of new and old table descriptors was ever mixed within the
same import. This situation has not hit any users because an IMPORT only
allows writing to new tables, while an IMPORT INTO only allows writing
to existing (old) tables, thereby never mixing the two.

This change fixes that bug.

Closes cockroachdb#50733

Release note: None
  • Loading branch information
adityamaru committed Jul 1, 2020
1 parent a6a58f4 commit eff70be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/ccl/importccl/import_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,8 @@ func (r *importResumer) prepareTableDescsForIngestion(
if err != nil {
return err
}
for i, table := range res {
for _, table := range res {
i := newTableDescToIdx[table]
importDetails.Tables[i] = jobspb.ImportDetails_Table{Desc: table,
Name: details.Tables[i].Name,
SeqVal: details.Tables[i].SeqVal,
Expand Down

0 comments on commit eff70be

Please sign in to comment.