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

base: remove OptionalNodeIDErr #104828

Merged
merged 1 commit into from
Jun 14, 2023
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
1 change: 0 additions & 1 deletion pkg/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ go_library(
"//pkg/settings/cluster",
"//pkg/util",
"//pkg/util/envutil",
"//pkg/util/errorutil",
"//pkg/util/humanizeutil",
"//pkg/util/metric",
"//pkg/util/mon",
Expand Down
10 changes: 0 additions & 10 deletions pkg/base/node_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/errorutil"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/redact"
)
Expand Down Expand Up @@ -233,15 +232,6 @@ func (c *SQLIDContainer) OptionalNodeID() (roachpb.NodeID, bool) {
return (*NodeIDContainer)(c).Get(), true
}

// OptionalNodeIDErr is like OptionalNodeID, but returns an error (referring to
// the optionally supplied GitHub issues) if the ID is not present.
func (c *SQLIDContainer) OptionalNodeIDErr(issue int) (roachpb.NodeID, error) {
if (*NodeIDContainer)(c).standaloneSQLInstance {
return 0, errorutil.UnsupportedWithMultiTenancy(issue)
}
return (*NodeIDContainer)(c).Get(), nil
}

// SQLInstanceID returns the wrapped SQLInstanceID.
func (c *SQLIDContainer) SQLInstanceID() SQLInstanceID {
return SQLInstanceID((*NodeIDContainer)(c).Get())
Expand Down
12 changes: 5 additions & 7 deletions pkg/ccl/streamingccl/streamingest/stream_ingestion_dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ func startDistIngestion(
client,
replicatedTime,
streamProgress.Checkpoint,
initialScanTimestamp)(ctx, dsp)
initialScanTimestamp,
dsp.GatewayID(),
)(ctx, dsp)
if err != nil {
return err
}
Expand Down Expand Up @@ -128,6 +130,7 @@ func makePlan(
previousReplicatedTime hlc.Timestamp,
checkpoint jobspb.StreamIngestionCheckpoint,
initialScanTimestamp hlc.Timestamp,
gatewayID base.SQLInstanceID,
) func(context.Context, *sql.DistSQLPlanner) (*sql.PhysicalPlan, *sql.PlanningCtx, error) {
return func(ctx context.Context, dsp *sql.DistSQLPlanner) (*sql.PhysicalPlan, *sql.PlanningCtx, error) {
jobID := ingestionJob.ID()
Expand Down Expand Up @@ -185,14 +188,9 @@ func makePlan(
execinfrapb.Ordering{},
)

gatewayNodeID, err := execCtx.ExecCfg().NodeInfo.NodeID.OptionalNodeIDErr(48274)
if err != nil {
return nil, nil, err
}

// The ResultRouters from the previous stage will feed in to the
// StreamIngestionFrontier processor.
p.AddSingleGroupStage(ctx, base.SQLInstanceID(gatewayNodeID),
p.AddSingleGroupStage(ctx, gatewayID,
execinfrapb.ProcessorCoreUnion{StreamIngestionFrontier: streamIngestionFrontierSpec},
execinfrapb.PostProcessSpec{}, streamIngestionResultTypes)

Expand Down