Ethanlm commented on a change in pull request #3094: STORM-3477 switch HDFS 
blobstore isRemoteBlobExists to use file exist…
URL: https://github.com/apache/storm/pull/3094#discussion_r308430348
 
 

 ##########
 File path: 
external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStore.java
 ##########
 @@ -336,6 +336,27 @@ public InputStreamWithMeta getBlob(String key, Subject 
who)
         }
     }
 
+    /**
+     * Checks if a blob exists.
+     *
+     * @param key blobstore key
+     * @param who subject
+     * @throws AuthorizationException if authorization is failed
+     * @throws KeyNotFoundException if key is not found
+     */
+    public boolean blobExists(String key, Subject who) throws 
AuthorizationException, KeyNotFoundException {
+        who = checkAndGetSubject(who);
+        validateKey(key);
+        SettableBlobMeta meta = getStoredBlobMeta(key);
+        aclHandler.hasPermissions(meta.get_acl(), READ, who, key);
+        try {
+            BlobStoreFile blobStoreFile = hbs.read(DATA_PREFIX + key);
+            return blobStoreFile.exists();
 
 Review comment:
   I think it's more clear if we consider the blob exists when `meta_<key>` 
exists. 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to