Skip to content

Commit

Permalink
coprocessor: fix data race for tiflash work index in region cache (#1…
Browse files Browse the repository at this point in the history
…9198)

Co-authored-by: ti-srebot <[email protected]>
  • Loading branch information
lzmhhh123 and ti-srebot authored Aug 21, 2020
1 parent 74ef1a2 commit 69d4517
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion store/tikv/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ func (c *RegionCache) insertRegionToCache(cachedRegion *Region) {
if old != nil {
// Don't refresh TiFlash work idx for region. Otherwise, it will always goto a invalid store which
// is under transferring regions.
cachedRegion.getStore().workTiFlashIdx = old.(*btreeItem).cachedRegion.getStore().workTiFlashIdx
atomic.StoreInt32(&cachedRegion.getStore().workTiFlashIdx, atomic.LoadInt32(&old.(*btreeItem).cachedRegion.getStore().workTiFlashIdx))
delete(c.mu.regions, old.(*btreeItem).cachedRegion.VerID())
}
c.mu.regions[cachedRegion.VerID()] = cachedRegion
Expand Down

0 comments on commit 69d4517

Please sign in to comment.