jorisvandenbossche commented on code in PR #14601:
URL: https://github.com/apache/arrow/pull/14601#discussion_r1019242095


##########
cpp/src/arrow/filesystem/s3fs.cc:
##########
@@ -2303,10 +2303,14 @@ Result<FileInfo> S3FileSystem::GetFileInfo(const 
std::string& s) {
     auto outcome = impl_->client_->HeadBucket(req);
     if (!outcome.IsSuccess()) {
       if (!IsNotFound(outcome.GetError())) {
-        return ErrorToStatus(
-            std::forward_as_tuple("When getting information for bucket '", 
path.bucket,
-                                  "': "),
-            "HeadBucket", outcome.GetError());
+        auto msg = "When getting information for bucket '" + path.bucket + "': 
";
+        // Bucket exists, but failed to call HeadBucket, perhaps wrong region?
+        ARROW_ASSIGN_OR_RAISE(auto region, 
impl_->client_->GetBucketRegion(path.bucket));

Review Comment:
   Note that we only do this extra API call if there is an error (so it doesn't 
impact code that doesn't error), and also only if the bucket exists (because if 
it doesn't exist (eg a typo), we return FileType::NotFound). So that might 
already limit the cases where this extra call would actually be a problem.
   
   Another option could be to only check for this is the AWS Error is UNKNOWN 
(since it doesn't seem to have a specific error code for "buckets exists but 
not on this region")



-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to