You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/12/02 23:15:14 UTC

[GitHub] [iceberg] jackye1995 commented on pull request #1863: AWS: support S3 strong consistency

jackye1995 commented on pull request #1863:
URL: https://github.com/apache/iceberg/pull/1863#issuecomment-737552943


   > It looks like it should be possible to use just a LIST call here because we don't need the full metadata from the HEAD request. Metadata is only used for the existence check and for the file size, which should be available from the list response:
   > 
   > ```java
   >       // list object to force strong consistency
   >       ListObjectsV2Response response = client().listObjectsV2(ListObjectsV2Request.builder()
   >           .bucket(uri().bucket())
   >           .prefix(uri().key())
   >           .build());
   > 
   >       Preconditions.checkState(response.contents().size() <= 1, "Invalid file: %s contains more than one object", uri);
   >       this.exists = response.contents().size() > 0;
   >       this.length = response.contents().get(0).size();
   > ```
   
   Thanks for the suggestion, did not know LIST also gets the length metadata.


----------------------------------------------------------------
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



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