Skip to content

Commit

Permalink
feat: segment length check
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniFrenchBread committed Jul 4, 2024
1 parent 34733b2 commit 4338e8b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions transfer/download_parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,24 @@ func (downloader *SegmentDownloader) ParallelDo(ctx context.Context, routine, ta
"chunks": fmt.Sprintf("[%v, %v)", startIndex, endIndex),
}).Error("Failed to download segment")
continue
} else if segment == nil {
}
if segment == nil {
downloader.logger.WithFields(logrus.Fields{
"node index": nodeIndex,
"segment": fmt.Sprintf("%v/%v", segmentIndex, downloader.numSegments),
"chunks": fmt.Sprintf("[%v, %v)", startIndex, endIndex),
}).Warn("segment not found")
continue
} else if downloader.logger.IsLevelEnabled(logrus.TraceLevel) {
}
if len(segment)%core.DefaultChunkSize != 0 {
downloader.logger.WithFields(logrus.Fields{
"node index": nodeIndex,
"segment": fmt.Sprintf("%v/%v", segmentIndex, downloader.numSegments),
"chunks": fmt.Sprintf("[%v, %v)", startIndex, endIndex),
}).Warn("invalid segment length")
continue
}
if downloader.logger.IsLevelEnabled(logrus.TraceLevel) {
downloader.logger.WithFields(logrus.Fields{
"node index": nodeIndex,
"segment": fmt.Sprintf("%v/%v", segmentIndex, downloader.numSegments),
Expand Down

0 comments on commit 4338e8b

Please sign in to comment.