Skip to content

Commit

Permalink
importccl: account for the RowSource return constraint
Browse files Browse the repository at this point in the history
...in the import processor. The contract of `RowSource.Next` requires
that at most one of the return values will be non-empty. This wasn't the
case here, and caused opaque failures in #58897. #58897 tries to enable
background tracing by default, which for us means that the trailing meta
can be non-empty (they'll contain span recordings). That behaviour ends
up tickling this bug, tripping up TestCSVImportCanBeResumed.

Release note: None
  • Loading branch information
irfansharif committed Jan 18, 2021
1 parent d00f2c7 commit 5f97570
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/ccl/importccl/import_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,15 @@ func (idp *readImportDataProcessor) Next() (rowenc.EncDatumRow, *execinfrapb.Pro
// Once the import is done, send back to the controller the serialized
// summary of the import operation. For more info see roachpb.BulkOpSummary.
countsBytes, err := protoutil.Marshal(idp.summary)
idp.MoveToDraining(err)
if err != nil {
idp.MoveToDraining(err)
return nil, idp.DrainHelper()
}

idp.MoveToDraining(nil /* err */)
return rowenc.EncDatumRow{
rowenc.DatumToEncDatum(types.Bytes, tree.NewDBytes(tree.DBytes(countsBytes))),
rowenc.DatumToEncDatum(types.Bytes, tree.NewDBytes(tree.DBytes([]byte{}))),
}, idp.DrainHelper()
}, nil
}

// ConsumerDone is part of the RowSource interface.
Expand Down

0 comments on commit 5f97570

Please sign in to comment.