* clone region meta before send to avoid unexpected variable change
This commit is contained in:
xiongjiwei 2020-05-29 10:00:52 +08:00 committed by GitHub
parent 16b8058220
commit c7fa725b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,8 +343,13 @@ func (p *peer) Term() uint64 {
}
func (p *peer) HeartbeatScheduler(ch chan<- worker.Task) {
clonedRegion := new(metapb.Region)
err := util.CloneMsg(p.Region(), clonedRegion)
if err != nil {
return
}
ch <- &runner.SchedulerRegionHeartbeatTask{
Region: p.Region(),
Region: clonedRegion,
Peer: p.Meta,
PendingPeers: p.CollectPendingPeers(),
ApproximateSize: p.ApproximateSize,