From ab10d6c86d8a2442460386a36c5fc0cac97c3281 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 27 Mar 2023 18:59:05 -0700 Subject: [PATCH] sql: remove no longer used channel in createStatsNode This hasn't been used as of fe6377c4f1b6e822bb436f64808762e02a815c11. Also mark `create_stats.go` as owned by SQL Queries. Epic: None Release note: None --- .github/CODEOWNERS | 1 + pkg/sql/create_stats.go | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5a94785a85a8..c8df0df75344 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/pkg/sql/create_stats.go b/pkg/sql/create_stats.go index 55797f257b51..718f8fc40a88 100644 --- a/pkg/sql/create_stats.go +++ b/pkg/sql/create_stats.go @@ -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 } @@ -130,8 +127,6 @@ 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 } } @@ -139,7 +134,7 @@ 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