-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
pass in correct filesize in ceph backup #5369
Conversation
Just saw it is assigned to me. I will look into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change ceph backup client will know the size of the object taken for backup upload.
There is a possibility that backup can fail based on Code Path, as maxMultipartPutObjectSize is 5TiB though unlikely as it is very high to be stored on a single host though possible.
@@ -88,7 +88,11 @@ func (bh *CephBackupHandle) AddFile(ctx context.Context, filename string, filesi | |||
|
|||
// Give PutObject() the read end of the pipe. | |||
object := objName(bh.dir, bh.name, filename) | |||
_, err := bh.client.PutObjectWithContext(ctx, bucket, object, reader, -1, minio.PutObjectOptions{ContentType: "application/octet-stream"}) | |||
// if filesize is given as 0, pass it as -1 = UNKNOWN | |||
if filesize == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check is not required. -1 was given when file size was not known i.e. not passed to this method. But, now the file size is known this will work irrespective if file size is actually 0 Bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calling code passes 0 when the file size is actually unknown. This happens when we write the manifest file. We call AddFile
to get a WriteCloser
and we actually write to the file using that.
I can add this as a comment so that it is clearer to anyone reading the code.
The other option is to have the calling code pass -1 when file size is unknown. It doesn't look like that will break any of the other plugins. That will cleanly separate actual 0 size files from files where the size is really unknown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the other option of passing -1 for unknown file size so no special check is required in this code block and would be clean.
Yeah, we won't worry about this. |
Signed-off-by: deepthi <[email protected]>
Signed-off-by: deepthi <[email protected]>
5e42bfe
to
776fca4
Compare
This is a fix for #4804
Any ceph users out there who can review?
Signed-off-by: deepthi [email protected]