Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: [scheduler] destPeer keepalive when downloaded by other peer #1865

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scheduler/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ func (s *Service) ReportPieceResult(stream schedulerv1.Scheduler_ReportPieceResu
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))
} 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)
}
}
}

Expand Down Expand Up @@ -748,6 +750,11 @@ func (s *Service) handlePieceSuccess(ctx context.Context, peer *resource.Peer, p
// peer.UpdateAt needs to be updated to prevent
// the peer from being GC during the download process.
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,
// piece downloads successfully updates the task piece info.
Expand Down