amogh-jahagirdar commented on code in PR #10721:
URL: https://github.com/apache/iceberg/pull/10721#discussion_r1709931564


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIO.java:
##########
@@ -420,4 +427,40 @@ protected void finalize() throws Throwable {
       }
     }
   }
+
+  @Override
+  public boolean recoverFile(String path) {
+    S3URI location = new S3URI(path, 
s3FileIOProperties.bucketToAccessPointMapping());
+    ListObjectVersionsIterable response =
+        client()
+            .listObjectVersionsPaginator(
+                ListObjectVersionsRequest.builder()
+                    .bucket(location.bucket())
+                    .prefix(location.key())
+                    .build());
+
+    Optional<ObjectVersion> latestVersion =
+        
response.versions().stream().max(Comparator.comparing(ObjectVersion::lastModified));
+    return latestVersion.map(version -> recoverObject(version, 
location.bucket())).orElse(false);

Review Comment:
   I think this might be my poor naming, this latestVersion is the version we 
want to recover to.
   For the "isLatest()" check S3 considers deletion markers .
   
   isLatest will only be true for the deletion marker version. 
   The version that we want to recover to is not the latest version based on 
S3's consideration of deletion markers; it's the version just before that which 
the current check will do based on the last modified of the versions (deletions 
are not included in response.versions().
   
   I'll call this variable `recoveryVersion` and add an inline comment.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to