agresch commented on a change in pull request #3363: URL: https://github.com/apache/storm/pull/3363#discussion_r550682688
########## File path: external/storm-hdfs-blobstore/src/main/java/org/apache/storm/hdfs/blobstore/HdfsBlobStoreImpl.java ########## @@ -312,4 +313,54 @@ 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 { + long modtime = fileSystem.getFileStatus(fullPath).getModificationTime(); + return modtime; + } + + /** + * Updates the modification time of the blobstore to the current time. + * + * @throws IOException on any error + */ + public void updateLastModTime() throws IOException { + long timestamp = Time.currentTimeMillis(); + fileSystem.setTimes(fullPath, timestamp, timestamp); + LOG.debug("Updated blobstore modtime of {} to {}", fullPath, timestamp); + } + + /** + * Validates that the modification time of the blobstore is up to date with the current existing blobs. + * + * @throws IOException on any error + */ + public void validateModTime() throws IOException { + int currentBucket = 0; + long baseModTime = 0; + while (currentBucket < BUCKETS) { + String name = String.valueOf(currentBucket); + Path bucketDir = new Path(fullPath, name); + + // only consider bucket dirs that exist with files in them + if (fileSystem.exists(bucketDir) && fileSystem.listStatus(bucketDir).length > 0) { + long modtime = fileSystem.getFileStatus(bucketDir).getModificationTime(); Review comment: The modification timestamp of the directory updates when a blob in the directory changes or is deleted. ---------------------------------------------------------------- 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