You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "Akshat-Jain (via GitHub)" <gi...@apache.org> on 2025/04/07 10:56:13 UTC

[PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Akshat-Jain opened a new pull request, #17887:
URL: https://github.com/apache/druid/pull/17887

   ### Description
   
   In https://github.com/apache/druid/pull/17576, we updated the Azure BOM from version `1.2.23` to `1.2.30`. This updated the `azure-storage-blob` package from `12.25.4` to `12.29.0`.
   
   But, version `12.26.0-beta.1` included a breaking change, as can be seen here: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob/CHANGELOG.md#12260-beta1-2024-04-15
   
   Quoting here for quick reference:
   > When creating a BlobClient via BlobContainerClient.getBlobClient(String blobName) or BlobServiceClient.getBlobClient(String blobName), the blob name will be stored exactly as passed in and will not be URL-encoded. For example, if blob name is "test%25test" and is created by calling BlobContainerClient.getBlobClient("test%25test") or BlobClient.getBlobName("test%25test"), BlobClient.getBlobName() will return "test%25test" and the blob's url will result in “[https://account.blob.core.windows.net/container/test%25%25test”](https://account.blob.core.windows.net/container/test%25%25test%E2%80%9D).
   
   I also verified this by trying it against an actual Azure setup.
   
   For the test, I had a blob container named `akshat-testing`, in which I had 2 files with the following hierarchy and names:
   1. `akshat-testing/outer folder/inner folder/file1`
   2. `akshat-testing/outer%20folder/inner%20folder/file2`
   
   I then tried using the library method to fetch info about the blob:
   ```java
       long blobSize = clientBuilder
           .buildClient()
           .getBlobContainerClient("akshat-testing")
           .getBlobClient(blobPath)
           .getBlockBlobClient()
           .getProperties()
           .getBlobSize();
   ```
   
   The conclusions with usage of the above method confirmed the reported breaking change as well as the fix being done in this PR.
   
   For version `12.29.0`:
   1. `"outer folder/inner folder/file1"` - Passing this `blobPath` directly works, but URL encoded doesn't work
   2. `"outer%20folder/inner%20folder/file2"` - Passing this `blobPath` directly works, but URL encoded doesn't work
   
   Comparing this with the older version `12.25.4`:
   1. `"outer folder/inner folder/file1"` - Passing this `blobPath` directly works, and URL encoded also works
   2. `"outer%20folder/inner%20folder/file2"` - Passing this `blobPath` directly doesn't work, but URL encoded works
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [x] been self-reviewed.
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] 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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Posted by "Akshat-Jain (via GitHub)" <gi...@apache.org>.
Akshat-Jain commented on code in PR #17887:
URL: https://github.com/apache/druid/pull/17887#discussion_r2031001792


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java:
##########
@@ -442,7 +441,7 @@ public void uploadBlockBlob(
       blobContainerClient
           // Creates a blob by default, no need to use a specific blob client.
           // We also need to urlEncode the path to handle special characters.
-          .getBlobClient(Utility.urlEncode(blobName))
+          .getBlobClient(blobName)

Review Comment:
   Yes, I tried with `String blobPath = "some_random/path-%%@#@$abcd/file1";` as well. Had the same conclusions there, hence ended up mentioning a simpler example for everyone's reference.



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Posted by "rohangarg (via GitHub)" <gi...@apache.org>.
rohangarg commented on PR #17887:
URL: https://github.com/apache/druid/pull/17887#issuecomment-2783018716

   Putting it here since it seems like the right place to consider investigating `azurite` (local azure blob service library) based integration tests for Azure Blob Storage - I see some examples at https://java.testcontainers.org/modules/azure/ 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Posted by "Akshat-Jain (via GitHub)" <gi...@apache.org>.
Akshat-Jain merged PR #17887:
URL: https://github.com/apache/druid/pull/17887


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Posted by "Akshat-Jain (via GitHub)" <gi...@apache.org>.
Akshat-Jain commented on code in PR #17887:
URL: https://github.com/apache/druid/pull/17887#discussion_r2031001792


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java:
##########
@@ -442,7 +441,7 @@ public void uploadBlockBlob(
       blobContainerClient
           // Creates a blob by default, no need to use a specific blob client.
           // We also need to urlEncode the path to handle special characters.
-          .getBlobClient(Utility.urlEncode(blobName))
+          .getBlobClient(blobName)

Review Comment:
   Yes, I tried with blob paths like `String blobPath = "some_random/path-%%@#@$abcd/file1";` as well. Had the same conclusions there, hence ended up mentioning a simpler example for everyone's reference.



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix BlobClient issues because of breaking change wrt URL encoding (druid)

Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #17887:
URL: https://github.com/apache/druid/pull/17887#discussion_r2030998818


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/AzureStorage.java:
##########
@@ -442,7 +441,7 @@ public void uploadBlockBlob(
       blobContainerClient
           // Creates a blob by default, no need to use a specific blob client.
           // We also need to urlEncode the path to handle special characters.
-          .getBlobClient(Utility.urlEncode(blobName))
+          .getBlobClient(blobName)

Review Comment:
   Since you have a test setup running, could you please try with other special characters like 
   @, / ,     , _, - * . 



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org