In _async_initiate_upload the code tries to delete a blob before upload.
This leads to several effects.
- 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.
- The delete blob, even if only a trial, leads to additional storage transactions and cost
- 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()