Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamproducer: check the job type for replication stream #86613

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/ccl/logictestccl/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,6 @@ SELECT crdb_internal.stream_ingestion_stats_json(unique_rowid());

query error pq: crdb_internal\.stream_ingestion_stats_json\(\): job.*is not a stream ingestion job
SELECT crdb_internal.stream_ingestion_stats_json(id) FROM (SELECT id FROM system.jobs LIMIT 1);

query error pq: crdb_internal\.replication_stream_spec\(\): job.*is not a replication stream job
SELECT crdb_internal.replication_stream_spec(crdb_internal.create_sql_schema_telemetry_job())
6 changes: 5 additions & 1 deletion pkg/ccl/streamingccl/streamproducer/stream_lifetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ func getReplicationStreamSpec(
planCtx := dsp.NewPlanningCtx(evalCtx.Ctx(), jobExecCtx.ExtendedEvalContext(),
nil /* planner */, noTxn, sql.DistributionTypeSystemTenantOnly)

replicatedSpans := j.Details().(jobspb.StreamReplicationDetails).Spans
details, ok := j.Details().(jobspb.StreamReplicationDetails)
if !ok {
return nil, errors.Errorf("job with id %d is not a replication stream job", streamID)
}
replicatedSpans := details.Spans
spans := make([]roachpb.Span, 0, len(replicatedSpans))
for _, span := range replicatedSpans {
spans = append(spans, *span)
Expand Down