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

ddl: fix race in table lock config #10848

Merged
merged 4 commits into from
Jun 20, 2019
Merged

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

Fix data race in test.

==================
warning: data race
read at 0x000003fe1bf2 by goroutine 252:
  github.com/pingcap/tidb/planner/core.checktablelock()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/config/config.go:586 +0x82
  github.com/pingcap/tidb/planner.optimize()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/planner/optimize.go:53 +0x4d5
  github.com/pingcap/tidb/executor.(*compiler).compile()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/compiler.go:78 +0x268
  github.com/pingcap/tidb/session.(*session).execute()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/compiler.go:55 +0x82f
  github.com/pingcap/tidb/session.(*session).execute()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1015 +0xd4
  github.com/pingcap/tidb/ddl/util.completedeleterange()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/util/util.go:107 +0x190
  github.com/pingcap/tidb/ddl.(*delrange).dotask()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/delete_range.go:223 +0x693
  github.com/pingcap/tidb/ddl.(*delrange).dodelrangework()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/delete_range.go:177 +0x5a5
  github.com/pingcap/tidb/ddl.(*delrange).startemulator()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/delete_range.go:141 +0x204

previous write at 0x000003fe1bf2 by goroutine 480:
  github.com/pingcap/tidb/ddl_test.(*testdbsuite2).testconcurrentlocktables()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/db_test.go:2979 +0x44d
  github.com/pingcap/tidb/ddl_test.(*testdbsuite2).testconcurrentlocktables()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/ddl/db_test.go:2969 +0x359
  runtime.call32()
      /usr/local/go/src/runtime/asm_amd64.s:519 +0x3a
  reflect.value.call()
      /usr/local/go/src/reflect/value.go:308 +0xc0
  github.com/pingcap/check.(*suiterunner).forktest.func1()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:836 +0x9fc
  github.com/pingcap/check.(*suiterunner).forkcall.func1()
      /home/jenkins/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:730 +0xb7

What is changed and how it works?

Check List

Tests

  • No code

Code changes

@crazycs520
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #10848 into master will increase coverage by 0.0342%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #10848        +/-   ##
================================================
+ Coverage   80.8472%   80.8814%   +0.0342%     
================================================
  Files           419        419                
  Lines         88640      88668        +28     
================================================
+ Hits          71663      71716        +53     
+ Misses        11750      11726        -24     
+ Partials       5227       5226         -1

@crazycs520
Copy link
Contributor Author

/run-all-tests

XuHuaiyu
XuHuaiyu previously approved these changes Jun 19, 2019
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

@winkyao winkyao merged commit e4204df into pingcap:master Jun 20, 2019
@winkyao
Copy link
Contributor

winkyao commented Jun 20, 2019

LGTM

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.

4 participants