Fix: [scheduler] destPeer keepalive when downloaded by other peer (#1865)
Signed-off-by: bigerous <cuidajun.cdj@alibaba-inc.com>
This commit is contained in:
parent
3af4cc7a0f
commit
51683c2fd9
|
|
@ -234,7 +234,9 @@ func (s *Service) ReportPieceResult(stream schedulerv1.Scheduler_ReportPieceResu
|
||||||
if parent, loaded := s.resource.PeerManager().Load(piece.DstPid); loaded {
|
if parent, loaded := s.resource.PeerManager().Load(piece.DstPid); loaded {
|
||||||
metrics.PeerHostTraffic.WithLabelValues(peer.Tag, peer.Application, metrics.PeerHostTrafficUploadType, parent.Host.ID, parent.Host.IP).Add(float64(piece.PieceInfo.RangeSize))
|
metrics.PeerHostTraffic.WithLabelValues(peer.Tag, peer.Application, metrics.PeerHostTrafficUploadType, parent.Host.ID, parent.Host.IP).Add(float64(piece.PieceInfo.RangeSize))
|
||||||
} else {
|
} else {
|
||||||
peer.Log.Warnf("dst peer %s not found for piece %#v %#v", piece.DstPid, piece, piece.PieceInfo)
|
if piece.DstPid != "" { // not backSource piece
|
||||||
|
peer.Log.Warnf("dst peer %s not found for piece %#v %#v", piece.DstPid, piece, piece.PieceInfo)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,6 +750,11 @@ func (s *Service) handlePieceSuccess(ctx context.Context, peer *resource.Peer, p
|
||||||
// peer.UpdateAt needs to be updated to prevent
|
// peer.UpdateAt needs to be updated to prevent
|
||||||
// the peer from being GC during the download process.
|
// the peer from being GC during the download process.
|
||||||
peer.UpdateAt.Store(time.Now())
|
peer.UpdateAt.Store(time.Now())
|
||||||
|
if piece.DstPid != "" {
|
||||||
|
if destPeer, ok := s.resource.PeerManager().Load(piece.DstPid); ok {
|
||||||
|
destPeer.UpdateAt.Store(time.Now())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// When the peer downloads back-to-source,
|
// When the peer downloads back-to-source,
|
||||||
// piece downloads successfully updates the task piece info.
|
// piece downloads successfully updates the task piece info.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue