From 5f97570e864e579b4bbb473ac3365b5c5f48bb65 Mon Sep 17 00:00:00 2001 From: irfan sharif Date: Mon, 18 Jan 2021 15:46:21 -0500 Subject: [PATCH] importccl: account for the RowSource return constraint ...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 --- pkg/ccl/importccl/import_processor.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/ccl/importccl/import_processor.go b/pkg/ccl/importccl/import_processor.go index 4ebe56aa50e3..b8136b20d947 100644 --- a/pkg/ccl/importccl/import_processor.go +++ b/pkg/ccl/importccl/import_processor.go @@ -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.