Skip to content

Commit 7224ff2

Browse files
authored
fix(enterprise/replicasync): fix data race in Manager.Regional (#8910)
1 parent 9f5ac4d commit 7224ff2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

enterprise/replicasync/replicasync.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,13 @@ func (m *Manager) InRegion(regionID int32) []database.Replica {
375375

376376
// Regional returns all replicas in the same region excluding itself.
377377
func (m *Manager) Regional() []database.Replica {
378-
return m.InRegion(m.self.RegionID)
378+
return m.InRegion(m.regionID())
379+
}
380+
381+
func (m *Manager) regionID() int32 {
382+
m.mutex.Lock()
383+
defer m.mutex.Unlock()
384+
return m.self.RegionID
379385
}
380386

381387
// SetCallback sets a function to execute whenever new peers

0 commit comments

Comments
 (0)