CloudPageBlob.UploadFromStream does not work with IfMatchETag/IfNotModifiedSinceTime conditions #167

Closed
illinar opened this Issue Jan 25, 2013 · 2 comments

Comments

Projects
None yet
1 participant

illinar commented Jan 25, 2013

Invoking UploadFromStream on CloudPageBlob with IfMatchETag (similar problem with other conditions) fails with ConditionNotMet exception. CloudBlockBlob works correctly.

The reason seems to be in an extra (internal) REST call to set the maximum size of the blob before uploading the data. The first (create) call succeeds since the condition is met, however, it changes ETag causing the second (upload) call to fail.

Internal flow:

UploadFromStream -> OpenWrite -> (observes that Size is defined) -> Create
any further calls with the original condition would fail

There is a potential issue with other code flows where OpenWrite is similarly used.
There are two possible suggestions to fix this:

  1. Detect the presence of the original IfMatchETag condition and update it accordingly once Create succeeds by setting new ETag value. However, this may result in side-effects if blob is modified in between two calls.
  2. Do not invoke Create at all, test the current size of the blob (as if the size was not specified) and if new size is larger throw an exception. This approach seems cleaner to me as the API consumer is given information to react accordingly, i.e. resize first, then upload.
@ghost

ghost commented Jan 25, 2013

Thank you for reporting this issue. We apologize for any inconvenience this may have caused.

We are working on a fix and will update this issue once we release it.

@ghost

ghost commented Mar 26, 2013

This is now fixed in WindowsAzure#185

ghost closed this Mar 26, 2013

@huangpf huangpf added a commit that referenced this issue Nov 13, 2015

@huangpf huangpf Merge pull request #167 from Azure/AutoRest
Auto rest
a992dec

@hovsepm hovsepm pushed a commit that referenced this issue May 16, 2016

@dragonfly91 dragonfly91 Merge pull request #167 from MabOneSdk/anudeeb-dev1
Updating RS Backup OneSDK with latest hydra spec
b3ff614

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment