Skip to content

Commit

Permalink
miniogw: don't offset part IDs in multipart ops
Browse files Browse the repository at this point in the history
Currently, if the client requests to upload part with ID=1, we upload
part with decremented ID. This patch changes it to always upload parts
with IDs passed by the client (it doesn't change the behavior of MPU
from libuplink's perspective). This enables more transparency between
what gateway and libuplink do. It also allows combining native part
uploads with gateway's (though this is an edge case). Furthermore, parts
verification during multipart upload completion will be easier.

Change-Id: I9e0cf9a0800e82f794850d8e8d6ec013cb2a9124
  • Loading branch information
amwolff committed Feb 3, 2022
1 parent 6f55960 commit 0067a0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions miniogw/multipart.go
Expand Up @@ -135,7 +135,7 @@ func (layer *gatewayLayer) PutObjectPart(ctx context.Context, bucket, object, up
return minio.PartInfo{}, err
}

partUpload, err := project.UploadPart(ctx, bucket, object, uploadID, uint32(partID-1))
partUpload, err := project.UploadPart(ctx, bucket, object, uploadID, uint32(partID))
if err != nil {
return minio.PartInfo{}, convertMultipartError(err, bucket, object, uploadID)
}
Expand All @@ -161,7 +161,7 @@ func (layer *gatewayLayer) PutObjectPart(ctx context.Context, bucket, object, up

part := partUpload.Info()
return minio.PartInfo{
PartNumber: int(part.PartNumber + 1),
PartNumber: int(part.PartNumber),
Size: part.Size,
ActualSize: part.Size,
ETag: string(part.ETag),
Expand Down Expand Up @@ -220,7 +220,7 @@ func (layer *gatewayLayer) ListObjectParts(ctx context.Context, bucket, object,
}

list := project.ListUploadParts(ctx, bucket, object, uploadID, &uplink.ListUploadPartsOptions{
Cursor: uint32(partNumberMarker - 1),
Cursor: uint32(partNumberMarker),
})

parts := make([]minio.PartInfo, 0, maxParts)
Expand All @@ -230,7 +230,7 @@ func (layer *gatewayLayer) ListObjectParts(ctx context.Context, bucket, object,
limit--
part := list.Item()
parts = append(parts, minio.PartInfo{
PartNumber: int(part.PartNumber + 1),
PartNumber: int(part.PartNumber),
LastModified: part.Modified,
ETag: string(part.ETag), // Entity tag returned when the part was initially uploaded.
Size: part.Size, // Size in bytes of the part.
Expand Down

0 comments on commit 0067a0b

Please sign in to comment.