amaechler opened a new pull request, #16558:
URL: https://github.com/apache/druid/pull/16558
- **Remove unused constants**
- **Refactor getBlockBlobLength**
- **Better link**
- **Upper-case log**
- **Mark defaultStorageAccount nullable**
- **Do not always create a new container if it doesn't exist**
- **Add lots of comments, group methods**
- **Revert "Mark defaultStorageAccount nullable"**
### Description
When ingesting data from Azure blob storage, you can currently only do so if
your SAS token has `write` permissions, even though this is not required to
list and read blob objects.
The source of this bug lies in the fact that all calls in `AzureStorage` get
a container client by calling `createBlobContainerIfNotExists`. This SDK method
actually performs an API call that needs `write` permissions.
#### Bugfix
To fix this issue, I updated the calls getting container clients in
`AzureStorage` to only use `createBlobContainerIfNotExists` for write
operations, where it makes sense.
Specifically, `getBlockBlobOutputStream` and `uploadBlockBlob` will continue
to create a container if it doesn't exist. This is useful when using Azure blob
storage for deep storage and/or task logs.
> That said, this behaviour is somewhat unique to the Azure extension. In S3
for example, I believe the bucket needs to exist. Maybe it would make sense to
deprecate this behaviour in the future to be more consistent across Druid, and
require the container to exist.
All the other calls (read blob storage, check if blob exists, list blobs in
the container, delete blobs) will require the container to exist. I think this
makes sense given the nature of these calls.
#### Other changes
I also cleaned up the `AzureStorage` class so it can be easier maintained in
the future. Specifically, I
- used Azure terminology throughout the class (e.g. `prefix` vs
`virtualDirPath`)
- added `@Nullable` annotations where parameters are optional
- added a whole bunch of Javadoc
<hr>
##### Key changed/added classes in this PR
* `AzureStorage`
<hr>
This PR has:
- [ ] been self-reviewed.
- [x] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [x] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [x] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]