Skip to content

Commit

Permalink
sql: remove no longer used channel in createStatsNode
Browse files Browse the repository at this point in the history
This hasn't been used as of fe6377c.
Also mark `create_stats.go` as owned by SQL Queries.

Epic: None

Release note: None
  • Loading branch information
yuzefovich committed Mar 28, 2023
1 parent 3f113fc commit ab10d6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
/pkg/sql/stats/ @cockroachdb/sql-queries

/pkg/sql/col* @cockroachdb/sql-queries
/pkg/sql/create_stats* @cockroachdb/sql-queries
/pkg/sql/distsql*.go @cockroachdb/sql-queries
/pkg/sql/exec* @cockroachdb/sql-queries
#!/pkg/sql/exec_log*.go @cockroachdb/sql-queries-noreview
Expand Down
11 changes: 3 additions & 8 deletions pkg/sql/create_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,19 @@ type createStatsNode struct {
// createStatsRun contains the run-time state of createStatsNode during local
// execution.
type createStatsRun struct {
resultsCh chan tree.Datums
errCh chan error
errCh chan error
}

func (n *createStatsNode) startExec(params runParams) error {
telemetry.Inc(sqltelemetry.SchemaChangeCreateCounter("stats"))
n.run.resultsCh = make(chan tree.Datums)
n.run.errCh = make(chan error)
go func() {
err := n.startJob(params.ctx, n.run.resultsCh)
err := n.startJob(params.ctx)
select {
case <-params.ctx.Done():
case n.run.errCh <- err:
}
close(n.run.errCh)
close(n.run.resultsCh)
}()
return nil
}
Expand All @@ -130,16 +127,14 @@ func (n *createStatsNode) Next(params runParams) (bool, error) {
return false, params.ctx.Err()
case err := <-n.run.errCh:
return false, err
case <-n.run.resultsCh:
return true, nil
}
}

func (*createStatsNode) Close(context.Context) {}
func (*createStatsNode) Values() tree.Datums { return nil }

// startJob starts a CreateStats job to plan and execute statistics creation.
func (n *createStatsNode) startJob(ctx context.Context, resultsCh chan<- tree.Datums) error {
func (n *createStatsNode) startJob(ctx context.Context) error {
record, err := n.makeJobRecord(ctx)
if err != nil {
return err
Expand Down

0 comments on commit ab10d6c

Please sign in to comment.