hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] steveloughran commented on a change in pull request #802: HADOOP-16279. S3Guard: Implement time-based (TTL) expiry for entries …
Date Fri, 31 May 2019 19:13:16 GMT
steveloughran commented on a change in pull request #802: HADOOP-16279. S3Guard: Implement
time-based (TTL) expiry for entries …
URL: https://github.com/apache/hadoop/pull/802#discussion_r289518787
 
 

 ##########
 File path: hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3Guard.java
 ##########
 @@ -551,10 +548,51 @@ public static void putWithTtl(MetadataStore ms, DirListingMetadata
dirMeta,
     ms.put(dirMeta);
   }
 
+  public static void putWithTtl(MetadataStore ms, PathMetadata fileMeta,
+      ITtlTimeProvider timeProvider) throws IOException {
+    fileMeta.setLastUpdated(timeProvider.getNow());
+    ms.put(fileMeta);
+  }
+
+  public static void putWithTtl(MetadataStore ms,
+      Collection<PathMetadata> fileMetas, ITtlTimeProvider timeProvider)
+      throws IOException {
+    final long now = timeProvider.getNow();
+    fileMetas.forEach(fileMeta -> fileMeta.setLastUpdated(now));
+    ms.put(fileMetas);
+  }
+
+  public static PathMetadata getWithTtl(MetadataStore ms, Path path,
+      ITtlTimeProvider timeProvider) throws IOException {
+    long ttl = timeProvider.getMetadataTtl();
+
+    final PathMetadata pathMetadata = ms.get(path);
+
+    if(pathMetadata != null) {
+      // Special case: the pathmetadata's last updated is 0. This can happen
+      // eg. with an old db using this implementation
+      if(pathMetadata.getLastUpdated() == 0) {
 
 Review comment:
   nit: add whitespace between if and ()

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message