mirror of
https://github.com/talent-plan/tinykv.git
synced 2024-12-27 13:20:24 +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) {
|
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{
|
ch <- &runner.SchedulerRegionHeartbeatTask{
|
||||||
Region: p.Region(),
|
Region: clonedRegion,
|
||||||
Peer: p.Meta,
|
Peer: p.Meta,
|
||||||
PendingPeers: p.CollectPendingPeers(),
|
PendingPeers: p.CollectPendingPeers(),
|
||||||
ApproximateSize: p.ApproximateSize,
|
ApproximateSize: p.ApproximateSize,
|
||||||
|
Loading…
Reference in New Issue
Block a user