azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

Checksum verification not working when uploading using stageBlock/commitBlockList or when using blobClient.getBlockBlobClient().getBlobOutputStream

Open ihudedi opened this issue 1 year ago • 5 comments

Hi, I would like to perform checksum verfication after I upload large file via stageBlock/commitBlockList or via blobClient.getBlockBlobClient().getBlobOutputStream(BlockBlobOutputStreamOptions) I tried to set the checksum in commitBlock but the checksum verfication doesn't affect only set the md5 in the blob. I tried to set the md5 in blobHttpHeaders of the BlockBlobOutputStreamOptions without success. Is there any option do perfrom checksum verfication on server side when uploading via stageBlock/commitBlockList or via getBlobOutputStream The checksum is saved in the blob but no verification is done. Thanks, Itay

ihudedi avatar May 07 '24 06:05 ihudedi

@ibrahimrabab @ibrandes @seanmcc-msft

github-actions[bot] avatar May 07 '24 06:05 github-actions[bot]

Thank you for your feedback. Tagging and routing to the team member best able to assist.

github-actions[bot] avatar May 07 '24 06:05 github-actions[bot]

Hi, Is there any solution to my issue? Thanks, Itay

ihudedi avatar May 09 '24 08:05 ihudedi

Any updates?

ihudedi avatar May 15 '24 08:05 ihudedi

Any updates?

ihudedi avatar May 19 '24 10:05 ihudedi

Hi @ihudedi Thanks for reaching out! Apologies for not being able to respond to your question earlier. You can use checksum verification when uploading using stageBlock() or upload() while setting the contentMd5 parameter on either BlockBlobStageBlockOptions for stageBlock or BlockBlobSimpleUploadOptions for upload. How are you trying to trying to upload and verify the checksum? Can you provide a code snippet of how you are doing the checksum verification? Also, what SDK version are you using?

ibrahimrabab avatar May 22 '24 01:05 ibrahimrabab

Hi @ibrahimrabab When uploading using stageblock and commitblocklist the checksum is being verified per block uploading and not per all file.when I upload the file as one chunk and not in chunks ( bliboutputoptions or stage block ) I can't verify checksum for whole file.its working fine when I upload file via upload() Thanks, Itay

ihudedi avatar May 22 '24 04:05 ihudedi

@ihudedi By design, the way stageBlock and commitBlockList work is that it will verify per chunk uploaded. MD5 cannot be calculated for the entire file, it would be calculated for uploaded chunk. For your scenario, using upload() will be the best option so that you will be able to upload the entire file and calculate the checksum together.

ibrahimrabab avatar May 22 '24 22:05 ibrahimrabab

Hi @ihudedi If your issue is resolved, we can go ahead and close this issue. If you have any further questions please let us know!

ibrahimrabab avatar May 28 '24 18:05 ibrahimrabab