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


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/AzureResource.java:
##########
@@ -91,51 +92,89 @@ protected static void pingAzure(String bucketName, String 
rootPath,
         String testObj = "s3://" + bucketName + "/" + rootPath
                 + "/doris-test-object-valid-" + timestamp + ".txt";
 
-        byte[] contentData = new byte[2 * ObjStorage.CHUNK_SIZE];
+        // 5MB per chunk — same as the multipart upload minimum
+        final int chunkSize = 5 * 1024 * 1024;
+        byte[] contentData = new byte[2 * chunkSize];
         Arrays.fill(contentData, (byte) 'A');
-        AzureProperties azureProperties = (AzureProperties) 
StorageProperties.createPrimary(newProperties);
-        AzureObjStorage azureObjStorage = new AzureObjStorage(azureProperties);
-
-        Status status = azureObjStorage.putObject(testObj, new 
ByteArrayInputStream(contentData), contentData.length);
-        if (!Status.OK.equals(status)) {
-            throw new DdlException(
-                    "ping azure failed(put), status: " + status + ", 
properties: " + new DatasourcePrintableMap<>(
-                            newProperties, "=", true, false, true, false));
-        }
 
-        status = azureObjStorage.headObject(testObj);
-        if (!Status.OK.equals(status)) {
-            throw new DdlException(
-                    "ping azure failed(head), status: " + status + ", 
properties: " + new DatasourcePrintableMap<>(
-                            newProperties, "=", true, false, true, false));
-        }
+        try {
+            org.apache.doris.filesystem.FileSystem fileSystem =
+                    FileSystemFactory.getFileSystem(newProperties);
+            Preconditions.checkState(fileSystem instanceof ObjFileSystem,
+                    "Expected object-storage filesystem for Azure resource");
+            ObjStorage<?> objStorage = ((ObjFileSystem) 
fileSystem).getObjStorage();
 
-        RemoteObjects remoteObjects = azureObjStorage.listObjects(testObj, 
null);
-        LOG.info("remoteObjects: {}", remoteObjects);
-        Preconditions.checkArgument(remoteObjects.getObjectList().size() == 1, 
"remoteObjects.size() must equal 1");
+            try {
+                objStorage.putObject(testObj,
+                        RequestBody.of(new ByteArrayInputStream(contentData), 
contentData.length));
+            } catch (IOException e) {
+                throw new DdlException("ping azure failed(put), err: " + 
e.getMessage()
+                        + ", properties: " + new DatasourcePrintableMap<>(
+                                newProperties, "=", true, false, true, false));
+            }
 
-        status = azureObjStorage.deleteObject(testObj);
-        if (!Status.OK.equals(status)) {
-            throw new DdlException(
-                    "ping azure failed(delete), status: " + status + ", 
properties: " + new DatasourcePrintableMap<>(
-                            newProperties, "=", true, false, true, false));
-        }
+            try {
+                objStorage.headObject(testObj);
+            } catch (IOException e) {
+                throw new DdlException("ping azure failed(head), err: " + 
e.getMessage()
+                        + ", properties: " + new DatasourcePrintableMap<>(
+                                newProperties, "=", true, false, true, false));
+            }
 
-        status = azureObjStorage.multipartUpload(testObj,
-                new ByteArrayInputStream(contentData), contentData.length);
-        if (!Status.OK.equals(status)) {
-            throw new DdlException(
-                    "ping azure failed(multiPartPut), status: " + status
-                            + ", properties: " + new DatasourcePrintableMap<>(
-                            newProperties, "=", true, false, true, false));
-        }
+            try {
+                org.apache.doris.filesystem.spi.RemoteObjects remoteObjects =
+                        objStorage.listObjects(testObj, null);
+                LOG.info("remoteObjects: {}", remoteObjects);

Review Comment:
   Would it make more sense to use DEBUG level here? I'm worried about 
excessive log volume



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

Reply via email to