m3
m3 copied to clipboard
[dbnode] Avoid data race in xcontext
What this PR does / why we need it:
There is a data race on checkedAndNotSampled field in xcontext which happens when the context is being used concurrently. I believe there is no production impact, but this prevents the running of multiple tests with -race.
An alternative would be to agree that xcontext is not meant to be thread safe and avoid using it across goroutines (see https://github.com/m3db/m3/pull/3261) but from the usage of lockking elsewhere it looks like the original intention was for it to be thread safe.
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?: NONE
Does this PR require updating code package or user-facing documentation?: NONE
Codecov Report
Merging #3283 (ed45a1d) into master (da44ea0) will decrease coverage by
0.1%. Report is 680 commits behind head on master. The diff coverage is94.1%.
Additional details and impacted files
@@ Coverage Diff @@
## master #3283 +/- ##
=========================================
- Coverage 72.4% 72.4% -0.1%
=========================================
Files 1099 1099
Lines 101504 101518 +14
=========================================
+ Hits 73579 73588 +9
- Misses 22849 22856 +7
+ Partials 5076 5074 -2
| Flag | Coverage Δ | |
|---|---|---|
| aggregator | 76.5% <ø> (+<0.1%) |
:arrow_up: |
| cluster | 84.9% <ø> (ø) |
|
| collector | 84.3% <ø> (ø) |
|
| dbnode | 78.8% <0.0%> (-0.1%) |
:arrow_down: |
| m3em | 74.4% <ø> (ø) |
|
| m3ninx | 73.5% <ø> (ø) |
|
| metrics | 19.9% <ø> (ø) |
|
| msg | 74.0% <ø> (-0.2%) |
:arrow_down: |
| query | 67.3% <ø> (ø) |
|
| x | 80.5% <100.0%> (+<0.1%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update da44ea0...ed45a1d. Read the comment docs.