tikv: do not refresh TiFlash work index when region is refreshed in cache (#14205)

This commit is contained in:
Zhuomin(Charming) Liu
2019-12-26 13:25:09 +08:00
committed by pingcap-github-bot
parent f18abc980d
commit 7a024a2d25

View File

@ -677,6 +677,9 @@ func (c *RegionCache) UpdateLeader(regionID RegionVerID, leaderStoreID uint64, c
func (c *RegionCache) insertRegionToCache(cachedRegion *Region) {
old := c.mu.sorted.ReplaceOrInsert(newBtreeItem(cachedRegion))
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
delete(c.mu.regions, old.(*btreeItem).cachedRegion.VerID())
}
c.mu.regions[cachedRegion.VerID()] = cachedRegion