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

_async_initiate_upload leads to unnecessary storage transactions and Failure metrics #489

Open
OliverKleinBST opened this issue Nov 26, 2024 · 0 comments

Comments

@OliverKleinBST
Copy link

In _async_initiate_upload the code tries to delete a blob before upload.
This leads to several effects.

  1. if a blob does not exist we get a ResoureNotFoundError, if we have no delete rights we get a HttpResponseError. Those errors will show up as unexpected Failures in the "Insights" Failure metric of the storage account.
  2. The delete blob, even if only a trial, leads to additional storage transactions and cost
  3. delete_blob should not be required, as storage could be done using the overwrite=True flag leading to the same behavior

Here the problematic code

    async def _async_initiate_upload(self, **kwargs):
        """Prepare a remote file upload"""
        self._block_list = []
        if self.mode == "wb":
            try:
                await self.container_client.delete_blob(self.blob)
            except ResourceNotFoundError:
                pass
            except HttpResponseError:
                pass
            else:
                await self._reinitiate_async_upload()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant