singhpk234 commented on code in PR #10721:
URL: https://github.com/apache/iceberg/pull/10721#discussion_r1708266721
##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIO.java:
##########
@@ -420,4 +427,38 @@ 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);
+ }
+
+ private boolean recoverObject(ObjectVersion version, String bucket) {
+ LOG.info("Attempting to recover object {}", version.key());
+ try {
+ client.copyObject(
Review Comment:
```suggestion
client().copyObject(
```
can we use `client()` instead of client, as it might be null when serde
happens copy to all places
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]