amit-jain commented on code in PR #2409:
URL: https://github.com/apache/jackrabbit-oak/pull/2409#discussion_r2415596598


##########
oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java:
##########
@@ -719,34 +665,30 @@ public boolean deleteMetadataRecord(String name) {
 
     @Override
     public void deleteAllMetadataRecords(String prefix) {
-        if (null == prefix) {
-            throw new NullPointerException("prefix");
-        }
-        long start = System.currentTimeMillis();
+        Objects.requireNonNull(prefix, "prefix must not be null");
+
+        Stopwatch stopwatch = Stopwatch.createStarted();
         ClassLoader contextClassLoader = 
Thread.currentThread().getContextClassLoader();
         try {
             
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
-            CloudBlobDirectory metaDir = 
getAzureContainer().getDirectoryReference(META_DIR_NAME);
             int total = 0;
-            for (ListBlobItem item : metaDir.listBlobs(prefix)) {
-                if (item instanceof CloudBlob) {
-                    if (((CloudBlob)item).deleteIfExists()) {
-                        total++;
-                    }
+
+            ListBlobsOptions listBlobsOptions = new ListBlobsOptions();
+            
listBlobsOptions.setPrefix(AzureConstants.AZURE_BlOB_META_DIR_NAME);

Review Comment:
   prefix is completely ignored 
   ```suggestion
               
listBlobsOptions.setPrefix(AzureConstants.AZURE_BlOB_META_DIR_NAME + "/" + 
prefix);
   ```
   Looks like this is missing a test in the original as well, please add a test 
as this can cause data loss.



-- 
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]

Reply via email to