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


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/BrokerDesc.java:
##########
@@ -75,42 +77,61 @@ public BrokerDesc(String name, Map<String, String> 
properties) {
         if (properties != null) {
             this.properties.putAll(properties);
         }
+        // Assume the storage type is BROKER by default
+        // If it's a multi-load broker, override the storage type to LOCAL
         if (isMultiLoadBroker()) {
             this.storageType = StorageBackend.StorageType.LOCAL;
         } else {
             this.storageType = StorageBackend.StorageType.BROKER;
         }
-        
this.properties.putAll(S3ClientBEProperties.getBeFSProperties(this.properties));
-        this.convertedToS3 = BosProperties.tryConvertBosToS3(this.properties, 
this.storageType);
-        if (this.convertedToS3) {
-            this.storageType = StorageBackend.StorageType.S3;
+
+        // Try to determine the actual storage type from properties if 
available
+        if (MapUtils.isNotEmpty(properties)) {
+            try {
+                // Create primary storage properties from the given 
configuration
+                this.storageProperties = 
StorageProperties.createPrimary(properties);
+                // Override the storage type based on property configuration
+                this.storageType = 
StorageBackend.StorageType.valueOf(storageProperties.getStorageName());
+            } catch (RuntimeException e) {
+                // Currently ignored: these properties might be 
broker-specific.
+                // Support for broker properties will be added in the future.
+                LOG.info("Failed to create storage properties for broker: {}, 
properties: {}", name, properties, e);
+            }
+        }
+        if (StringUtils.isBlank(this.name)) {

Review Comment:
   Yes, the name might be null (when broker.name isn't set). We try to infer 
the parameters—for example, converting them to HDFS or S3. If the conversion 
succeeds and the name is still null, we need to set the name to avoid 
unexpected NullPointerExceptions.



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