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

Fix snapshot race #69

Merged
merged 1 commit into from
Jun 12, 2022
Merged

Fix snapshot race #69

merged 1 commit into from
Jun 12, 2022

Conversation

kelindar
Copy link
Owner

This should fix the following race

WARNING: DATA RACE
Write at 0x00c00432b000 by goroutine [9](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:10)1:
  github.com/kelindar/bitmap.(*Bitmap).Set()
      /home/runner/go/pkg/mod/github.com/kelindar/bitmap@v1.4.1/bitmap.go:27 +0xb3
  github.com/kelindar/column.(*Collection).next()
      /home/runner/work/column/column/collection.go:94 +0x84
  github.com/kelindar/column.(*Txn).insert()
      /home/runner/work/column/column/txn.go:336 +0x64
  github.com/kelindar/column.(*Txn).Insert()
      /home/runner/work/column/column/txn.go:329 +0xe9
  github.com/kelindar/column.(*Collection).Insert.func1()
      /home/runner/work/column/column/collection.go:152 +0x58
  github.com/kelindar/column.(*Collection).Query()
      /home/runner/work/column/column/collection.go:293 +0x73
  github.com/kelindar/column.(*Collection).Insert()
      /home/runner/work/column/column/collection.go:151 +0x84
  github.com/kelindar/column.TestSnapshotFailures.func3()
      /home/runner/work/column/column/snapshot_test.go:209 +0x47
Previous read at 0x00c00432b000 by goroutine 188:
  github.com/kelindar/bitmap.Bitmap.Range()
      /home/runner/go/pkg/mod/github.com/kelindar/bitmap@v1.4.1/range.go:17 +0x5a
  github.com/kelindar/column.(*Collection).writeState.func1.1()
      /home/runner/work/column/column/snapshot.go:142 +0x1cd
  github.com/kelindar/column.(*Collection).readChunk()
      /home/runner/work/column/column/txn_lock.go:[10](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:11)9 +0x210
  github.com/kelindar/column.(*Collection).writeState.func1()
      /home/runner/work/column/column/snapshot.go:[13](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:14)2 +0x9a
  github.com/kelindar/iostream.(*Writer).WriteRange()
      /home/runner/go/pkg/mod/github.com/kelindar/iostream@v1.3.0/writer.go:245 +0x98
  github.com/kelindar/column.(*Collection).writeState()
      /home/runner/work/column/column/snapshot.go:131 +0x2dc
  github.com/kelindar/column.(*Collection).Snapshot()
      /home/runner/work/column/column/snapshot.go:68 +0x164
  github.com/kelindar/column.TestSnapshotFailures()
      /home/runner/work/column/column/snapshot_test.go:217 +0x1a6
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:[14](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:15)39 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47
Goroutine 91 (running) created at:
  github.com/kelindar/column.TestSnapshotFailures()
      /home/runner/work/column/column/snapshot_test.go:209 +0x13c
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47
Goroutine 188 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:[17](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:18)[19](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:20) +0xa71
  main.main()
      _testmain.go:[27](https://github.com/kelindar/column/runs/6852358984?check_suite_focus=true#step:5:28)5 +0x3a9

@kelindar kelindar merged commit ff08c96 into main Jun 12, 2022
@kelindar kelindar deleted the racesnap branch June 12, 2022 20:50
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.

1 participant