Skip to content

Commit

Permalink
fix: strictly order car blocks for contiguous layout
Browse files Browse the repository at this point in the history
Fixes piece retrieval errors such as:

  failed to find piece: failed to create piece reader: previous offset 1058920619, next offset 1104493679: Blocks must be contiguous
  • Loading branch information
rvagg committed Nov 6, 2023
1 parent 30e57b6 commit 2d540e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion service/contentprovider/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func getPieceMetadata(ctx context.Context, db *gorm.DB, car model.Car) (*PieceMe
}

var carBlocks []model.CarBlock
err = db.Where("car_id = ?", car.ID).Find(&carBlocks).Error
err = db.Where("car_id = ?", car.ID).Order("id ASC").Find(&carBlocks).Error
if err != nil {
return nil, errors.WithStack(err)
}
Expand Down

0 comments on commit 2d540e3

Please sign in to comment.