Skip to content
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

[Blob][Fileshare] Ensured that download fails if blob/file modified mid download #19276

Merged
merged 4 commits into from
Jun 29, 2021

Conversation

tasherif-msft
Copy link
Contributor

Blobs:
Currently in blobs we lock on etag, and we try to let the user override this by passing If-Match:'*' but the logic was incorrect which just led to the ability to modify a blob during the second chunked call, otherwise it would still fail. I have removed this extra logic completely.

Fileshare:
Added locking on etag - previously there was no etag locking.

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label Jun 16, 2021
@tasherif-msft tasherif-msft changed the title Ensured that download fails if blob/file modified mid download [Blob][Fileshare] Ensured that download fails if blob/file modified mid download Jun 16, 2021
Copy link
Contributor

@kasobol-msft kasobol-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -162,6 +163,9 @@ def _download_chunk(self, chunk_start, chunk_end):
download_stream_current=self.progress_total,
**self.request_options
)
if response.properties.etag != self.etag:
raise ValueError("The file has been modified while downloading.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check with @annatisch if this is right exception type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dotnet we throw this and provide more data than just message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with @xiafu-msft and we are now throwing ResourceModifiedError as per blob natively does in this case.

@tasherif-msft tasherif-msft merged commit af456fe into Azure:main Jun 29, 2021
rakshith91 pushed a commit to rakshith91/azure-sdk-for-python that referenced this pull request Jul 16, 2021
…id download (Azure#19276)

* Ensured that download fails if blob/file modified mid download

* fixed linter

* ResourceModifiedError
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants