CalvinKirs commented on code in PR #51229:
URL: https://github.com/apache/doris/pull/51229#discussion_r2107338386


##########
fe/fe-core/src/main/java/org/apache/doris/fsv2/remote/S3FileSystem.java:
##########
@@ -72,16 +76,29 @@ public Status globList(String remotePath, List<RemoteFile> 
result, boolean fileN
     }
 
     @Override
-    public boolean connectivityTest() throws UserException {
+    public boolean connectivityTest(List<String> filePaths) throws 
UserException {
+        if (filePaths == null || filePaths.isEmpty()) {
+            throw new UserException("File paths cannot be null or empty for 
connectivity test.");
+        }
         S3ObjStorage objStorage = (S3ObjStorage) this.objStorage;
         try {
-            objStorage.getClient().listBuckets();
+            S3Client s3Client = objStorage.getClient();
+            Set<String> bucketNames = new HashSet<>();
+            boolean usePathStyle = 
Boolean.parseBoolean(s3Properties.getUsePathStyle());
+            boolean forceParsingByStandardUri = 
Boolean.parseBoolean(s3Properties.getForceParsingByStandardUrl());
+            for (String filePath : filePaths) {
+                S3URI s3uri;
+                s3uri = S3URI.create(filePath, usePathStyle, 
forceParsingByStandardUri);
+                bucketNames.add(s3uri.getBucket());
+            }
+            bucketNames.forEach(bucketName -> {

Review Comment:
   We might have cross-bucket scenarios, but since we're using a HashSet to 
store the buckets, each unique bucket will only be requested once.



-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to