agresch commented on a change in pull request #3363:
URL: https://github.com/apache/storm/pull/3363#discussion_r555288103



##########
File path: 
external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java
##########
@@ -312,4 +321,70 @@ public void shutdown() {
             timer.cancel();
         }
     }
+
+    /**
+     * Get the last modification time of any blob.
+     *
+     * @return the last modification time of blobs within the blobstore.
+     * @throws IOException on any error
+     */
+    public long getLastModTime() throws IOException {
+        Path modTimeFile = new Path(fullPath, BLOBSTORE_MOD_TIME_FILE);
+        if (!fileSystem.exists(modTimeFile)) {
+            return -1L;
+        }
+        FSDataInputStream inputStream = fileSystem.open(modTimeFile);
+        String timestamp = IOUtils.toString(inputStream, "UTF-8");
+        inputStream.close();
+        try {
+            long modTime = Long.parseLong(timestamp);
+            return modTime;
+        } catch (NumberFormatException e) {
+            LOG.error("Invalid blobstore modtime {} in file {}", timestamp, 
modTimeFile);
+            return -1L;
+        }
+    }
+
+    /**
+     * Updates the modification time of the blobstore to the current time.
+     *
+     * @throws IOException on any error
+     */
+    public void updateLastModTime() throws IOException {

Review comment:
       validateModTime() would eventually fix things, but I will add 
synchronization.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to