Skip to content

_async_initiate_upload leads to unnecessary storage transactions and Failure metrics #489

@OliverKleinBST

Description

@OliverKleinBST

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions