nsivarajan commented on code in PR #63918:
URL: https://github.com/apache/doris/pull/63918#discussion_r3332698484


##########
be/src/runtime/small_file_mgr.cpp:
##########
@@ -192,7 +189,32 @@ Status SmallFileMgr::_download_file(int64_t file_id, const 
std::string& md5,
         }
         return true;
     };
-    RETURN_IF_ERROR(client.execute(download_cb));
+
+    std::string url = "http://"; + host_port + query;
+    LOG(INFO) << "download file from: " << url;
+    HttpClient client;
+    RETURN_IF_ERROR(client.init(url));
+    Status execute_status = client.execute(download_cb);
+
+    if (!execute_status.ok()) {
+        rewind(fp.get());
+        if (ftruncate(fileno(fp.get()), 0) != 0) {
+            LOG(WARNING) << "fail to truncate temp file for https retry, 
errno=" << errno;
+        }
+        status = Status::OK();
+        digest = Md5Digest();
+
+        url = "https://"; + host_port + query;
+        LOG(INFO) << "HTTP failed, retrying with HTTPS: " << url;
+        HttpClient https_client;
+        RETURN_IF_ERROR(https_client.init(url));
+        // Skip TLS cert verification: internal cluster traffic only; file 
integrity
+        // is guaranteed independently by MD5 checksum verification below.

Review Comment:
   Reference HeartbeatManager fix in #60921 , which sets HTTPS scheme and HTTPS 
port .
   
   ```
       public void setMaster(int clusterId, String token, long epoch) {
           TMasterInfo tMasterInfo = new TMasterInfo(
                   new TNetworkAddress(FrontendOptions.getLocalHostAddress(), 
Config.rpc_port), clusterId, epoch);
           tMasterInfo.setToken(token);
           tMasterInfo.setHttpPort(Config.enable_https ? Config.https_port : 
Config.http_port);
           long flags = heartbeatFlags.getHeartbeatFlags();
           tMasterInfo.setHeartbeatFlags(flags);
           if (Config.isCloudMode()) {
               // Set the endpoint for the metadata service in cloud mode
               tMasterInfo.setMetaServiceEndpoint(Config.meta_service_endpoint);
           }
           masterInfo.set(tMasterInfo);
       }
   ```



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