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

sql: fix newly introduced race #90962

Merged
merged 1 commit into from
Oct 31, 2022
Merged

Conversation

ajwerner
Copy link
Contributor

@ajwerner ajwerner commented Oct 31, 2022

All of the goroutines were writing to the same err variable. This race was introduced in #89540.

Epic: None

Release note: None

All of the goroutines were writing to the same `err` variable. This race was
introduced in cockroachdb#89540.

Release note: None
@ajwerner ajwerner requested review from fqazi and a team October 31, 2022 02:23
@ajwerner
Copy link
Contributor Author

==================
WARNING: DATA RACE
Write at 0x00c00b2561d0 by goroutine 567027:
  github.com/cockroachdb/cockroach/pkg/sql.ValidateInvertedIndexes.func3()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1700 +0x484
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx.func1()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:168 +0x4c
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:74 +0x86
Previous write at 0x00c00b2561d0 by goroutine 567025:
  github.com/cockroachdb/cockroach/pkg/sql.ValidateInvertedIndexes.func3()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1700 +0x484
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx.func1()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:168 +0x4c
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:74 +0x86
Goroutine 567027 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:71 +0x12e
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:167 +0x109
  github.com/cockroachdb/cockroach/pkg/sql.ValidateInvertedIndexes()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1691 +0xd04
  github.com/cockroachdb/cockroach/pkg/sql.(*SchemaChanger).validateIndexes.func3()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1498 +0x37c
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx.func1()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:168 +0x4c
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:74 +0x86
Goroutine 567025 (finished) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:71 +0x12e
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:167 +0x109
  github.com/cockroachdb/cockroach/pkg/sql.ValidateInvertedIndexes()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1691 +0xd04
  github.com/cockroachdb/cockroach/pkg/sql.(*SchemaChanger).validateIndexes.func3()
      github.com/cockroachdb/cockroach/pkg/sql/backfill.go:1498 +0x37c
  github.com/cockroachdb/cockroach/pkg/util/ctxgroup.Group.GoCtx.func1()
      github.com/cockroachdb/cockroach/pkg/util/ctxgroup/ctxgroup.go:168 +0x4c
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      golang.org/x/sync/errgroup/external/org_golang_x_sync/errgroup/errgroup.go:74 +0x86
==================

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@ajwerner
Copy link
Contributor Author

The flake here is #90965.

@postamar
Copy link
Contributor

Wow that's such an easy bug to write.

@ajwerner
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 31, 2022

Build succeeded:

@craig craig bot merged commit c476f0d into cockroachdb:master Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants