mirror of
https://github.com/talent-plan/tinykv.git
synced 2024-12-26 12:50:11 +08:00
* clone region meta before send to avoid unexpected variable change
This commit is contained in:
parent
16b8058220
commit
c7fa725b05
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user