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

release-23.2: changefeedccl: log plan diagram during DistSQL planning #126334

Merged
Merged
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
16 changes: 16 additions & 0 deletions pkg/ccl/changefeedccl/changefeed_dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package changefeedccl

import (
"context"
"fmt"
"sort"

"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/cdceval"
Expand Down Expand Up @@ -490,6 +491,21 @@ func makePlan(
p.PlanToStreamColMap = []int{1, 2, 3}
sql.FinalizePlan(ctx, planCtx, p)

// Log the plan diagram URL so that we don't have to rely on it being in system.job_info.
const maxLenDiagURL = 1 << 20 // 1 MiB
flowSpecs := p.GenerateFlowSpecs()
if _, diagURL, err := execinfrapb.GeneratePlanDiagramURL(
fmt.Sprintf("changefeed: %d", jobID),
flowSpecs,
execinfrapb.DiagramFlags{},
); err != nil {
log.Warningf(ctx, "failed to generate changefeed plan diagram: %s", err)
} else if diagURL := diagURL.String(); len(diagURL) > maxLenDiagURL {
log.Warningf(ctx, "changefeed plan diagram length is too large to be logged: %d", len(diagURL))
} else {
log.Infof(ctx, "changefeed plan diagram: %s", diagURL)
}

return p, planCtx, nil
}
}
Expand Down